Changed: MC Mod

Changed: MC Mod

156k Downloads

[Changed-m1.18.2-v0.13] Crash w\ BlockCarpentry

PianoManu opened this issue ยท 5 comments

commented

Hey, Dev of BlockCarpentry here. Someone reported a compatibility problem between Changed and BlockCarpentry, and I tried to find the issue, however the log does contain neither information about BlockCarpentry nor Changed. I guess, there is a mixin breaking something in BlockCarpentry, or vice versa. Here's the crash report and the log with some more information. Maybe you could fix the issue if it is caused by changed or point out the issue with BlockCarpentry, if this is the case.
crash-2024-02-08_21.09.52-client.txt
latest.log

To reproduce the issue, I installed only BlockCarpentry and Changed, and then the game crashes...
Thanks in advance,
PianoManu

commented

It appears to happen when a block returns a null VoxelShape from block.getCollisionShape(...)

commented

image
Strangely enough, I wrote a mixin that was supposed to catch null returns from that function

commented

Alright I found the issue, although I do not really understand how and why your mod triggeres it. Never ever has my stateToCollisionShapeMap contained null values. The commented out part crashes the game...
image

But it seems like something with the mixin is not right as well? At least for what I see, it should prevent such cases and not make them crash the game. Maybe you could rethink that again? For now, I'm closing this issue. Thanks for your help!

commented

Oh I know why, the Changed mod injects a block-state property into almost every block, and thus may invalidate your map. I'm not sure what you use to generate the collision shapes, but I'd recommend using StateDefinition.getPossibleStates() to generate entries for every block-state, rather than iterating each known property.

It could also be solved by having the map computeIfAbsent(state, s -> generateShape(s)) to generate the shapes if they don't exist already. Or you could leave it as getOrDefault(state, Shapes.block())

I can also blacklist the block manually, if you think this behavior shouldn't happen.

commented

Ok thanks, I'm probably going to use the StateDefinition method. I didn't know it existed. I've made this mod in 1.15 and casually updated it up to 1.19, but I never checked whether there are any new methods or stuff like that. In any case, thank you!
Regards Manu