diff options
author | Owen <[email protected]> | 2023-07-13 15:48:46 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2023-07-13 15:48:46 -0400 |
commit | 92bc19b04906c187cf297ce1742c06751867ace8 (patch) | |
tree | e3693bd1cfc2ff6097784fa863afdd6c7de5646b | |
parent | 1f8ca77bb62c400a5ee8b845caa8b73960d8eb8c (diff) | |
download | Paper-92bc19b04906c187cf297ce1742c06751867ace8.tar.gz Paper-92bc19b04906c187cf297ce1742c06751867ace8.zip |
Fix missing item interaction cancelling case (#9427)
Properly cancels brushes now
-rw-r--r-- | patches/server/0974-Properly-Cancel-Usable-Items.patch | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/patches/server/0974-Properly-Cancel-Usable-Items.patch b/patches/server/0974-Properly-Cancel-Usable-Items.patch index 45da59d385..a51b429994 100644 --- a/patches/server/0974-Properly-Cancel-Usable-Items.patch +++ b/patches/server/0974-Properly-Cancel-Usable-Items.patch @@ -9,6 +9,30 @@ For example, items being consumed but never finishing, shields being put up, etc The underlying issue of this is that the client modifies their synced data values, and so we have to (forcibly) resend them in order for the client to reset their using item state. +diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +index 1635fee928d64f4d2c336dca6675ed4641918830..afcee1e5bf1f735f3c893ec0b835dc5cd9759b7b 100644 +--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java ++++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +@@ -562,6 +562,7 @@ public class ServerPlayerGameMode { + } + // Paper end - extend Player Interact cancellation + player.getBukkitEntity().updateInventory(); // SPIGOT-2867 ++ this.player.resyncUsingItem(this.player); // Paper - Resend player's using item status + enuminteractionresult = (event.useItemInHand() != Event.Result.ALLOW) ? InteractionResult.SUCCESS : InteractionResult.PASS; + } else if (this.gameModeForPlayer == GameType.SPECTATOR) { + MenuProvider itileinventory = iblockdata.getMenuProvider(world, blockposition); +@@ -605,6 +606,11 @@ public class ServerPlayerGameMode { + + return enuminteractionresult1; + } ++ // Paper start - Cancel only if cancelled + if the interact result is different from default response ++ else if (this.interactResult && this.interactResult != cancelledItem) { ++ this.player.resyncUsingItem(this.player); ++ } ++ // Paper end + } + return enuminteractionresult; + // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java index 1d0e439c00ac4ab72dc656038c9271b1240acc88..b777547cb9f8edf4e7b3c2cfb894f8cd1b1a35a5 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java |