From 0000000000000000000000000000000000000000 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 diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java index f3ea4401a445eb5c327c886415da2c98f734df5a..481eefba58779a051bc20a13488e5d8ece497c75 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -533,6 +533,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/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryDoubleChest.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryDoubleChest.java index d5defc82aec2279463e14029e213cfb8c3a40ce1..83712cc8da9751b6d4cc1f34a1cc0798bf848ae1 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryDoubleChest.java +++ b/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);