From dbe39cf7e6ddc6c6fd1e639b495a8ac568e081a9 Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Wed, 2 Apr 2014 17:44:09 +0300 Subject: Fixed some bugs! --- .../jewelrycraft/container/GuiHandler.java | 38 +++++----------------- 1 file changed, 8 insertions(+), 30 deletions(-) (limited to 'common/darkknight/jewelrycraft/container/GuiHandler.java') diff --git a/common/darkknight/jewelrycraft/container/GuiHandler.java b/common/darkknight/jewelrycraft/container/GuiHandler.java index 6e1a78a..70ff5f7 100644 --- a/common/darkknight/jewelrycraft/container/GuiHandler.java +++ b/common/darkknight/jewelrycraft/container/GuiHandler.java @@ -11,13 +11,6 @@ import darkknight.jewelrycraft.client.GuiRingChest; public class GuiHandler implements IGuiHandler { - public static enum GuiId { - ringChest, - guide; - - public static final GuiId[] VALUES = GuiId.values(); - } - public GuiHandler() { NetworkRegistry.instance().registerGuiHandler(JewelrycraftMod.instance, this); @@ -25,38 +18,23 @@ public class GuiHandler implements IGuiHandler @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) - { - final GuiId guiId = getGuiId(ID); - if (guiId == null) return null; - switch(guiId) + { + switch(ID) { - case ringChest: return new ContainerRingChest(player.inventory, (TileEntityChest) world.getBlockTileEntity(x, y, z)); - case guide: return new ContainerGuide(); + case 0: return new ContainerRingChest(player.inventory, (TileEntityChest) world.getBlockTileEntity(x, y, z)); + case 1: return new ContainerGuide(); default: return null; } } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) - { - final GuiId guiId = getGuiId(ID); - if (guiId == null) return null; - switch(guiId) + { + switch(ID) { - case ringChest: return new GuiRingChest((ContainerRingChest) getServerGuiElement(ID, player, world, x, y, z)); - case guide: return new GuiGuide((ContainerGuide) getServerGuiElement(ID, player, world, x, y, z), world); + case 0: return new GuiRingChest((ContainerRingChest) getServerGuiElement(ID, player, world, x, y, z)); + case 1: return new GuiGuide((ContainerGuide) getServerGuiElement(ID, player, world, x, y, z), world); default: return null; } } - - private static GuiId getGuiId(int id) { - try - { - return GuiId.VALUES[id]; - } - catch (ArrayIndexOutOfBoundsException e) - { - return null; - } - } } -- cgit v1.2.3