Skip to content

fix using the cubyzDir two times - #3051

Closed
Wunka wants to merge 2 commits into
PixelGuys:masterfrom
Wunka:fixDoubleSave
Closed

Wunka wants to merge 2 commits into
PixelGuys:masterfrom
Wunka:fixDoubleSave

Conversation

@Wunka

@Wunka Wunka commented May 7, 2026

Copy link
Copy Markdown
Contributor

Fixes part of #2879

In this function the cubyzDir was passed even tough we call all open Dir etc directly on cubyzDir already. this made so that if cubyzDir was something diffreent than . (where ././ is just the same as ./) we would go two times into a directory

@IntegratedQuantum IntegratedQuantum left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same issue appears on the client (→when you join a server instead of playing locally, it loads the assets on the client)

@IntegratedQuantum IntegratedQuantum moved this from Easy to Review to In review in PRs to review May 8, 2026
@Wunka

Wunka commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

Found and fixed

@ztianyang

Copy link
Copy Markdown

I tested this fix, and the bug #2879 no longer happened. However, when I tried to use the trampoline addon in a world I created, the block textures didn't load properly.

Screenshot From 2026-05-08 21-14-49
[error]: File not found. Searched in "assets/trampolines/blocks/textures/glowing_trampoline/net.png" and also in the assetFolder "saves/test_world/assets/"
[error]: File not found. Searched in "assets/trampolines/blocks/textures/glowing_trampoline/underside.png" and also in the assetFolder "saves/test_world/assets/"
[error]: File not found. Searched in "assets/trampolines/blocks/textures/glowing_trampoline/feet.png" and also in the assetFolder "saves/test_world/assets/"
[error]: File not found. Searched in "assets/trampolines/blocks/textures/glowing_trampoline/top.png" and also in the assetFolder "saves/test_world/assets/"
[error]: File not found. Searched in "assets/trampolines/blocks/textures/glowing_trampoline/side.png" and also in the assetFolder "saves/test_world/assets/"
[debug]: Registered block:   396 'trampolines:trampoline'
[error]: File not found. Searched in "assets/trampolines/blocks/textures/trampoline/net.png" and also in the assetFolder "saves/test_world/assets/"
[error]: File not found. Searched in "assets/trampolines/blocks/textures/trampoline/underside.png" and also in the assetFolder "saves/test_world/assets/"
[error]: File not found. Searched in "assets/trampolines/blocks/textures/trampoline/feet.png" and also in the assetFolder "saves/test_world/assets/"
[error]: File not found. Searched in "assets/trampolines/blocks/textures/trampoline/top.png" and also in the assetFolder "saves/test_world/assets/"
[error]: File not found. Searched in "assets/trampolines/blocks/textures/trampoline/side.png" and also in the assetFolder "saves/test_world/assets/"

After I copied the trampoline addon from saves/saves/test_world/assets/trampolines (the path is relative to the directory with the Cubyz executable) to saves/test_world/assets/trampolines, the block textures loaded properly. So maybe there's another issue with path handling when loading block textures from world addons.

@Wunka

Wunka commented May 9, 2026

Copy link
Copy Markdown
Contributor Author

I tested this fix, and the bug #2879 no longer happened. However, when I tried to use the trampoline addon in a world I created, the block textures didn't load properly.
Screenshot From 2026-05-08 21-14-49

[error]: File not found. Searched in "assets/trampolines/blocks/textures/glowing_trampoline/net.png" and also in the assetFolder "saves/test_world/assets/"
[error]: File not found. Searched in "assets/trampolines/blocks/textures/glowing_trampoline/underside.png" and also in the assetFolder "saves/test_world/assets/"
[error]: File not found. Searched in "assets/trampolines/blocks/textures/glowing_trampoline/feet.png" and also in the assetFolder "saves/test_world/assets/"
[error]: File not found. Searched in "assets/trampolines/blocks/textures/glowing_trampoline/top.png" and also in the assetFolder "saves/test_world/assets/"
[error]: File not found. Searched in "assets/trampolines/blocks/textures/glowing_trampoline/side.png" and also in the assetFolder "saves/test_world/assets/"
[debug]: Registered block:   396 'trampolines:trampoline'
[error]: File not found. Searched in "assets/trampolines/blocks/textures/trampoline/net.png" and also in the assetFolder "saves/test_world/assets/"
[error]: File not found. Searched in "assets/trampolines/blocks/textures/trampoline/underside.png" and also in the assetFolder "saves/test_world/assets/"
[error]: File not found. Searched in "assets/trampolines/blocks/textures/trampoline/feet.png" and also in the assetFolder "saves/test_world/assets/"
[error]: File not found. Searched in "assets/trampolines/blocks/textures/trampoline/top.png" and also in the assetFolder "saves/test_world/assets/"
[error]: File not found. Searched in "assets/trampolines/blocks/textures/trampoline/side.png" and also in the assetFolder "saves/test_world/assets/"

After I copied the trampoline addon from saves/saves/test_world/assets/trampolines (the path is relative to the directory with the Cubyz executable) to saves/test_world/assets/trampolines, the block textures loaded properly. So maybe there's another issue with path handling when loading block textures from world addons.

did you change cubyzDir to anything?

@ztianyang

Copy link
Copy Markdown

I set it to "saves", same as the second part of #2879.

@Wunka

Wunka commented May 9, 2026

Copy link
Copy Markdown
Contributor Author

@ztianyang so it is only a migration problem? or is there still some bug with this pr?

@ztianyang

Copy link
Copy Markdown

I don't think it's a migration problem, since saves/test_world/assets isn't where the game is supposed to look for world assets for test_world when cubyzDir is set to "saves". And if I'm understanding the code correctly, there are places in the code that assumes that the path string assetFolder is relative to the current working directory and not the cubyz saves directory (e.g.

try registerBlock(assetFolder, stringId, zon);
and
const file = main.files.cwd().openFile(path) catch |err| blk: {
)

@Wunka Wunka closed this Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants