summaryrefslogtreecommitdiffstats
path: root/nms-patches/ContainerBeacon.patch
blob: 348689e2c96bb6dcca6c6a2d168c23aa6442e69b (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
--- ../work/decompile-8eb82bde//net/minecraft/server/ContainerBeacon.java	2014-11-28 17:43:42.997707437 +0000
+++ src/main/java/net/minecraft/server/ContainerBeacon.java	2014-11-28 17:38:18.000000000 +0000
@@ -1,11 +1,18 @@
 package net.minecraft.server;
 
+import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
+
 public class ContainerBeacon extends Container {
 
     private IInventory a;
     private final SlotBeacon f;
+    // CraftBukkit start
+    private CraftInventoryView bukkitEntity = null;
+    private PlayerInventory player;
+    // CraftBukkit end
 
     public ContainerBeacon(IInventory iinventory, IInventory iinventory1) {
+        player = (PlayerInventory) iinventory; // CraftBukkit - TODO: check this
         this.a = iinventory1;
         this.a((Slot) (this.f = new SlotBeacon(this, iinventory1, 0, 136, 110)));
         byte b0 = 36;
@@ -35,6 +42,7 @@
     }
 
     public boolean a(EntityHuman entityhuman) {
+        if (!this.checkReachable) return true; // CraftBukkit
         return this.a.a(entityhuman);
     }
 
@@ -83,4 +91,17 @@
 
         return itemstack;
     }
+    
+    // CraftBukkit start
+    @Override
+    public CraftInventoryView getBukkitView() {
+        if (bukkitEntity != null) {
+            return bukkitEntity;
+        }
+
+        org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryBeacon((TileEntityBeacon) this.a); // TODO - check this
+        bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
+        return bukkitEntity;
+    }
+    // CraftBukkit end
 }