Description
Description:
When a copycat like block on train contraption overlaps a real world copycat like block at the same in-world position, particle texture lookup can pass:
- the contraption block as
BlockState
- the real world block's
ModelData from that position
into BakedModelWrapperWithData
src/main/java/com/simibubi/create/foundation/model/BakedModelWrapperWithData.java line 18
This is especially a problem for copycat block models, because their gatherModelData() logic receives both state and blockEntityData and assumes they refer to the same logical block and copycat blocks use blockEntityData's material:
src/main/java/com/simibubi/create/content/decoration/copycat/CopycatModel.java line 45
Steps to Reproduce:
- Assemble a train with a vertically placed Copycats+
copycat_byte_panel
- Place a
copycat_slab in the world at the same position where the copycat_byte_panel is vertically
- Run over that
copycat_byte_panel or generate sprint/fall particles on it
- The game crashes during particle creation
Note: if replace both copycat_byte_panel and copycat_slab with Create's copycat_panel, the game won't crash, but it will always use the in-world copycat_panel material for the particles.
Reason:
- When the game creates particles, it runs thru
BlockModelShaper.getTexture()
→ BakedModelWrapperWithData.getModelData()
where in getTexture() it does
ModelData data = level.getModelDataManager().getAt(pos); BakedModel model = this.getBlockModel(arg); return model.getParticleIcon(model.getModelData(level, pos, arg, data == null ? ModelData.EMPTY : data));
Where arg is the blockstate of the block that needs to generate particle for. In this case, arg is copycat byte panel on train contraption, but somehow this method believes that this copycat byte panel is at pos in level, and so level.getModelDataManager().getAt(pos) returns the data for the real block at pos (in this case, copycat slab), causing a mismatch. In vanilla it won't happen so the mismatch got passed along.
- In copycat+ logic, it trusts
state and blockEntityData to be matched.
public ModelData.Builder gatherModelData(ModelData.Builder builder, BlockAndTintGetter world, BlockPos pos, BlockState state, ModelData blockEntityData)
- Copycat+ relies on
blockEntityData to get the materials, using a key->blockstate pair, if blockEntityData does not match state, it will have a key mismatch error.
A defensive fix can be applied on copycat+ side, but I think this mismatch is related to how Create manage blocks on contraption, and should be handled on Create's side.
Game Log
https://mclo.gs/nGaA5Sp
Debug Information
Client Info
Create:
Mod Version: 6.0.8
Mod Git Commit: 1a1a9a2819b4f89f78caec41b55ed8cb222fa24b
Ponder Version: 1.0.91
Forge Version: 47.2.6
Minecraft Version: 1.20.1
Graphics:
Flywheel Version: 1.0.5
Flywheel Backend: flywheel:instancing
OpenGL Renderer: Intel(R) UHD Graphics 730
OpenGL Version: 4.6.0 - Build 31.0.101.4575
Graphics Mode: fancy
PojavLauncher Detected: false
System Information:
Operating System: Windows 11 (amd64) version 10.0
Java Version: 17.0.14, JetBrains s.r.o.
JVM Flags: 2 total; -XX:+AllowEnhancedClassRedefinition -XX:+AllowEnhancedClassRedefinition
Memory: 905969664 bytes (864 MiB) / 3374317568 bytes (3218 MiB) up to 4213178368 bytes (4018 MiB)
Total Memory: 2473631424 bytes (2359 MiB) / 3374317568 bytes (3218 MiB)
CPU: Intel(R) Core(TM) i3-14100 @ 3.49 GHz; 4 cores / 8 threads on 1 socket(s)
Graphics card #0: Intel(R) UHD Graphics 730 (Intel Corporation (0x8086)); 1024.00 MB of VRAM
Other Mods:
MixinExtras: 0.4.1
Jade: 11.9.3+forge
generated_3a79a9c: 1
Create: Copycats+: 3.0.7+mc.1.20.1-forge
Just Enough Items: 15.19.5.99
Additional Placements: 2.2.1
spark: 1.10.53
Rubidium (Embeddium): 0.7.1
Embeddium: 0.3.31+mc1.20.1
Athena: 3.1.2
Server Info
Create:
Mod Version: 6.0.8
Mod Git Commit: 1a1a9a2819b4f89f78caec41b55ed8cb222fa24b
Ponder Version: 1.0.91
Forge Version: 47.2.6
Minecraft Version: 1.20.1
System Information:
Operating System: Windows 11 (amd64) version 10.0
Java Version: 17.0.14, JetBrains s.r.o.
JVM Flags: 2 total; -XX:+AllowEnhancedClassRedefinition -XX:+AllowEnhancedClassRedefinition
Memory: 905969664 bytes (864 MiB) / 3374317568 bytes (3218 MiB) up to 4213178368 bytes (4018 MiB)
Total Memory: 2473631424 bytes (2359 MiB) / 3374317568 bytes (3218 MiB)
CPU: Intel(R) Core(TM) i3-14100 @ 3.49 GHz; 4 cores / 8 threads on 1 socket(s)
Graphics card #0: Intel(R) UHD Graphics 730 (Intel Corporation (0x8086)); 1024.00 MB of VRAM
Other Mods:
MixinExtras: 0.4.1
Jade: 11.9.3+forge
generated_3a79a9c: 1
Create: Copycats+: 3.0.7+mc.1.20.1-forge
Just Enough Items: 15.19.5.99
Additional Placements: 2.2.1
spark: 1.10.53
Rubidium (Embeddium): 0.7.1
Embeddium: 0.3.31+mc1.20.1
Athena: 3.1.2
Description
Description:
When a copycat like block on train contraption overlaps a real world copycat like block at the same in-world position, particle texture lookup can pass:
BlockStateModelDatafrom that positioninto BakedModelWrapperWithData
src/main/java/com/simibubi/create/foundation/model/BakedModelWrapperWithData.java line 18
This is especially a problem for copycat block models, because their
gatherModelData()logic receives bothstateandblockEntityDataand assumes they refer to the same logical block and copycat blocks use blockEntityData's material:src/main/java/com/simibubi/create/content/decoration/copycat/CopycatModel.java line 45
Steps to Reproduce:
copycat_byte_panelcopycat_slabin the world at the same position where thecopycat_byte_panelis verticallycopycat_byte_panelor generate sprint/fall particles on itNote: if replace both
copycat_byte_panelandcopycat_slabwith Create'scopycat_panel, the game won't crash, but it will always use the in-worldcopycat_panelmaterial for the particles.Reason:
BlockModelShaper.getTexture()
→ BakedModelWrapperWithData.getModelData()
where in getTexture() it does
ModelData data = level.getModelDataManager().getAt(pos); BakedModel model = this.getBlockModel(arg); return model.getParticleIcon(model.getModelData(level, pos, arg, data == null ? ModelData.EMPTY : data));Where arg is the blockstate of the block that needs to generate particle for. In this case, arg is copycat byte panel on train contraption, but somehow this method believes that this copycat byte panel is at
posinlevel, and so level.getModelDataManager().getAt(pos) returns thedatafor the real block atpos(in this case, copycat slab), causing a mismatch. In vanilla it won't happen so the mismatch got passed along.stateandblockEntityDatato be matched.public ModelData.Builder gatherModelData(ModelData.Builder builder, BlockAndTintGetter world, BlockPos pos, BlockState state, ModelData blockEntityData)blockEntityDatato get the materials, using a key->blockstate pair, ifblockEntityDatadoes not matchstate, it will have a key mismatch error.A defensive fix can be applied on copycat+ side, but I think this mismatch is related to how Create manage blocks on contraption, and should be handled on Create's side.
Game Log
https://mclo.gs/nGaA5Sp
Debug Information
Client Info
Server Info