Skip to content

A fix for heavy_core failing to get it's texture#62

Merged
misode merged 3 commits intomisode:mainfrom
SpaceshipCaptain:fix-heavy-core-texture-error
Jan 3, 2026
Merged

A fix for heavy_core failing to get it's texture#62
misode merged 3 commits intomisode:mainfrom
SpaceshipCaptain:fix-heavy-core-texture-error

Conversation

@SpaceshipCaptain
Copy link
Contributor

Before:
before
After:
after

Currently the heavy_core model is falling back to the texture at 0, 0 on the texture atlas because it's trying to use "all" as a texture and that doesn't exist. The heavy core's block model has it's face's textures defined like "texture": "all" but they should be defined like "texture": "#all". Without a '#' getTexture will skip the texture lookup for heavy_core.

I am not sure this is the best approach to solve this so let me know if you have a better idea. Added an extra check to make sure the textureRef string doesn't exist in this.textures before returning it. I put a cap of 7 on the loop out of an abundance of caution but it rarely reaches 3. The other option I thought of would just be an explicit if === 'all' check to only catch this one case.

If Mojang fixes how they define the heavy_core model this would be unnecessary but as far as I can tell this is how they have defined it since they added the block.

@jacobsjo
Copy link
Contributor

jacobsjo commented Jul 7, 2025

For reference: This is reported in MC-270059.

@SpaceshipCaptain
Copy link
Contributor Author

For reference: This is reported in MC-270059.

Ah, so it has been known about for a while. I think it's reasonable to not want to add a work around for a Mojang bug so no hard feelings if that determination is made. But it's also been a problem for over year and there is no way to know when they will get around to fixing it.

@jacobsjo
Copy link
Contributor

jacobsjo commented Jul 7, 2025

I've looked at the code. The # seems to only be optional in the texture field of a face. That's because you can't put a texture id there directly. In the textures object, a # is required to mark it as a variable, while its interpreted as a texture id otherwise.

I think we should handle it the same way. It should simplify this logic a bit.

@SpaceshipCaptain SpaceshipCaptain force-pushed the fix-heavy-core-texture-error branch from c49d314 to 72ad94b Compare July 8, 2025 05:38
@SpaceshipCaptain
Copy link
Contributor Author

SpaceshipCaptain commented Jul 8, 2025

I think this is what you meant but I am not 100% sure so let me know if you had something else in mind. I changed it to always assume it's getting handed a key and then only go into the while loop if gets returned another variable("#") from that initial lookup. This does catch the wrong heavy_core model and it also gets rid of the extra lookups that my first version was doing.

Sorry for the git nonsense I am a bumbling fool.

@misode misode merged commit 2869063 into misode:main Jan 3, 2026
1 check passed
@SpaceshipCaptain SpaceshipCaptain deleted the fix-heavy-core-texture-error branch January 3, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants