diff options
author | md_5 <git@md-5.net> | 2016-03-20 10:22:24 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2016-03-20 10:22:24 +1100 |
commit | 105df861edd5af531681378274419bca42cdbe05 (patch) | |
tree | d3c55ee9d8dcba5b72cceb25bced3499b64574f1 | |
parent | 4cd46b242beecb828dbe193c9cb913b620e852d1 (diff) | |
download | craftbukkit-105df861edd5af531681378274419bca42cdbe05.tar craftbukkit-105df861edd5af531681378274419bca42cdbe05.tar.gz craftbukkit-105df861edd5af531681378274419bca42cdbe05.tar.lz craftbukkit-105df861edd5af531681378274419bca42cdbe05.tar.xz craftbukkit-105df861edd5af531681378274419bca42cdbe05.zip |
SPIGOT-1980: Register new brewing slot
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java | 101 |
1 files changed, 51 insertions, 50 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java index 1dbc588e..85b416ce 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java @@ -14,6 +14,7 @@ import net.minecraft.server.PacketPlayOutOpenWindow; import net.minecraft.server.Slot; public class CraftContainer extends Container { + private final InventoryView view; private InventoryType cachedType; private String cachedTitle; @@ -23,8 +24,8 @@ public class CraftContainer extends Container { this.view = view; this.windowId = id; // TODO: Do we need to check that it really is a CraftInventory? - IInventory top = ((CraftInventory)view.getTopInventory()).getInventory(); - IInventory bottom = ((CraftInventory)view.getBottomInventory()).getInventory(); + IInventory top = ((CraftInventory) view.getTopInventory()).getInventory(); + IInventory bottom = ((CraftInventory) view.getBottomInventory()).getInventory(); cachedType = view.getType(); cachedTitle = view.getTitle(); cachedSize = getSize(); @@ -78,8 +79,8 @@ public class CraftContainer extends Container { if (view.getPlayer() instanceof CraftPlayer) { CraftPlayer player = (CraftPlayer) view.getPlayer(); String type = getNotchInventoryType(cachedType); - IInventory top = ((CraftInventory)view.getTopInventory()).getInventory(); - IInventory bottom = ((CraftInventory)view.getBottomInventory()).getInventory(); + IInventory top = ((CraftInventory) view.getTopInventory()).getInventory(); + IInventory bottom = ((CraftInventory) view.getBottomInventory()).getInventory(); this.b.clear(); this.c.clear(); if (typeChanged) { @@ -93,55 +94,55 @@ public class CraftContainer extends Container { } public static String getNotchInventoryType(InventoryType type) { - switch(type) { - case WORKBENCH: - return "minecraft:crafting_table"; - case FURNACE: - return "minecraft:furnace"; - case DISPENSER: - return "minecraft:dispenser"; - case ENCHANTING: - return "minecraft:enchanting_table"; - case BREWING: - return "minecraft:brewing_stand"; - case BEACON: - return "minecraft:beacon"; - case ANVIL: - return "minecraft:anvil"; - case HOPPER: - return "minecraft:hopper"; - default: - return "minecraft:chest"; + switch (type) { + case WORKBENCH: + return "minecraft:crafting_table"; + case FURNACE: + return "minecraft:furnace"; + case DISPENSER: + return "minecraft:dispenser"; + case ENCHANTING: + return "minecraft:enchanting_table"; + case BREWING: + return "minecraft:brewing_stand"; + case BEACON: + return "minecraft:beacon"; + case ANVIL: + return "minecraft:anvil"; + case HOPPER: + return "minecraft:hopper"; + default: + return "minecraft:chest"; } } private void setupSlots(IInventory top, IInventory bottom) { - switch(cachedType) { - case CREATIVE: - break; // TODO: This should be an error? - case PLAYER: - case CHEST: - setupChest(top, bottom); - break; - case DISPENSER: - setupDispenser(top, bottom); - break; - case FURNACE: - setupFurnace(top, bottom); - break; - case CRAFTING: // TODO: This should be an error? - case WORKBENCH: - setupWorkbench(top, bottom); - break; - case ENCHANTING: - setupEnchanting(top, bottom); - break; - case BREWING: - setupBrewing(top, bottom); - break; - case HOPPER: - setupHopper(top, bottom); - break; + switch (cachedType) { + case CREATIVE: + break; // TODO: This should be an error? + case PLAYER: + case CHEST: + setupChest(top, bottom); + break; + case DISPENSER: + setupDispenser(top, bottom); + break; + case FURNACE: + setupFurnace(top, bottom); + break; + case CRAFTING: // TODO: This should be an error? + case WORKBENCH: + setupWorkbench(top, bottom); + break; + case ENCHANTING: + setupEnchanting(top, bottom); + break; + case BREWING: + setupBrewing(top, bottom); + break; + case HOPPER: + setupHopper(top, bottom); + break; } } @@ -262,9 +263,9 @@ public class CraftContainer extends Container { this.a(new Slot(top, 1, 79, 53)); this.a(new Slot(top, 2, 102, 46)); this.a(new Slot(top, 3, 79, 17)); + this.a(new Slot(top, 4, 17, 17)); int i; - for (i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { this.a(new Slot(bottom, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); |