AbdElAziz333 / Canary

A performance mod designed to optimize Minecraft's general performance and unofficial fork of Lithium mod for Minecraft Forge.
https://www.curseforge.com/minecraft/mc-mods/canary
GNU Lesser General Public License v3.0
41 stars 3 forks source link

The Blumble zone pollen brushing crash #182

Closed Ladocterus closed 6 months ago

Ladocterus commented 9 months ago

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:

  1. Using a Brush
  2. Brush Suspicious pollen
  3. 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

TelepathicGrunt commented 9 months ago

This line seems to be the cause. https://github.com/AbdElAziz333/Canary/blob/cbbea5d702261ddd2d3b57a8034ab80232455df8/src/main/java/com/abdelaziz/canary/mixin/shapes/lazy_shape_context/EntityCollisionContextMixin.java#L70

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

https://github.com/TelepathicGrunt/Bumblezone/issues/299

AbdElAziz333 commented 6 months ago

should be fixed in the new updates.