1.16 fixes

This commit is contained in:
gnembon committed 2020-04-22 01:49:36 -03:00
1 parent c0d8f1e5a1
commit 1e04eafdc2
1 file changed
+2 -2
@@ -537,12 +537,12 @@ public class EntityValue extends Value
if (health <= 0f && e instanceof ServerPlayerEntity) if (health <= 0f && e instanceof ServerPlayerEntity)
{ {
ServerPlayerEntity player = (ServerPlayerEntity) e; ServerPlayerEntity player = (ServerPlayerEntity) e;
if (player.container != null) if (player.currentScreenHandler != null)
{ {
// if player dies with open container, then that causes NPE on the client side // if player dies with open container, then that causes NPE on the client side
// its a client side bug that may never surface unless vanilla gets into scripting at some point // its a client side bug that may never surface unless vanilla gets into scripting at some point
// bug: #228 // bug: #228
player.closeContainer(); player.closeHandledScreen();
} }
((LivingEntity) e).setHealth(health); ((LivingEntity) e).setHealth(health);
} }