13
0
geforkt von Mirrors/Paper

Fix missing item interaction cancelling case (#9427)

Properly cancels brushes now
Dieser Commit ist enthalten in:
Owen 2023-07-13 15:48:46 -04:00 committet von GitHub
Ursprung 1f8ca77bb6
Commit 92bc19b049
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -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