From eb6c1bf31a29bf3880f6e496f5e4ea52e1bdf291 Mon Sep 17 00:00:00 2001 From: Xor Boole Date: Wed, 30 Nov 2016 16:40:40 +1100 Subject: Add some expansions to Anvil Inventory API --- nms-patches/ContainerAnvil.patch | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'nms-patches') diff --git a/nms-patches/ContainerAnvil.patch b/nms-patches/ContainerAnvil.patch index f42c2945..27ce994b 100644 --- a/nms-patches/ContainerAnvil.patch +++ b/nms-patches/ContainerAnvil.patch @@ -11,9 +11,12 @@ public class ContainerAnvil extends Container { private static final Logger f = LogManager.getLogger(); -@@ -22,8 +26,13 @@ +@@ -20,10 +24,15 @@ + private final BlockPosition j; + public int a; private int k; - private String l; +- private String l; ++ public String l; // PAIL: private -> public private final EntityHuman m; + // CraftBukkit start + private CraftInventoryView bukkitEntity; @@ -69,20 +72,31 @@ return this.i.getType(this.j).getBlock() != Blocks.ANVIL ? false : entityhuman.d((double) this.j.getX() + 0.5D, (double) this.j.getY() + 0.5D, (double) this.j.getZ() + 0.5D) <= 64.0D; } -@@ -350,4 +360,18 @@ +@@ -350,4 +360,29 @@ this.e(); } + + // CraftBukkit start + @Override ++ public void b() { ++ super.b(); ++ ++ for (int i = 0; i < this.listeners.size(); ++i) { ++ ICrafting icrafting = (ICrafting) this.listeners.get(i); ++ ++ icrafting.setContainerData(this, 0, this.a); ++ } ++ } ++ ++ @Override + public CraftInventoryView getBukkitView() { + if (bukkitEntity != null) { + return bukkitEntity; + } + + org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryAnvil( -+ new org.bukkit.Location(i.getWorld(), j.getX(), j.getY(), j.getZ()), this.h, this.g); ++ new org.bukkit.Location(i.getWorld(), j.getX(), j.getY(), j.getZ()), this.h, this.g, this); + bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this); + return bukkitEntity; + } -- cgit v1.2.3