2020-05-06 09:48:49 +00:00
|
|
|
From 0000000000000000000000000000000000000000 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
|
2020-12-22 22:45:10 +00:00
|
|
|
index dbd212fc2f0c95ab1dcc4b6be86f0f87ac726fa7..37e3efa1fed858f735166a5c0cb97f886b2bbb4e 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
|
2020-12-21 07:56:22 +00:00
|
|
|
@@ -2055,6 +2055,7 @@ public abstract class EntityLiving extends Entity {
|
2020-06-25 23:38:24 +00:00
|
|
|
return predicate.test(this.getItemInMainHand().getItem()) || predicate.test(this.getItemInOffHand().getItem());
|
2019-12-08 01:03:10 +00:00
|
|
|
}
|
|
|
|
|
2020-06-25 23:38:24 +00:00
|
|
|
+ public final ItemStack getItemInHand(EnumHand enumhand) { return this.b(enumhand); } // Paper - OBFHELPER
|
2019-12-08 01:03:10 +00:00
|
|
|
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
|
2020-12-22 22:45:10 +00:00
|
|
|
index 4dd57152cb0d09b2df08be68ab111623724d52fc..a6b83cb349386ff1fb6f3267f0d610bf31df3f16 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
|
2020-12-22 22:45:10 +00:00
|
|
|
@@ -1557,6 +1557,10 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
2019-12-08 01:03:10 +00:00
|
|
|
this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524
|
2020-06-25 23:38:24 +00:00
|
|
|
return;
|
2019-12-08 01:03:10 +00:00
|
|
|
}
|
2020-06-25 23:38:24 +00:00
|
|
|
+ // Paper start
|
|
|
|
+ itemstack = this.player.getItemInHand(enumhand);
|
|
|
|
+ if (itemstack.isEmpty()) return;
|
|
|
|
+ // Paper end
|
|
|
|
EnumInteractionResult enuminteractionresult = this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand);
|
|
|
|
|
|
|
|
if (enuminteractionresult.b()) {
|