mojira.dev
MC-188451

Game crashes when dispensing a shulker box from a dispenser - "java.lang.NullPointerException: Exception while ticking"

(1.16 Pre-Release 3) [^crash-2020-06-10_18.21.22-server.txt]

Description: Exception while ticking

java.lang.NullPointerException: Exception while ticking
	at bil.a(SourceFile:88)
	at gy.a(SourceFile:23)
	at gu.dispense(SourceFile:15)
	at bxc.a(SourceFile:89)
	at bxc.a(SourceFile:112)
	at cfi$a.a(SourceFile:865)
	at zd.b(SourceFile:596)
	at zd$$Lambda$3895/290764432.accept(Unknown Source)
	at bqn.b(SourceFile:84)
	at zd.a(SourceFile:351)
	at net.minecraft.server.MinecraftServer.b(SourceFile:873)
	at net.minecraft.server.MinecraftServer.a(SourceFile:813)
	at eox.a(SourceFile:93)
	at net.minecraft.server.MinecraftServer.v(SourceFile:672)
	at net.minecraft.server.MinecraftServer.a(SourceFile:256)
	at net.minecraft.server.MinecraftServer$$Lambda$3883/2115162896.run(Unknown Source)
	at java.lang.Thread.run(Thread.java:745)

Linked issues

Attachments

Comments 12

Please provide more information about what exactly you were doing at the time of the crash - also, check if it still crashes without some of the data packs.

Just walking. I'll check without datapack.

Still happening without datapacks

 

And when exactly does this crash occur?

First time IT happend after piglin went throw portal to overworld. And then crash after crash. Maybe because there id a lot of redstone in the area

2 more comments

For me when I got back into the world after crashing the shulker was duplicated - it was placed and at the same time an identical shulker was still in the dispenser.

Before I write the rest of this comment, all mappings in here will be Yarn mappings.

I looked into the cause of this crash, and it seems to be that the dispenser is calling BlockItem#place to place the shulker box. In that call, there is a check for whether the player is in creative mode, to see whether the items in the player's inventory should be decremented. Of course, the dispenser is not a player and passes in a "fake" or null player to this method. This causes a NullPointerError. This can be solved simply with a check for whether the player instance is null within that "if" statement.

EDIT: Disregard that fix. After some testing, I realized this just turns the dispensers into item duplicators. Instead, either revert the code to what it was before or apply the above fix and add a extra check to see if the item is being placed by a dispenser.

There's a fabric mod by AMereBagatelle which fixes this if anyone's interested. [[1]|https://cdn.discordapp.com/attachments/507982666755473427/720439410856034344/emptytagfix-1.0.0.jar]

If you're in the Fabric Project Discord server, the source is here.

EDIT: Just update to pre4 lol

What is the name of the fabric mod? I click on the link but it doesn't work

I've made the link point directly to the file. I don't think it's listed anywhere, apart from a discord post.

edeksumo

boq

Confirmed

Very Important

Crash

1.16 Pre-release 3

1.16 Pre-release 4

Retrieved