CC: Tweaked

CC: Tweaked

42M Downloads

Crash when using turtle.place on an entity with a container

Vexatos opened this issue ยท 0 comments

commented

Minecraft version: 1.12.2
CC-T Version: 1.85.2

It turns out that calling EntityPlayerMP.sendAllContents on the EntityPlayerMP belonging to a turtle reproducibly crashes with an NPE. This is for example called during Container.addListener on the server side. As far as I can tell, that means that either EntityPlayerMP.connection or EntityPlayerMP.inventory must be null at that time.

We can reproduce this easily with the Wearable Backpacks mod. If you wear a backpack, stand in front of a turtle, and call turtle.place() with a block in its inventory, this crash occurs:

[22:34:27] [Server thread/ERROR] [net.minecraft.server.MinecraftServer]: Encountered an unexpected exception
net.minecraft.util.ReportedException: Ticking block entity
	at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:773) ~[MinecraftServer.class:?]
	at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:397) ~[nz.class:?]
	at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668) ~[MinecraftServer.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) [MinecraftServer.class:?]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]
Caused by: java.lang.NullPointerException
	at net.minecraft.entity.player.EntityPlayerMP.func_71110_a(EntityPlayerMP.java:989) ~[oq.class:?]
	at net.minecraft.inventory.Container.func_75132_a(Container.java:52) ~[afr.class:?]
	at net.mcft.copy.backpacks.container.ContainerBackpack.open(ContainerBackpack.java:81) ~[ContainerBackpack.class:?]
	at net.mcft.copy.backpacks.item.ItemBackpack.onEquippedInteract(ItemBackpack.java:240) ~[ItemBackpack.class:?]
	at net.mcft.copy.backpacks.ProxyCommon.onEntityInteract(ProxyCommon.java:225) ~[ProxyCommon.class:?]
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_283_ProxyCommon_onEntityInteract_EntityInteract.invoke(.dynamic) ~[?:?]
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?]
	at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) ~[EventBus.class:?]
	at net.minecraftforge.common.ForgeHooks.onInteractEntity(ForgeHooks.java:1116) ~[ForgeHooks.class:?]
	at dan200.computercraft.shared.turtle.core.TurtlePlaceCommand.deployOnEntity(TurtlePlaceCommand.java:248) ~[TurtlePlaceCommand.class:?]
	at dan200.computercraft.shared.turtle.core.TurtlePlaceCommand.deploy(TurtlePlaceCommand.java:122) ~[TurtlePlaceCommand.class:?]
	at dan200.computercraft.shared.turtle.core.TurtlePlaceCommand.execute(TurtlePlaceCommand.java:82) ~[TurtlePlaceCommand.class:?]
	at dan200.computercraft.shared.turtle.core.TurtleBrain.updateCommands(TurtleBrain.java:889) ~[TurtleBrain.class:?]
	at dan200.computercraft.shared.turtle.core.TurtleBrain.update(TurtleBrain.java:123) ~[TurtleBrain.class:?]
	at dan200.computercraft.shared.turtle.blocks.TileTurtle.func_73660_a(TileTurtle.java:218) ~[TileTurtle.class:?]
	at net.minecraft.world.World.func_72939_s(World.java:1838) ~[amu.class:?]
	at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:613) ~[oo.class:?]
	at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:767) ~[MinecraftServer.class:?]
	... 4 more