Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
611a0ee52d
This reverts commit e38eceb42a
.
36 Zeilen
2.0 KiB
Diff
36 Zeilen
2.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
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
|
|
index 072fa0ba13bbad5a045cb7fd296fcca160718c8c..65187e7ce1e0ba32cc4a7547e570588cad0d22b8 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -2049,6 +2049,7 @@ public abstract class EntityLiving extends Entity {
|
|
return predicate.test(this.getItemInMainHand().getItem()) || predicate.test(this.getItemInOffHand().getItem());
|
|
}
|
|
|
|
+ public final 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
|
|
index 38cd2768374b44b82060b07924b17f35c466806c..9deee3cf802d43c806008b573219c69f1d62cc61 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
@@ -1549,6 +1549,10 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
|
this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524
|
|
return;
|
|
}
|
|
+ // 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()) {
|