Skip to content

Commit

Permalink
Fix inventory desync when placing blocks with spawn protection (Paper…
Browse files Browse the repository at this point in the history
…MC#11090)

* fix

* mention mojira issue

* move to vanilla bug fixes patch

---------

Co-authored-by: Jake Potrebic <[email protected]>
  • Loading branch information
notTamion and Machine-Maker authored Aug 31, 2024
1 parent 2f0891e commit 227c94a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions patches/server/0748-Fix-a-bunch-of-vanilla-bugs.patch
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ https://bugs.mojang.com/browse/MC-200092
https://bugs.mojang.com/browse/MC-158900
Fix error when joining after tempban expired

https://bugs.mojang.com/browse/MC-99075
Fix inventory desync within spawn protected area

== AT ==
public net/minecraft/world/entity/Mob leashInfoTag

Expand Down Expand Up @@ -123,6 +126,19 @@ index 6abecaac8407b992d208a9108e11fd4954a4106f..03d89f326d320c5d778c3d1e2db7d6b8
this.player.onUpdateAbilities();
this.player.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE, this.player), this.player); // CraftBukkit
this.level.updateSleepingPlayerList();
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index ca32e5aa6e77ca1bab886e7b6a778ec931ac4e4c..28808ffc6e486f7dc01be370c9eb249dc1f7ea46 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1814,7 +1814,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
} else if (enuminteractionresult.shouldSwing() && !this.player.gameMode.interactResult) { // Paper - Call interact event
this.player.swing(enumhand, true);
}
- }
+ } else { this.player.containerMenu.sendAllDataToRemote(); } // Paper - Fix inventory desync; MC-99075
} else {
MutableComponent ichatmutablecomponent1 = Component.translatable("build.tooHigh", i - 1).withStyle(ChatFormatting.RED);

diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index be842c81ae6c6ec64a233f126d7221a37d66439c..b54e8da2209d99696e12c65a23323a68b7da272b 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
Expand Down
2 changes: 1 addition & 1 deletion patches/server/0877-Fix-slot-desync.patch
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ index 7270b6fa96bae937663c0fea77887e21fbd0eb57..530728cd4b258444f6efe064903b521f
this.containerMenu.findSlot(this.getInventory(), this.getInventory().selected).ifPresent(s -> {
this.containerSynchronizer.sendSlotChange(this.containerMenu, s, this.getMainHandItem());
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index adf9357363465fd7a8c9e0d51b80b9f61d531a01..5541de6364b9982ae95e0a952167ae09084f65cf 100644
index be0ce72bb493593a3d2eb7d7c37e3a650b7cc34b..0ffa95542a0ed49a3f83700841f7c76c0717ae22 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2729,10 +2729,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
Expand Down

0 comments on commit 227c94a

Please sign in to comment.