mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-23 04:58:28 +01:00
Fix HumanEntity#drop not updating the client inv
== AT == public net.minecraft.server.level.ServerPlayer containerSynchronizer
This commit is contained in:
parent
ab040d534d
commit
006e8346e9
1 changed files with 9 additions and 2 deletions
|
@ -782,8 +782,15 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||||
// Paper end
|
// Paper end
|
||||||
@Override
|
@Override
|
||||||
public boolean dropItem(boolean dropAll) {
|
public boolean dropItem(boolean dropAll) {
|
||||||
if (!(this.getHandle() instanceof ServerPlayer)) return false;
|
// Paper start - Fix HumanEntity#drop not updating the client inv
|
||||||
return ((ServerPlayer) this.getHandle()).drop(dropAll);
|
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;
|
||||||
|
// Paper end - Fix HumanEntity#drop not updating the client inv
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue