Fix inventory desync with PlayerLeashEntityEvent (#10436)

This commit is contained in:
Tamion 2024-04-20 05:23:32 +02:00 committed by GitHub
parent 3b078f822a
commit 908b8141c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 2 deletions

View File

@ -4,6 +4,18 @@ Date: Wed, 23 Aug 2023 13:22:09 -0700
Subject: [PATCH] Fix inventory desync
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index d1833dcc92b1570e62a1941bbea6d66ff0b2ee5f..5da7ffee71bf6d82a53b3c2f99e2bd898d0b1799 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1336,6 +1336,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
// CraftBukkit start - fire PlayerLeashEntityEvent
if (CraftEventFactory.callPlayerLeashEntityEvent(this, player, player, hand).isCancelled()) {
((ServerPlayer) player).connection.send(new ClientboundSetEntityLinkPacket(this, this.getLeashHolder()));
+ player.containerMenu.sendAllDataToRemote(); // Paper - Fix inventory desync
return InteractionResult.PASS;
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
index e258e5915b286f1117bc1413dfd3d2a5c4655380..8d2c0accadaf0c5d28e7db6e62a05f6c619cf02f 100644
--- a/src/main/java/net/minecraft/world/item/BlockItem.java

View File

@ -16,10 +16,10 @@ sideeffects, meaning the disable event cannot share a handlerlist with
the cooldown event
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 4e8aee81cb9e9fe4a4e5df4e228c0314b3af486b..544e22f569d7ddeb1ba46a9ef7f4d4d6ca37c431 100644
index a59ee9d9b93404060e7a4702497071859daec6df..f7818fd5e59784554732c39ef5c56461ea0d62c4 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1698,7 +1698,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
@@ -1699,7 +1699,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
float f = 0.25F + (float) EnchantmentHelper.getBlockEfficiency(this) * 0.05F;
if (this.random.nextFloat() < f) {