summaryrefslogtreecommitdiffstats
path: root/nms-patches/ContainerHorse.patch
blob: 400f4436a85a8e58f157aaf1136a98a06e7a300b (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
--- ../work/decompile-8eb82bde//net/minecraft/server/ContainerHorse.java	2014-11-28 17:43:43.013707437 +0000
+++ src/main/java/net/minecraft/server/ContainerHorse.java	2014-11-28 17:38:17.000000000 +0000
@@ -1,11 +1,33 @@
 package net.minecraft.server;
 
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventory;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+import org.bukkit.inventory.InventoryView;
+// CraftBukkit end
+
 public class ContainerHorse extends Container {
 
     private IInventory a;
     private EntityHorse f;
+    
+    // CraftBukkit start
+    org.bukkit.craftbukkit.inventory.CraftInventoryView bukkitEntity;
+    PlayerInventory player;
+
+    @Override
+    public InventoryView getBukkitView() {
+        if (bukkitEntity != null) {
+            return bukkitEntity;
+        }
+
+        CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryHorse(this.a);
+        return bukkitEntity = new CraftInventoryView(player.player.getBukkitEntity(), inventory, this);
+    }
 
     public ContainerHorse(IInventory iinventory, IInventory iinventory1, EntityHorse entityhorse, EntityHuman entityhuman) {
+        player = (PlayerInventory) iinventory;
+        // CraftBukkit end
         this.a = iinventory1;
         this.f = entityhorse;
         byte b0 = 3;