summaryrefslogtreecommitdiffstats
path: root/nms-patches/ContainerBrewingStand.patch
blob: 3de4d47e7dbb8a252562e06cbe37d8743eccde10 (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
43
44
45
46
47
48
49
50
51
52
--- a/net/minecraft/server/ContainerBrewingStand.java
+++ b/net/minecraft/server/ContainerBrewingStand.java
@@ -1,12 +1,23 @@
 package net.minecraft.server;
 
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventoryBrewer;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
+
 public class ContainerBrewingStand extends Container {
 
     private IInventory brewingStand;
     private final Slot f;
     private int g;
 
+    // CraftBukkit start
+    private CraftInventoryView bukkitEntity = null;
+    private PlayerInventory player;
+    // CraftBukkit end
+
     public ContainerBrewingStand(PlayerInventory playerinventory, IInventory iinventory) {
+        player = playerinventory; // CraftBukkit
         this.brewingStand = iinventory;
         this.a((Slot) (new ContainerBrewingStand.SlotPotionBottle(playerinventory.player, iinventory, 0, 56, 46)));
         this.a((Slot) (new ContainerBrewingStand.SlotPotionBottle(playerinventory.player, iinventory, 1, 79, 53)));
@@ -47,6 +58,7 @@
     }
 
     public boolean a(EntityHuman entityhuman) {
+        if (!this.checkReachable) return true; // CraftBukkit
         return this.brewingStand.a(entityhuman);
     }
 
@@ -146,4 +158,17 @@
             return itemstack != null && (itemstack.getItem() == Items.POTION || itemstack.getItem() == Items.GLASS_BOTTLE);
         }
     }
+
+    // CraftBukkit start
+    @Override
+    public CraftInventoryView getBukkitView() {
+        if (bukkitEntity != null) {
+            return bukkitEntity;
+        }
+
+        CraftInventoryBrewer inventory = new CraftInventoryBrewer(this.brewingStand);
+        bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
+        return bukkitEntity;
+    }
+    // CraftBukkit end
 }