Tool breaking when used by machine doesn't crash and Bewitchment correctly ignores tool break events raised in non-player-held conditions.
Actual Behavior
It crashes the server.
Steps to Reproduce
Put a tool that raises PlayerDestroyItemEvent inside a tileentity capable of using tools, make it use the tool until the durability runs out, observe crash.
In specific circumstances used, it was Actually Additions knife inside Extra Utilities 2 Mechanical Crafter (first log)/RFTools Crafter (second log), used to make french fries.
Most likely cause is that the code is assuming that EntityPlayer exists, while for TEs it or EntityPlayer.world is null. https://github.com/Um-Mitternacht/Bewitchment/blob/1.12.2/src/main/java/com/bewitchment/common/handler/PoppetHandler.java#L170
Version of Minecraft, Bewitchment, Forge, Patchouli, and Baubles used
1.12.2
bewitchment-1.12.2-0.0.22.49.jar/bewitchment-1.12.2-0.0.22.58.jar
Forge 14.23.5.2854
Patchouli-1.0-22.jar
Baubles-1.12-1.5.2.jar
While the first log has modified mixins version in Bewitchment (a mod that is needed for the pack and cannot be updated is incompatible with 0.8), the issue happens without that modification as well, as indicated by the second log.
Expected Behavior
Tool breaking when used by machine doesn't crash and Bewitchment correctly ignores tool break events raised in non-player-held conditions.
Actual Behavior
It crashes the server.
Steps to Reproduce
Put a tool that raises PlayerDestroyItemEvent inside a tileentity capable of using tools, make it use the tool until the durability runs out, observe crash.
In specific circumstances used, it was Actually Additions knife inside Extra Utilities 2 Mechanical Crafter (first log)/RFTools Crafter (second log), used to make french fries.
Most likely cause is that the code is assuming that EntityPlayer exists, while for TEs it or EntityPlayer.world is null.
https://github.com/Um-Mitternacht/Bewitchment/blob/1.12.2/src/main/java/com/bewitchment/common/handler/PoppetHandler.java#L170
Version of Minecraft, Bewitchment, Forge, Patchouli, and Baubles used
1.12.2
bewitchment-1.12.2-0.0.22.49.jar/bewitchment-1.12.2-0.0.22.58.jar
Forge 14.23.5.2854
Patchouli-1.0-22.jar
Baubles-1.12-1.5.2.jar
While the first log has modified mixins version in Bewitchment (a mod that is needed for the pack and cannot be updated is incompatible with 0.8), the issue happens without that modification as well, as indicated by the second log.
Logs, in the event of a crash
https://pastebin.com/74NsqrYF https://paste.ee/p/fy0ST