aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0514-Inventory-getHolder-method-without-block-snapshot.patch
blob: 5ea9d7c297ae9cc574d92a2c634211bf98f75a84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Phoenix616 <mail@moep.tv>
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 a04213325b8266623b076f1233539512a0a0207f..726631348243566654d08abe9b5bf4ab3a2885f9 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
@@ -521,6 +521,13 @@ public class CraftInventory implements Inventory {
         return inventory.getOwner();
     }
 
+    // Paper start - getHolder without snapshot
+    @Override
+    public InventoryHolder getHolder(boolean useSnapshot) {
+        return inventory instanceof net.minecraft.server.TileEntity ? ((net.minecraft.server.TileEntity) inventory).getOwner(useSnapshot) : getHolder();
+    }
+    // Paper end
+
     @Override
     public int getMaxStackSize() {
         return 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 e917db0b01c2fef46a1ea873bee9aa25044de036..ad425d89bcae3045d0e35ecfb70a233895f88cc8 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryDoubleChest.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryDoubleChest.java
@@ -64,6 +64,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 getLeftSide().getLocation().add(getRightSide().getLocation()).multiply(0.5);