From 1b1ab34ecd281c5f4df7b5a5bb165a3458fb5378 Mon Sep 17 00:00:00 2001 From: Phoenix616 Date: Wed, 10 Jun 2020 23:55:15 +0100 Subject: [PATCH] Inventory getHolder method without block snapshot --- .../org/bukkit/craftbukkit/inventory/CraftInventory.java | 7 +++++++ .../craftbukkit/inventory/CraftInventoryDoubleChest.java | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java index 628e0cffa6..f3a1859a1c 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -531,6 +531,13 @@ public class CraftInventory implements Inventory { return this.inventory.getOwner(); } + // Paper start - getHolder without snapshot + @Override + public InventoryHolder getHolder(boolean useSnapshot) { + return inventory instanceof net.minecraft.world.level.block.entity.BlockEntity ? ((net.minecraft.world.level.block.entity.BlockEntity) inventory).getOwner(useSnapshot) : getHolder(); + } + // Paper end + @Override public int getMaxStackSize() { return this.inventory.getMaxStackSize(); diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryDoubleChest.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryDoubleChest.java index c00c787a73..c3e2c9e2c3 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryDoubleChest.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryDoubleChest.java @@ -63,6 +63,13 @@ public class CraftInventoryDoubleChest extends CraftInventory implements DoubleC return new DoubleChest(this); } + // Paper start - getHolder without snapshot + @Override + public DoubleChest getHolder(boolean useSnapshot) { + return getHolder(); + } + // Paper end + @Override public Location getLocation() { return this.getLeftSide().getLocation().add(this.getRightSide().getLocation()).multiply(0.5);