diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockBreaker.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockBreaker.java index 1f60ca4b0..fb1c79839 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockBreaker.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockBreaker.java @@ -78,7 +78,7 @@ public class BlockBreaker extends BlockContainerBase implements INameableItem{ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityBreaker breaker = (TileEntityBreaker)world.getTileEntity(x, y, z); - if (breaker != null) player.openGui(ActuallyAdditions.instance, GuiHandler.BREAKER_ID, world, x, y, z); + if (breaker != null) player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.BREAKER.ordinal(), world, x, y, z); return true; } return true; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCanolaPress.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCanolaPress.java index 6e757409a..7bc62b0a7 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCanolaPress.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCanolaPress.java @@ -54,7 +54,7 @@ public class BlockCanolaPress extends BlockContainerBase implements INameableIte public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityCanolaPress press = (TileEntityCanolaPress)world.getTileEntity(x, y, z); - if (press != null) player.openGui(ActuallyAdditions.instance, GuiHandler.CANOLA_PRESS_ID, world, x, y, z); + if (press != null) player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.CANOLA_PRESS.ordinal(), world, x, y, z); return true; } return true; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoalGenerator.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoalGenerator.java index 4fa7fa86e..886b7e5c1 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoalGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoalGenerator.java @@ -70,7 +70,7 @@ public class BlockCoalGenerator extends BlockContainerBase implements INameableI public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityCoalGenerator press = (TileEntityCoalGenerator)world.getTileEntity(x, y, z); - if (press != null) player.openGui(ActuallyAdditions.instance, GuiHandler.COAL_GENERATOR_ID, world, x, y, z); + if (press != null) player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.COAL_GENERATOR.ordinal(), world, x, y, z); return true; } return true; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java index 792fea1c1..48a23b06a 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockCoffeeMachine.java @@ -51,7 +51,7 @@ public class BlockCoffeeMachine extends BlockContainerBase implements INameableI public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int f6, float f7, float f8, float f9){ if(!world.isRemote){ TileEntityCoffeeMachine machine = (TileEntityCoffeeMachine)world.getTileEntity(x, y, z); - if (machine != null) player.openGui(ActuallyAdditions.instance, GuiHandler.COFFEE_MACHINE_ID, world, x, y, z); + if (machine != null) player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.COFFEE_MACHINE.ordinal(), world, x, y, z); return true; } return true; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockDropper.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockDropper.java index a7676110c..a2db8e08a 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockDropper.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockDropper.java @@ -75,7 +75,7 @@ public class BlockDropper extends BlockContainerBase implements INameableItem{ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityDropper dropper = (TileEntityDropper)world.getTileEntity(x, y, z); - if (dropper != null) player.openGui(ActuallyAdditions.instance, GuiHandler.DROPPER_ID, world, x, y, z); + if (dropper != null) player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.DROPPER.ordinal(), world, x, y, z); return true; } return true; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockEnergizer.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockEnergizer.java index 5c684f94b..6f6a73026 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockEnergizer.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockEnergizer.java @@ -60,11 +60,11 @@ public class BlockEnergizer extends BlockContainerBase implements INameableItem{ if(!world.isRemote){ if(this.isEnergizer){ TileEntityEnergizer energizer = (TileEntityEnergizer)world.getTileEntity(x, y, z); - if(energizer != null) player.openGui(ActuallyAdditions.instance, GuiHandler.ENERGIZER_ID, world, x, y, z); + if(energizer != null) player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.ENERGIZER.ordinal(), world, x, y, z); } else{ TileEntityEnervator energizer = (TileEntityEnervator)world.getTileEntity(x, y, z); - if(energizer != null) player.openGui(ActuallyAdditions.instance, GuiHandler.ENERVATOR_ID, world, x, y, z); + if(energizer != null) player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.ENERVATOR.ordinal(), world, x, y, z); } return true; } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFeeder.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFeeder.java index e4edbfac9..5cc2cb7a0 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFeeder.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFeeder.java @@ -54,7 +54,7 @@ public class BlockFeeder extends BlockContainerBase implements INameableItem{ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityFeeder feeder = (TileEntityFeeder)world.getTileEntity(x, y, z); - if (feeder != null) player.openGui(ActuallyAdditions.instance, GuiHandler.FEEDER_ID, world, x, y, z); + if (feeder != null) player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FEEDER.ordinal(), world, x, y, z); return true; } return true; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFermentingBarrel.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFermentingBarrel.java index 85d0d7c9b..a21bf2084 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFermentingBarrel.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFermentingBarrel.java @@ -42,7 +42,7 @@ public class BlockFermentingBarrel extends BlockContainerBase implements INameab public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityFermentingBarrel press = (TileEntityFermentingBarrel)world.getTileEntity(x, y, z); - if (press != null) player.openGui(ActuallyAdditions.instance, GuiHandler.FERMENTING_BARREL_ID, world, x, y, z); + if (press != null) player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FERMENTING_BARREL.ordinal(), world, x, y, z); return true; } return true; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidCollector.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidCollector.java index d16fe5793..3c78bdfd6 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidCollector.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFluidCollector.java @@ -78,7 +78,7 @@ public class BlockFluidCollector extends BlockContainerBase implements INameable public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityFluidCollector collector = (TileEntityFluidCollector)world.getTileEntity(x, y, z); - if (collector != null) player.openGui(ActuallyAdditions.instance, GuiHandler.FLUID_COLLECTOR_ID, world, x, y, z); + if (collector != null) player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FLUID_COLLECTOR.ordinal(), world, x, y, z); return true; } return true; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java index 269adb224..abead2a1f 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockFurnaceDouble.java @@ -90,7 +90,7 @@ public class BlockFurnaceDouble extends BlockContainerBase implements INameableI public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityFurnaceDouble furnace = (TileEntityFurnaceDouble)world.getTileEntity(x, y, z); - if (furnace != null) player.openGui(ActuallyAdditions.instance, GuiHandler.FURNACE_DOUBLE_ID, world, x, y, z); + if (furnace != null) player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FURNACE_DOUBLE.ordinal(), world, x, y, z); return true; } return true; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGiantChest.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGiantChest.java index e1e5faa58..aea574236 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGiantChest.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGiantChest.java @@ -56,7 +56,7 @@ public class BlockGiantChest extends BlockContainerBase implements INameableItem public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityGiantChest chest = (TileEntityGiantChest)world.getTileEntity(x, y, z); - if (chest != null) player.openGui(ActuallyAdditions.instance, GuiHandler.GIANT_CHEST_ID, world, x, y, z); + if (chest != null) player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.GIANT_CHEST.ordinal(), world, x, y, z); return true; } return true; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java index fb9576519..3403ca517 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java @@ -88,7 +88,7 @@ public class BlockGrinder extends BlockContainerBase implements INameableItem{ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityGrinder grinder = (TileEntityGrinder)world.getTileEntity(x, y, z); - if (grinder != null) player.openGui(ActuallyAdditions.instance, this.isDouble ? GuiHandler.GRINDER_DOUBLE_ID : GuiHandler.GRINDER_ID, world, x, y, z); + if (grinder != null) player.openGui(ActuallyAdditions.instance, this.isDouble ? GuiHandler.GuiTypes.GRINDER_DOUBLE.ordinal() : GuiHandler.GuiTypes.GRINDER.ordinal(), world, x, y, z); return true; } return true; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java index 8be2cb27a..f13ca1e02 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockInputter.java @@ -57,7 +57,7 @@ public class BlockInputter extends BlockContainerBase implements INameableItem{ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityInputter inputter = (TileEntityInputter)world.getTileEntity(x, y, z); - if (inputter != null) player.openGui(ActuallyAdditions.instance, this.isAdvanced ? GuiHandler.INPUTTER_ADVANCED_ID : GuiHandler.INPUTTER_ID, world, x, y, z); + if (inputter != null) player.openGui(ActuallyAdditions.instance, this.isAdvanced ? GuiHandler.GuiTypes.INPUTTER_ADVANCED.ordinal() : GuiHandler.GuiTypes.INPUTTER.ordinal(), world, x, y, z); return true; } return true; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java index 9b806aa36..ff5d876ee 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockItemRepairer.java @@ -65,7 +65,7 @@ public class BlockItemRepairer extends BlockContainerBase implements INameableIt public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityItemRepairer repairer = (TileEntityItemRepairer)world.getTileEntity(x, y, z); - if (repairer != null) player.openGui(ActuallyAdditions.instance, GuiHandler.REPAIRER_ID, world, x, y, z); + if (repairer != null) player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.REPAIRER.ordinal(), world, x, y, z); return true; } return true; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockOilGenerator.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockOilGenerator.java index 51914b7b1..add48f42c 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockOilGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockOilGenerator.java @@ -70,7 +70,7 @@ public class BlockOilGenerator extends BlockContainerBase implements INameableIt public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityOilGenerator generator = (TileEntityOilGenerator)world.getTileEntity(x, y, z); - if (generator != null) player.openGui(ActuallyAdditions.instance, GuiHandler.OIL_GENERATOR_ID, world, x, y, z); + if (generator != null) player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.OIL_GENERATOR.ordinal(), world, x, y, z); return true; } return true; diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomface.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomface.java index 41651d5c9..c5365a707 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomface.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPhantomface.java @@ -84,7 +84,7 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte } else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notConnected.desc"))); } - else player.openGui(ActuallyAdditions.instance, GuiHandler.PHANTOM_PLACER_ID, world, x, y, z); + else player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.PHANTOM_PLACER.ordinal(), world, x, y, z); } } } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockXPSolidifier.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockXPSolidifier.java index 173d8b23e..2f6c87ba4 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockXPSolidifier.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockXPSolidifier.java @@ -83,7 +83,7 @@ public class BlockXPSolidifier extends BlockContainerBase implements INameableIt if(!world.isRemote){ TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier)world.getTileEntity(x, y, z); if(solidifier != null) - player.openGui(ActuallyAdditions.instance, GuiHandler.XP_SOLIDIFIER_ID, world, x, y, z); + player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.XP_SOLIDIFIER.ordinal(), world, x, y, z); return true; } return true; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java index 7d63a35a7..9cc97eae1 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java @@ -14,53 +14,53 @@ public class GuiHandler implements IGuiHandler{ @Override public Object getServerGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){ TileEntityBase tile = null; - if(id != CRAFTER_ID && id != DRILL_ID){ + if(id != GuiTypes.CRAFTER.ordinal() && id != GuiTypes.DRILL.ordinal()){ tile = (TileEntityBase)world.getTileEntity(x, y, z); } - switch(id){ - case FEEDER_ID: + switch(GuiTypes.values()[id]){ + case FEEDER: return new ContainerFeeder(entityPlayer.inventory, tile); - case GIANT_CHEST_ID: + case GIANT_CHEST: return new ContainerGiantChest(entityPlayer.inventory, tile); - case CRAFTER_ID: + case CRAFTER: return new ContainerCrafter(entityPlayer); - case GRINDER_ID: + case GRINDER: return new ContainerGrinder(entityPlayer.inventory, tile, false); - case GRINDER_DOUBLE_ID: + case GRINDER_DOUBLE: return new ContainerGrinder(entityPlayer.inventory, tile, true); - case FURNACE_DOUBLE_ID: + case FURNACE_DOUBLE: return new ContainerFurnaceDouble(entityPlayer.inventory, tile); - case INPUTTER_ID: + case INPUTTER: return new ContainerInputter(entityPlayer.inventory, tile, false); - case INPUTTER_ADVANCED_ID: + case INPUTTER_ADVANCED: return new ContainerInputter(entityPlayer.inventory, tile, true); - case REPAIRER_ID: + case REPAIRER: return new ContainerRepairer(entityPlayer.inventory, tile); - case BREAKER_ID: + case BREAKER: return new ContainerBreaker(entityPlayer.inventory, tile); - case DROPPER_ID: + case DROPPER: return new ContainerDropper(entityPlayer.inventory, tile); - case CANOLA_PRESS_ID: + case CANOLA_PRESS: return new ContainerCanolaPress(entityPlayer.inventory, tile); - case FERMENTING_BARREL_ID: + case FERMENTING_BARREL: return new ContainerFermentingBarrel(entityPlayer.inventory, tile); - case COAL_GENERATOR_ID: + case COAL_GENERATOR: return new ContainerCoalGenerator(entityPlayer.inventory, tile); - case OIL_GENERATOR_ID: + case OIL_GENERATOR: return new ContainerOilGenerator(entityPlayer.inventory, tile); - case PHANTOM_PLACER_ID: + case PHANTOM_PLACER: return new ContainerPhantomPlacer(entityPlayer.inventory, tile); - case FLUID_COLLECTOR_ID: + case FLUID_COLLECTOR: return new ContainerFluidCollector(entityPlayer.inventory, tile); - case COFFEE_MACHINE_ID: + case COFFEE_MACHINE: return new ContainerCoffeeMachine(entityPlayer.inventory, tile); - case DRILL_ID: + case DRILL: return new ContainerDrill(entityPlayer.inventory); - case ENERGIZER_ID: + case ENERGIZER: return new ContainerEnergizer(entityPlayer, tile); - case ENERVATOR_ID: + case ENERVATOR: return new ContainerEnervator(entityPlayer, tile); - case XP_SOLIDIFIER_ID: + case XP_SOLIDIFIER: return new ContainerXPSolidifier(entityPlayer.inventory, tile); default: return null; @@ -70,81 +70,83 @@ public class GuiHandler implements IGuiHandler{ @Override public Object getClientGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){ TileEntityBase tile = null; - if(id != CRAFTER_ID && id != DRILL_ID){ + if(id != GuiTypes.CRAFTER.ordinal() && id != GuiTypes.DRILL.ordinal()){ tile = (TileEntityBase)world.getTileEntity(x, y, z); } - switch(id){ - case FEEDER_ID: + switch(GuiTypes.values()[id]){ + case FEEDER: return new GuiFeeder(entityPlayer.inventory, tile); - case GIANT_CHEST_ID: + case GIANT_CHEST: return new GuiGiantChest(entityPlayer.inventory, tile); - case CRAFTER_ID: + case CRAFTER: return new GuiCrafter(entityPlayer); - case GRINDER_ID: + case GRINDER: return new GuiGrinder(entityPlayer.inventory, tile, false); - case GRINDER_DOUBLE_ID: + case GRINDER_DOUBLE: return new GuiGrinder(entityPlayer.inventory, tile, true); - case FURNACE_DOUBLE_ID: + case FURNACE_DOUBLE: return new GuiFurnaceDouble(entityPlayer.inventory, tile); - case INPUTTER_ID: + case INPUTTER: return new GuiInputter(entityPlayer.inventory, tile, x, y, z, world, false); - case INPUTTER_ADVANCED_ID: + case INPUTTER_ADVANCED: return new GuiInputter(entityPlayer.inventory, tile, x, y, z, world, true); - case REPAIRER_ID: + case REPAIRER: return new GuiRepairer(entityPlayer.inventory, tile); - case BREAKER_ID: + case BREAKER: return new GuiBreaker(entityPlayer.inventory, tile); - case DROPPER_ID: + case DROPPER: return new GuiDropper(entityPlayer.inventory, tile); - case CANOLA_PRESS_ID: + case CANOLA_PRESS: return new GuiCanolaPress(entityPlayer.inventory, tile); - case FERMENTING_BARREL_ID: + case FERMENTING_BARREL: return new GuiFermentingBarrel(entityPlayer.inventory, tile); - case COAL_GENERATOR_ID: + case COAL_GENERATOR: return new GuiCoalGenerator(entityPlayer.inventory, tile); - case OIL_GENERATOR_ID: + case OIL_GENERATOR: return new GuiOilGenerator(entityPlayer.inventory, tile); - case PHANTOM_PLACER_ID: + case PHANTOM_PLACER: return new GuiPhantomPlacer(entityPlayer.inventory, tile); - case FLUID_COLLECTOR_ID: + case FLUID_COLLECTOR: return new GuiFluidCollector(entityPlayer.inventory, tile); - case COFFEE_MACHINE_ID: + case COFFEE_MACHINE: return new GuiCoffeeMachine(entityPlayer.inventory, tile, x, y, z, world); - case DRILL_ID: + case DRILL: return new GuiDrill(entityPlayer.inventory); - case ENERGIZER_ID: + case ENERGIZER: return new GuiEnergizer(entityPlayer, tile); - case ENERVATOR_ID: + case ENERVATOR: return new GuiEnervator(entityPlayer, tile); - case XP_SOLIDIFIER_ID: + case XP_SOLIDIFIER: return new GuiXPSolidifier(entityPlayer.inventory, tile, x, y, z, world); default: return null; } } - public static final int FEEDER_ID = 0; - public static final int GIANT_CHEST_ID = 1; - public static final int CRAFTER_ID = 2; - public static final int GRINDER_ID = 3; - public static final int GRINDER_DOUBLE_ID = 4; - public static final int FURNACE_DOUBLE_ID = 5; - public static final int INPUTTER_ID = 6; - public static final int REPAIRER_ID = 7; - public static final int INPUTTER_ADVANCED_ID = 8; - public static final int BREAKER_ID = 9; - public static final int DROPPER_ID = 10; - public static final int CANOLA_PRESS_ID = 11; - public static final int FERMENTING_BARREL_ID = 12; - public static final int COAL_GENERATOR_ID = 13; - public static final int OIL_GENERATOR_ID = 14; - public static final int PHANTOM_PLACER_ID = 15; - public static final int FLUID_COLLECTOR_ID = 16; - public static final int COFFEE_MACHINE_ID = 17; - public static final int DRILL_ID = 18; - public static final int ENERGIZER_ID = 19; - public static final int ENERVATOR_ID = 20; - public static final int XP_SOLIDIFIER_ID = 21; + public enum GuiTypes{ + FEEDER, + GIANT_CHEST, + CRAFTER, + GRINDER, + GRINDER_DOUBLE, + FURNACE_DOUBLE, + INPUTTER, + REPAIRER, + INPUTTER_ADVANCED, + BREAKER, + DROPPER, + CANOLA_PRESS, + FERMENTING_BARREL, + COAL_GENERATOR, + OIL_GENERATOR, + PHANTOM_PLACER, + FLUID_COLLECTOR, + COFFEE_MACHINE, + DRILL, + ENERGIZER, + ENERVATOR, + XP_SOLIDIFIER + } public static void init(){ ModUtil.LOGGER.info("Initializing GuiHandler..."); diff --git a/src/main/java/ellpeck/actuallyadditions/items/InitItems.java b/src/main/java/ellpeck/actuallyadditions/items/InitItems.java index c28607493..1f0e3126e 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/InitItems.java +++ b/src/main/java/ellpeck/actuallyadditions/items/InitItems.java @@ -96,9 +96,10 @@ public class InitItems{ public static Item itemBatteryQuintuple; public static Item itemTeleStaff; - public static Item itemWingsOfTheBats; + public static Item itemPicturePlacer; + public static void init(){ ModUtil.LOGGER.info("Initializing Items..."); @@ -117,6 +118,9 @@ public class InitItems{ itemTeleStaff = new ItemTeleStaff(); ItemUtil.register(itemTeleStaff); + itemPicturePlacer = new ItemPicturePlacer(); + ItemUtil.register(itemPicturePlacer); + itemWingsOfTheBats = new ItemWingsOfTheBats(); ItemUtil.register(itemWingsOfTheBats); diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemCrafterOnAStick.java b/src/main/java/ellpeck/actuallyadditions/items/ItemCrafterOnAStick.java index dacf6df6e..4dd18f883 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemCrafterOnAStick.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemCrafterOnAStick.java @@ -43,7 +43,7 @@ public class ItemCrafterOnAStick extends Item implements INameableItem{ @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ - if(!world.isRemote) player.openGui(ActuallyAdditions.instance, GuiHandler.CRAFTER_ID, world, (int)player.posX, (int)player.posY, (int)player.posZ); + if(!world.isRemote) player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.CRAFTER.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ); return stack; } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java b/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java index b77689712..f1e2015fb 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java @@ -441,7 +441,7 @@ public class ItemDrill extends ItemEnergy implements INameableItem{ @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ if(!world.isRemote && player.isSneaking() && stack == player.getCurrentEquippedItem()){ - player.openGui(ActuallyAdditions.instance, GuiHandler.DRILL_ID, world, (int)player.posX, (int)player.posY, (int)player.posZ); + player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.DRILL.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ); } return stack; } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemPicturePlacer.java b/src/main/java/ellpeck/actuallyadditions/items/ItemPicturePlacer.java new file mode 100644 index 000000000..abc7f477e --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemPicturePlacer.java @@ -0,0 +1,78 @@ +package ellpeck.actuallyadditions.items; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.ActuallyAdditions; +import ellpeck.actuallyadditions.inventory.GuiHandler; +import ellpeck.actuallyadditions.util.INameableItem; +import ellpeck.actuallyadditions.util.ItemUtil; +import ellpeck.actuallyadditions.util.ModUtil; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.EntityHanging; +import net.minecraft.entity.item.EntityPainting; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Direction; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +import java.util.List; + +public class ItemPicturePlacer extends Item implements INameableItem{ + + @Override + @SuppressWarnings("unchecked") + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ + ItemUtil.addInformation(this, list, 1, ""); + } + + @Override + public IIcon getIcon(ItemStack stack, int pass){ + return this.itemIcon; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconReg){ + this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getName()); + } + + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ + if(!world.isRemote) + player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.CRAFTER.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ); + return stack; + } + + @Override + public EnumRarity getRarity(ItemStack stack){ + return EnumRarity.epic; + } + + @Override + public String getName(){ + return "itemPicturePlacer"; + } + + @Override + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int hitSide, float hitX, float hitY, float hitZ){ + if(hitSide == 0 || hitSide == 1) return false; + else{ + EntityHanging hanging = new EntityPainting(world, x, y, z, Direction.facingToDirection[hitSide]); + + if(!player.canPlayerEdit(x, y, z, hitSide, stack)) return false; + else{ + if(hanging.onValidSurface()){ + if(!world.isRemote){ + world.spawnEntityInWorld(hanging); + } + stack.stackSize--; + } + return true; + } + } + } +}