CC: Tweaked

CC: Tweaked

65M Downloads

IllegalStateException whenever a connected network cable is pasted

sadan4 opened this issue · 1 comments

commented

Minecraft Version

1.21.x

Version

598fc4a

Details

I'm sorry I am not that familiar with the mod, I encountered this bug and got interested.

Whenever a connected network cable is pasted with a building gadget, an illegal state exception is thrown.

Video

2025-04-29_21-08-51.mp4

latest.log

crash-2025-04-29_21.09.59-server.txt

commented

Thanks for the report!

The problem here appears to be that building gadgets creates new temporary block entities for a fake world, but associates them with the real world1. When updateShape is called, we schedule an update for next tick, which then crashes as the BE isn't where it thinks it should be!

This feels like a bug in BuildingGadgets, and I think probably worth reporting there. Though that said, I'm not sure what the right fix is — maybe you can get away with returning null from getBlockEntity, or maybe one has to implement roll your own Level which pretends to be a client-side level.

On CC:T's side, we should avoid going through our custom tick scheduling code here, which would fix the issue. Though because of the mismatched levels, I am a little wary that there won't be other bugs lurking here.

Footnotes

  1. So you end up in a really weird state where level.getBlockEntity(pos).getLevel() != level. And similarly, getLevel().getBlockEntity(getBlockPos()) != this for the block entity.