aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0426-Inventory-getHolder-method-without-block-snapshot.patch
blob: 9ed9fe0826aad70e142c0d687c2b62f7047b8134 (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 3796f8b122ad981b6faacd2afcaf3696314aad6b..b17dab9e5c06d8789553b104602d7da35d926dd1 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
@@ -532,6 +532,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 01d425d359f2d6d87b6c01b435a9cfcfe11caa20..4707a651dc80086efa852bcfba38a534e7f1f3d0 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 this.getLeftSide().getLocation().add(this.getRightSide().getLocation()).multiply(0.5);