Skip to content

Train Contraption Particle Lookup Mismatched for Copycat Like Blocks #10119

@stop-x13

Description

@stop-x13

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:

  1. Assemble a train with a vertically placed Copycats+ copycat_byte_panel
  2. Place a copycat_slab in the world at the same position where the copycat_byte_panel is vertically
  3. Run over that copycat_byte_panel or generate sprint/fall particles on it
  4. 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:

  1. 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.
  2. 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)
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: confirmedIssue's details are known, it is consistently reproducible, and it needs a fixtype: bugIssue where something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions