Repository navigation
Support object-form texture references in block models (1.21.4+) - #79
NereusOcean wants to merge 2 commits into
Conversation
|
Can the |
|
Yeah, it can - the format allows # refs anywhere. In the current vanilla assets the sprite is always a plain path so it doesn't actually come up, but I updated getTexture so it keeps resolving when the sprite is a # reference (and when an object shows up partway through a chain). I also swapped the while for a loop bounded by the number of texture keys - a valid chain can't hit the same key twice, so this way a cyclic reference in a broken pack can't spin forever. Added tests for both. This might be overkill though - cyclic refs only happen in a broken pack. If you'd rather keep it minimal I can drop that last commit and leave just the object-sprite fix. Your call. |
|
I've fixed the issue in aa64176 |
Since 1.21.4, a block model's
texturesvalue can be an object{ "sprite": "...", "force_translucent": true }instead of a bare path string(e.g. glass, stained glass).
BlockModel.getTextureassumed a string and failedto resolve these, so those blocks rendered untextured.
This resolves the object form to its
sprite. Backward compatible - the stringform is unchanged. Translucency is intentionally out of scope: deepslate derives
it from block flags (
getBlockFlags().semi_transparent), not from the model, soforce_translucentis not wired into rendering here.Adds test/render/BlockModel.test.ts (string ref, object ref, ref-chain in object).