mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-02 09:21:57 +01:00
Fix missing item interaction cancelling case (#9427)
Properly cancels brushes now
This commit is contained in:
parent
1f8ca77bb6
commit
92bc19b049
1 changed files with 24 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue