diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2012-10-31 12:14:39 -0500 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-10-31 13:25:53 -0400 |
commit | 87a1cd3d43c1a86c51abcde72f778636e979e0ee (patch) | |
tree | bcec2d78974c4176bca40d0748241195c7842138 /src/main/java/org/bukkit | |
parent | 347fd3cb6e135f9d8053678f9f4fa4349d8ce128 (diff) | |
download | craftbukkit-87a1cd3d43c1a86c51abcde72f778636e979e0ee.tar craftbukkit-87a1cd3d43c1a86c51abcde72f778636e979e0ee.tar.gz craftbukkit-87a1cd3d43c1a86c51abcde72f778636e979e0ee.tar.lz craftbukkit-87a1cd3d43c1a86c51abcde72f778636e979e0ee.tar.xz craftbukkit-87a1cd3d43c1a86c51abcde72f778636e979e0ee.zip |
Add inventory and slot types for new containers. Fixes BUKKIT-2741
Diffstat (limited to 'src/main/java/org/bukkit')
3 files changed, 22 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java index c576c8c3..f12a7202 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java @@ -109,6 +109,12 @@ public class CraftContainer extends Container { case BREWING: typeID = 5; break; + case BEACON: + typeID = 7; + break; + case ANVIL: + typeID = 8; + break; default: typeID = 0; break; diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java index c8f25b02..d60b1d82 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -4,12 +4,14 @@ import java.util.HashMap; import java.util.List; import java.util.ListIterator; +import net.minecraft.server.ContainerAnvilInventory; import net.minecraft.server.ContainerEnchantTableInventory; import net.minecraft.server.IInventory; import net.minecraft.server.InventoryCrafting; import net.minecraft.server.InventoryEnderChest; import net.minecraft.server.InventoryMerchant; import net.minecraft.server.PlayerInventory; +import net.minecraft.server.TileEntityBeacon; import net.minecraft.server.TileEntityBrewingStand; import net.minecraft.server.TileEntityDispenser; import net.minecraft.server.TileEntityFurnace; @@ -416,6 +418,10 @@ public class CraftInventory implements Inventory { return InventoryType.ENDER_CHEST; } else if (inventory instanceof InventoryMerchant) { return InventoryType.MERCHANT; + } else if (inventory instanceof TileEntityBeacon) { + return InventoryType.BEACON; + } else if (inventory instanceof ContainerAnvilInventory) { + return InventoryType.ANVIL; } else { return InventoryType.CHEST; } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java index 55df2197..0e930914 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java @@ -109,6 +109,16 @@ public class CraftInventoryView extends InventoryView { type = SlotType.CRAFTING; } break; + case BEACON: + type = SlotType.CRAFTING; + break; + case ANVIL: + if (slot == 2) { + type = SlotType.RESULT; + } else { + type = SlotType.CRAFTING; + } + break; default: // Nothing to do, it's a CONTAINER slot } |