2019-12-16 02:58:10 +00:00
|
|
|
From 790ec25581fb4df8c802a36f12fa3348381248e0 Mon Sep 17 00:00:00 2001
|
2019-12-08 01:03:10 +00:00
|
|
|
From: Lukasz Derlatka <toranktto@gmail.com>
|
|
|
|
Date: Mon, 11 Nov 2019 16:08:13 +0100
|
|
|
|
Subject: [PATCH] Fix AssertionError when player hand set to empty type
|
|
|
|
|
|
|
|
Fixes an AssertionError when setting the player's item in hand to null or a new ItemStack of Air in PlayerInteractEvent
|
|
|
|
Fixes GH-2718
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
2019-12-16 02:47:23 +00:00
|
|
|
index e3c562a63b..80219f2df1 100644
|
2019-12-08 01:03:10 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
2019-12-13 15:21:58 +00:00
|
|
|
@@ -1886,6 +1886,7 @@ public abstract class EntityLiving extends Entity {
|
2019-12-08 01:03:10 +00:00
|
|
|
return this.getEquipment(EnumItemSlot.OFFHAND);
|
|
|
|
}
|
|
|
|
|
|
|
|
+ public ItemStack getItemInHand(EnumHand enumhand) { return this.b(enumhand); } // Paper - OBFHELPER
|
|
|
|
public ItemStack b(EnumHand enumhand) {
|
|
|
|
if (enumhand == EnumHand.MAIN_HAND) {
|
|
|
|
return this.getEquipment(EnumItemSlot.MAINHAND);
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
2019-12-16 02:47:23 +00:00
|
|
|
index f6fbba36f4..a1ce2d2e07 100644
|
2019-12-08 01:03:10 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
2019-12-12 16:20:43 +00:00
|
|
|
@@ -1429,6 +1429,10 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
2019-12-08 01:03:10 +00:00
|
|
|
if (cancelled) {
|
|
|
|
this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524
|
|
|
|
} else {
|
|
|
|
+ // Paper start
|
|
|
|
+ itemstack = this.player.getItemInHand(enumhand);
|
|
|
|
+ if (itemstack.isEmpty()) return;
|
|
|
|
+ // Paper end
|
|
|
|
this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand);
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
--
|
2019-12-12 16:20:43 +00:00
|
|
|
2.24.1
|
2019-12-08 01:03:10 +00:00
|
|
|
|