![Canary](https://media.forgecdn.net/avatars/thumbnails/596/701/256/256/637973011528270749.png)
The Blumble zone pollen brushing crash
Ladocterus opened this issue ยท 2 comments
canary-mc1.20.1-0.2.7
Expected Behavior
Brushing suspicious pollen in the mod "The bumble zone" like Minecraft Archaeology
https://modrinth.com/mod/the-bumblezone
Actual Behavior
Game crashes.
Reproduction Steps
Example:
- Using a Brush
- Brush Suspicious pollen
- Game crash
Other Information
Creator of The bumble zone added a Workaround to at least prevent crashes, but the pollen still doesn't brush.
According to creator the crash is caused by passing null as the heldItem into EntityCollisionContext.
crash-2023-11-08_16.25.11-server.txt
crash-2023-11-08_16.25.14-client.txt
This line seems to be the cause.
In general, NEVER use null for an itemstack. if you must, use Itemstack.EMPTY instead. However, I strongly am suspicious on the supposed performance benefit of setting these fields to null...
My use case was I needed the item directly from the context so I can check if it is in my brushing allowed tags or has brushing tool actions. So isHolding was not enough and I used an accessor to get that field. In vanilla, this field is never null. So this was a behavior change by Canary that forced me to add a null check when in vanilla, itemstack should never be null.
https://github.com/TelepathicGrunt/Bumblezone/blob/cf5e4c67ba5de7713458651f05d888cc884b4752/common/src/main/java/com/telepathicgrunt/the_bumblezone/blocks/PileOfPollenSuspicious.java#L126