Creators-of-Create/Create

Exploded piston calling Block#playerWillDestroy crashes game when installed with Vanilla Degus

rbasamoyai opened this issue · 1 comments

Describe the Bug

While looking at a bug on 1.20.1 between Create Big Cannons and this mod https://www.curseforge.com/minecraft/mc-mods/vanilla-degus, I have noticed that when Vanilla Degus is installed with Create it crashes if the piston is blown up to disassemble (a rare case, but analogous to Create Big Cannons' disassembly on cannon failure, that is, an explosion.) I specifically point to the Mechanical Piston as some of the Cannon Mount's disassembly code is modeled after the Mechanical Piston.

This appears to be due to the Mechanical Piston block entity code calling Block#playerWillDestroy with a null player argument (the Cannon Mount also follows this), but mixins seem to assume that Block#playerWillDestroy is not null. Vanilla Degus has a mixin into this method which assumes the player is not null.

This could be fixed by passing a FakePlayer similar to the DeployerFakePlayer, but I am not sure how resource intensive that would be. More feasibly, the code for handling piston destruction could just be duplicated or moved into another method that the dissassemble method uses.

Reproduction Steps

  1. Run Minecraft Forge 1.20.1 with Create and Vanilla Degus installed.
  2. Assemble a Mechanical Piston.
  3. Blow up the piston, such as by using TNT, while the contraption is assembled and running.

Expected Result

The explosion should have blown up the piston with no issue instead of crashing the game.

Screenshots and Videos

image
Exploding piston setup. Degu not necessary, just there to demonstrate the mod which this game crashes with.

Crash Report or Log

https://pastebin.com/29vCy5HK

Operating System

Windows 10

Mod Version

0.5.1f

Minecraft Version

1.20.1

Forge Version

47.2.32

Other Mods

Vanilla Degus, Create Big Cannons (similar bug, will fix on my end)

Additional Context

N/A

I seem to have pasted part of the Vanilla Degus mod creator name as the issue title. I have edited it to be more clear on what the issue is.