mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 12:11:47 +01:00
57dd397155
Upstream has released updates that appears 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: b999860d SPIGOT-2304: Add LootGenerateEvent CraftBukkit Changes:77fd87e4
SPIGOT-2304: Implement LootGenerateEventa1a705ee
SPIGOT-5566: Doused campfires & fires should call EntityChangeBlockEvent41712edd
SPIGOT-5707: PersistentDataHolder not Persistent on API dropped Item
38 lines
1.8 KiB
Diff
38 lines
1.8 KiB
Diff
From b4de1c05b39bde78c5894d95c61392e084fcfb01 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 24594aa0e9..aada8d3b08 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -1891,6 +1891,7 @@ public abstract class EntityLiving extends Entity {
|
|
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
|
|
index f00653dfe7..71d045ee00 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
@@ -1430,6 +1430,10 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
|
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
|
|
--
|
|
2.26.2
|
|
|