Paper/patches/server/0216-Refresh-player-inventory-when-cancelling-PlayerInter.patch
Nassim Jahnke d385af0e01
Updated Upstream (Bukkit/CraftBukkit)
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:
0a4b84d6 SPIGOT-7003: Add missing PlayerAnimationType
830db7d5 SPIGOT-5984: Add non deprecated / magic value way to set pixel in MapCanvas
20caf8ff PR-754: Add DamageCause.SONIC_BOOM

CraftBukkit Changes:
576a03704 SPIGOT-7003: Add missing PlayerAnimationType
0dcc5fdd0 SPIGOT-5984: Add non deprecated / magic value way to set pixel in MapCanvas
d75aacb43 Update Netty version
3b34c6bea SPIGOT-7044: Modified RandomSourceWrapper to ensure random is not null before setting seed
4b60bfd18 PR-1059: Add DamageCause.SONIC_BOOM
2022-06-09 13:55:33 +02:00

30 lines
1.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Fri, 13 Jul 2018 14:54:43 +0200
Subject: [PATCH] Refresh player inventory when cancelling
PlayerInteractEntityEvent
When interacting with entities with an item, the client will assume
the interaction is successful, and update the held item on the
client. However, if the interaction is cancelled on the server side,
the client will still mistakenly remove/replace the item in hand.
Examples for this are milking cows with a bucket or dyeing sheep.
The bucket is replaced with milk and the dye removed from inventory.
Refresh the player inventory when PlayerInteractEntityEvent is
cancelled to avoid this problem.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index c91e8300fe0cb673567f0b0e725a6d460dcebf31..4b99de786be5fbefb94a5484868b897ab0f86a27 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2426,6 +2426,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
if (event.isCancelled()) {
+ ServerGamePacketListenerImpl.this.player.containerMenu.sendAllDataToRemote(); // Paper - Refresh player inventory
return;
}
// CraftBukkit end