2023-03-04 23:57:02 +01:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
|
|
Date: Sun, 10 Oct 2021 18:18:01 -0700
|
|
|
|
Subject: [PATCH] Fix HumanEntity#drop not updating the client inv
|
|
|
|
|
|
|
|
== AT ==
|
|
|
|
public net.minecraft.server.level.ServerPlayer containerSynchronizer
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
2024-04-06 21:53:39 +02:00
|
|
|
index 103d5e14972516968030df255cde49c82b93c38f..6a52789d6e68438c1eaa2fb9af591fa9e1d381e2 100644
|
2023-03-04 23:57:02 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
2024-04-06 21:53:39 +02:00
|
|
|
@@ -752,8 +752,15 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
2023-03-04 23:57:02 +01:00
|
|
|
// Paper end
|
|
|
|
@Override
|
|
|
|
public boolean dropItem(boolean dropAll) {
|
|
|
|
- if (!(this.getHandle() instanceof ServerPlayer)) return false;
|
|
|
|
- return ((ServerPlayer) this.getHandle()).drop(dropAll);
|
2024-01-15 12:38:39 +01:00
|
|
|
+ // Paper start - Fix HumanEntity#drop not updating the client inv
|
2023-03-04 23:57:02 +01:00
|
|
|
+ if (!(this.getHandle() instanceof ServerPlayer player)) return false;
|
|
|
|
+ boolean success = player.drop(dropAll);
|
|
|
|
+ if (!success) return false;
|
|
|
|
+ final net.minecraft.world.entity.player.Inventory inv = player.getInventory();
|
|
|
|
+ final java.util.OptionalInt optionalSlot = player.containerMenu.findSlot(inv, inv.selected);
|
|
|
|
+ optionalSlot.ifPresent(slot -> player.containerSynchronizer.sendSlotChange(player.containerMenu, slot, inv.getSelected()));
|
|
|
|
+ return true;
|
2024-01-15 12:38:39 +01:00
|
|
|
+ // Paper end - Fix HumanEntity#drop not updating the client inv
|
2023-03-04 23:57:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|