geforkt von Mirrors/Paper
abca14ff96
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 6f9fe1d9 #562: Add API to set equipment silently bcddb754 SPIGOT-6256: Add method to check if the entity is in water CraftBukkit Changes: 878b4375 #772: Add API to set equipment silently 22d7fcc9 SPIGOT-6256: Add method to check if the entity is in water
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 1685478f333a387d270ec4533319b9a62076a9ef..44793c443bd8c357832daa5c65cc2230ef031dc2 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -2055,6 +2055,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 ea6476aec59eec50323b0927b6261ebd077926be..ec14c63fb20737aa9aab22d596bb4045a9a9c867 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
@@ -1547,6 +1547,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()) {
|