-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fundamental Logic Issue with Placement #76
Comments
Do you have any examples for blocks causing crashes? |
All ducts from thermal dynamics cause an exception when placed with the construction wand. Edit: |
Okay, I will remove these function calls. Seems like they are not necessary. |
@KingLemming I removed the line you mentioned. However Minecraft still shows an exception and creates ghost blocks when trying to place multiple ThermalDynamics ducts using a wand. Here is the exception. Do you know what is causing this?
|
For my mod, this issue was resolved by stop using the @onlyin(Dist.CLIENT) annotation Once swapped to distExecutor the issue with thermal ducts didn't happen anymore. |
Hey there! So I've received some reports that various blocks crash after being placed with your wand, so I did some investigating and found the culprit.
It's right here: https://github.com/Theta-Dev/ConstructionWand/blob/1.19/src/main/java/thetadev/constructionwand/wand/undo/PlaceSnapshot.java#L113
You're calling a function on a BlockState before the block exists in world. I understand why you feel you can do this, but you absolutely cannot. Even vanilla blocks which are waterloggable will generate world ticks in that function - the method does not return a simple blockstate and can have impacts on the world itself. The fact that the world must be passed in means that it's entirely valid for blocks to use the world to determine the state. That includes tile entities. But when you call this without the block being in world, the tile entity logic breaks completely. Don't do this.
Instead, create a BlockPlaceContext and use the getStateForPlacement method (which you already do). Then PLACE the block, and call updateShape if you feel you absolutely need to.
The text was updated successfully, but these errors were encountered: