2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2019-12-08 02:03:10 +01: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-11-03 03:22:15 +01:00
|
|
|
index 072fa0ba13bbad5a045cb7fd296fcca160718c8c..65187e7ce1e0ba32cc4a7547e570588cad0d22b8 100644
|
2019-12-08 02:03:10 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
2020-09-02 11:12:25 +02:00
|
|
|
@@ -2049,6 +2049,7 @@ public abstract class EntityLiving extends Entity {
|
2020-06-26 01:38:24 +02:00
|
|
|
return predicate.test(this.getItemInMainHand().getItem()) || predicate.test(this.getItemInOffHand().getItem());
|
2019-12-08 02:03:10 +01:00
|
|
|
}
|
|
|
|
|
2020-06-26 01:38:24 +02:00
|
|
|
+ public final ItemStack getItemInHand(EnumHand enumhand) { return this.b(enumhand); } // Paper - OBFHELPER
|
2019-12-08 02:03:10 +01: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-11-03 03:22:15 +01:00
|
|
|
index 6cc86e36d6a5795b90e40c90526c8c93844a0942..1d0345f904de6061e5cfee3ab7c2dbfd94e3fa9e 100644
|
2019-12-08 02:03:10 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
2020-11-03 03:22:15 +01:00
|
|
|
@@ -1547,6 +1547,10 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
2019-12-08 02:03:10 +01:00
|
|
|
this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524
|
2020-06-26 01:38:24 +02:00
|
|
|
return;
|
2019-12-08 02:03:10 +01:00
|
|
|
}
|
2020-06-26 01:38:24 +02: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()) {
|