mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-29 18:28:34 +01:00
Changed GUIs to be an enum instead of static final ints
This commit is contained in:
parent
5b1c5a5856
commit
1387114a8c
22 changed files with 175 additions and 91 deletions
|
@ -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){
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
TileEntityBreaker breaker = (TileEntityBreaker)world.getTileEntity(x, y, z);
|
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;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -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){
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
TileEntityCanolaPress press = (TileEntityCanolaPress)world.getTileEntity(x, y, z);
|
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;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -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){
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
TileEntityCoalGenerator press = (TileEntityCoalGenerator)world.getTileEntity(x, y, z);
|
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;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -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){
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int f6, float f7, float f8, float f9){
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
TileEntityCoffeeMachine machine = (TileEntityCoffeeMachine)world.getTileEntity(x, y, z);
|
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;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -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){
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
TileEntityDropper dropper = (TileEntityDropper)world.getTileEntity(x, y, z);
|
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;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -60,11 +60,11 @@ public class BlockEnergizer extends BlockContainerBase implements INameableItem{
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
if(this.isEnergizer){
|
if(this.isEnergizer){
|
||||||
TileEntityEnergizer energizer = (TileEntityEnergizer)world.getTileEntity(x, y, z);
|
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{
|
else{
|
||||||
TileEntityEnervator energizer = (TileEntityEnervator)world.getTileEntity(x, y, z);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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){
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
TileEntityFeeder feeder = (TileEntityFeeder)world.getTileEntity(x, y, z);
|
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;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -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){
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
TileEntityFermentingBarrel press = (TileEntityFermentingBarrel)world.getTileEntity(x, y, z);
|
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;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -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){
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
TileEntityFluidCollector collector = (TileEntityFluidCollector)world.getTileEntity(x, y, z);
|
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;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -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){
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
TileEntityFurnaceDouble furnace = (TileEntityFurnaceDouble)world.getTileEntity(x, y, z);
|
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;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -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){
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
TileEntityGiantChest chest = (TileEntityGiantChest)world.getTileEntity(x, y, z);
|
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;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -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){
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
TileEntityGrinder grinder = (TileEntityGrinder)world.getTileEntity(x, y, z);
|
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;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -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){
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
TileEntityInputter inputter = (TileEntityInputter)world.getTileEntity(x, y, z);
|
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;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -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){
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
TileEntityItemRepairer repairer = (TileEntityItemRepairer)world.getTileEntity(x, y, z);
|
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;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -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){
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
TileEntityOilGenerator generator = (TileEntityOilGenerator)world.getTileEntity(x, y, z);
|
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;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -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.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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class BlockXPSolidifier extends BlockContainerBase implements INameableIt
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier)world.getTileEntity(x, y, z);
|
TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier)world.getTileEntity(x, y, z);
|
||||||
if(solidifier != null)
|
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;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -14,53 +14,53 @@ public class GuiHandler implements IGuiHandler{
|
||||||
@Override
|
@Override
|
||||||
public Object getServerGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){
|
public Object getServerGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){
|
||||||
TileEntityBase tile = null;
|
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);
|
tile = (TileEntityBase)world.getTileEntity(x, y, z);
|
||||||
}
|
}
|
||||||
switch(id){
|
switch(GuiTypes.values()[id]){
|
||||||
case FEEDER_ID:
|
case FEEDER:
|
||||||
return new ContainerFeeder(entityPlayer.inventory, tile);
|
return new ContainerFeeder(entityPlayer.inventory, tile);
|
||||||
case GIANT_CHEST_ID:
|
case GIANT_CHEST:
|
||||||
return new ContainerGiantChest(entityPlayer.inventory, tile);
|
return new ContainerGiantChest(entityPlayer.inventory, tile);
|
||||||
case CRAFTER_ID:
|
case CRAFTER:
|
||||||
return new ContainerCrafter(entityPlayer);
|
return new ContainerCrafter(entityPlayer);
|
||||||
case GRINDER_ID:
|
case GRINDER:
|
||||||
return new ContainerGrinder(entityPlayer.inventory, tile, false);
|
return new ContainerGrinder(entityPlayer.inventory, tile, false);
|
||||||
case GRINDER_DOUBLE_ID:
|
case GRINDER_DOUBLE:
|
||||||
return new ContainerGrinder(entityPlayer.inventory, tile, true);
|
return new ContainerGrinder(entityPlayer.inventory, tile, true);
|
||||||
case FURNACE_DOUBLE_ID:
|
case FURNACE_DOUBLE:
|
||||||
return new ContainerFurnaceDouble(entityPlayer.inventory, tile);
|
return new ContainerFurnaceDouble(entityPlayer.inventory, tile);
|
||||||
case INPUTTER_ID:
|
case INPUTTER:
|
||||||
return new ContainerInputter(entityPlayer.inventory, tile, false);
|
return new ContainerInputter(entityPlayer.inventory, tile, false);
|
||||||
case INPUTTER_ADVANCED_ID:
|
case INPUTTER_ADVANCED:
|
||||||
return new ContainerInputter(entityPlayer.inventory, tile, true);
|
return new ContainerInputter(entityPlayer.inventory, tile, true);
|
||||||
case REPAIRER_ID:
|
case REPAIRER:
|
||||||
return new ContainerRepairer(entityPlayer.inventory, tile);
|
return new ContainerRepairer(entityPlayer.inventory, tile);
|
||||||
case BREAKER_ID:
|
case BREAKER:
|
||||||
return new ContainerBreaker(entityPlayer.inventory, tile);
|
return new ContainerBreaker(entityPlayer.inventory, tile);
|
||||||
case DROPPER_ID:
|
case DROPPER:
|
||||||
return new ContainerDropper(entityPlayer.inventory, tile);
|
return new ContainerDropper(entityPlayer.inventory, tile);
|
||||||
case CANOLA_PRESS_ID:
|
case CANOLA_PRESS:
|
||||||
return new ContainerCanolaPress(entityPlayer.inventory, tile);
|
return new ContainerCanolaPress(entityPlayer.inventory, tile);
|
||||||
case FERMENTING_BARREL_ID:
|
case FERMENTING_BARREL:
|
||||||
return new ContainerFermentingBarrel(entityPlayer.inventory, tile);
|
return new ContainerFermentingBarrel(entityPlayer.inventory, tile);
|
||||||
case COAL_GENERATOR_ID:
|
case COAL_GENERATOR:
|
||||||
return new ContainerCoalGenerator(entityPlayer.inventory, tile);
|
return new ContainerCoalGenerator(entityPlayer.inventory, tile);
|
||||||
case OIL_GENERATOR_ID:
|
case OIL_GENERATOR:
|
||||||
return new ContainerOilGenerator(entityPlayer.inventory, tile);
|
return new ContainerOilGenerator(entityPlayer.inventory, tile);
|
||||||
case PHANTOM_PLACER_ID:
|
case PHANTOM_PLACER:
|
||||||
return new ContainerPhantomPlacer(entityPlayer.inventory, tile);
|
return new ContainerPhantomPlacer(entityPlayer.inventory, tile);
|
||||||
case FLUID_COLLECTOR_ID:
|
case FLUID_COLLECTOR:
|
||||||
return new ContainerFluidCollector(entityPlayer.inventory, tile);
|
return new ContainerFluidCollector(entityPlayer.inventory, tile);
|
||||||
case COFFEE_MACHINE_ID:
|
case COFFEE_MACHINE:
|
||||||
return new ContainerCoffeeMachine(entityPlayer.inventory, tile);
|
return new ContainerCoffeeMachine(entityPlayer.inventory, tile);
|
||||||
case DRILL_ID:
|
case DRILL:
|
||||||
return new ContainerDrill(entityPlayer.inventory);
|
return new ContainerDrill(entityPlayer.inventory);
|
||||||
case ENERGIZER_ID:
|
case ENERGIZER:
|
||||||
return new ContainerEnergizer(entityPlayer, tile);
|
return new ContainerEnergizer(entityPlayer, tile);
|
||||||
case ENERVATOR_ID:
|
case ENERVATOR:
|
||||||
return new ContainerEnervator(entityPlayer, tile);
|
return new ContainerEnervator(entityPlayer, tile);
|
||||||
case XP_SOLIDIFIER_ID:
|
case XP_SOLIDIFIER:
|
||||||
return new ContainerXPSolidifier(entityPlayer.inventory, tile);
|
return new ContainerXPSolidifier(entityPlayer.inventory, tile);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
|
@ -70,81 +70,83 @@ public class GuiHandler implements IGuiHandler{
|
||||||
@Override
|
@Override
|
||||||
public Object getClientGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){
|
public Object getClientGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){
|
||||||
TileEntityBase tile = null;
|
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);
|
tile = (TileEntityBase)world.getTileEntity(x, y, z);
|
||||||
}
|
}
|
||||||
switch(id){
|
switch(GuiTypes.values()[id]){
|
||||||
case FEEDER_ID:
|
case FEEDER:
|
||||||
return new GuiFeeder(entityPlayer.inventory, tile);
|
return new GuiFeeder(entityPlayer.inventory, tile);
|
||||||
case GIANT_CHEST_ID:
|
case GIANT_CHEST:
|
||||||
return new GuiGiantChest(entityPlayer.inventory, tile);
|
return new GuiGiantChest(entityPlayer.inventory, tile);
|
||||||
case CRAFTER_ID:
|
case CRAFTER:
|
||||||
return new GuiCrafter(entityPlayer);
|
return new GuiCrafter(entityPlayer);
|
||||||
case GRINDER_ID:
|
case GRINDER:
|
||||||
return new GuiGrinder(entityPlayer.inventory, tile, false);
|
return new GuiGrinder(entityPlayer.inventory, tile, false);
|
||||||
case GRINDER_DOUBLE_ID:
|
case GRINDER_DOUBLE:
|
||||||
return new GuiGrinder(entityPlayer.inventory, tile, true);
|
return new GuiGrinder(entityPlayer.inventory, tile, true);
|
||||||
case FURNACE_DOUBLE_ID:
|
case FURNACE_DOUBLE:
|
||||||
return new GuiFurnaceDouble(entityPlayer.inventory, tile);
|
return new GuiFurnaceDouble(entityPlayer.inventory, tile);
|
||||||
case INPUTTER_ID:
|
case INPUTTER:
|
||||||
return new GuiInputter(entityPlayer.inventory, tile, x, y, z, world, false);
|
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);
|
return new GuiInputter(entityPlayer.inventory, tile, x, y, z, world, true);
|
||||||
case REPAIRER_ID:
|
case REPAIRER:
|
||||||
return new GuiRepairer(entityPlayer.inventory, tile);
|
return new GuiRepairer(entityPlayer.inventory, tile);
|
||||||
case BREAKER_ID:
|
case BREAKER:
|
||||||
return new GuiBreaker(entityPlayer.inventory, tile);
|
return new GuiBreaker(entityPlayer.inventory, tile);
|
||||||
case DROPPER_ID:
|
case DROPPER:
|
||||||
return new GuiDropper(entityPlayer.inventory, tile);
|
return new GuiDropper(entityPlayer.inventory, tile);
|
||||||
case CANOLA_PRESS_ID:
|
case CANOLA_PRESS:
|
||||||
return new GuiCanolaPress(entityPlayer.inventory, tile);
|
return new GuiCanolaPress(entityPlayer.inventory, tile);
|
||||||
case FERMENTING_BARREL_ID:
|
case FERMENTING_BARREL:
|
||||||
return new GuiFermentingBarrel(entityPlayer.inventory, tile);
|
return new GuiFermentingBarrel(entityPlayer.inventory, tile);
|
||||||
case COAL_GENERATOR_ID:
|
case COAL_GENERATOR:
|
||||||
return new GuiCoalGenerator(entityPlayer.inventory, tile);
|
return new GuiCoalGenerator(entityPlayer.inventory, tile);
|
||||||
case OIL_GENERATOR_ID:
|
case OIL_GENERATOR:
|
||||||
return new GuiOilGenerator(entityPlayer.inventory, tile);
|
return new GuiOilGenerator(entityPlayer.inventory, tile);
|
||||||
case PHANTOM_PLACER_ID:
|
case PHANTOM_PLACER:
|
||||||
return new GuiPhantomPlacer(entityPlayer.inventory, tile);
|
return new GuiPhantomPlacer(entityPlayer.inventory, tile);
|
||||||
case FLUID_COLLECTOR_ID:
|
case FLUID_COLLECTOR:
|
||||||
return new GuiFluidCollector(entityPlayer.inventory, tile);
|
return new GuiFluidCollector(entityPlayer.inventory, tile);
|
||||||
case COFFEE_MACHINE_ID:
|
case COFFEE_MACHINE:
|
||||||
return new GuiCoffeeMachine(entityPlayer.inventory, tile, x, y, z, world);
|
return new GuiCoffeeMachine(entityPlayer.inventory, tile, x, y, z, world);
|
||||||
case DRILL_ID:
|
case DRILL:
|
||||||
return new GuiDrill(entityPlayer.inventory);
|
return new GuiDrill(entityPlayer.inventory);
|
||||||
case ENERGIZER_ID:
|
case ENERGIZER:
|
||||||
return new GuiEnergizer(entityPlayer, tile);
|
return new GuiEnergizer(entityPlayer, tile);
|
||||||
case ENERVATOR_ID:
|
case ENERVATOR:
|
||||||
return new GuiEnervator(entityPlayer, tile);
|
return new GuiEnervator(entityPlayer, tile);
|
||||||
case XP_SOLIDIFIER_ID:
|
case XP_SOLIDIFIER:
|
||||||
return new GuiXPSolidifier(entityPlayer.inventory, tile, x, y, z, world);
|
return new GuiXPSolidifier(entityPlayer.inventory, tile, x, y, z, world);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final int FEEDER_ID = 0;
|
public enum GuiTypes{
|
||||||
public static final int GIANT_CHEST_ID = 1;
|
FEEDER,
|
||||||
public static final int CRAFTER_ID = 2;
|
GIANT_CHEST,
|
||||||
public static final int GRINDER_ID = 3;
|
CRAFTER,
|
||||||
public static final int GRINDER_DOUBLE_ID = 4;
|
GRINDER,
|
||||||
public static final int FURNACE_DOUBLE_ID = 5;
|
GRINDER_DOUBLE,
|
||||||
public static final int INPUTTER_ID = 6;
|
FURNACE_DOUBLE,
|
||||||
public static final int REPAIRER_ID = 7;
|
INPUTTER,
|
||||||
public static final int INPUTTER_ADVANCED_ID = 8;
|
REPAIRER,
|
||||||
public static final int BREAKER_ID = 9;
|
INPUTTER_ADVANCED,
|
||||||
public static final int DROPPER_ID = 10;
|
BREAKER,
|
||||||
public static final int CANOLA_PRESS_ID = 11;
|
DROPPER,
|
||||||
public static final int FERMENTING_BARREL_ID = 12;
|
CANOLA_PRESS,
|
||||||
public static final int COAL_GENERATOR_ID = 13;
|
FERMENTING_BARREL,
|
||||||
public static final int OIL_GENERATOR_ID = 14;
|
COAL_GENERATOR,
|
||||||
public static final int PHANTOM_PLACER_ID = 15;
|
OIL_GENERATOR,
|
||||||
public static final int FLUID_COLLECTOR_ID = 16;
|
PHANTOM_PLACER,
|
||||||
public static final int COFFEE_MACHINE_ID = 17;
|
FLUID_COLLECTOR,
|
||||||
public static final int DRILL_ID = 18;
|
COFFEE_MACHINE,
|
||||||
public static final int ENERGIZER_ID = 19;
|
DRILL,
|
||||||
public static final int ENERVATOR_ID = 20;
|
ENERGIZER,
|
||||||
public static final int XP_SOLIDIFIER_ID = 21;
|
ENERVATOR,
|
||||||
|
XP_SOLIDIFIER
|
||||||
|
}
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
ModUtil.LOGGER.info("Initializing GuiHandler...");
|
ModUtil.LOGGER.info("Initializing GuiHandler...");
|
||||||
|
|
|
@ -96,9 +96,10 @@ public class InitItems{
|
||||||
public static Item itemBatteryQuintuple;
|
public static Item itemBatteryQuintuple;
|
||||||
|
|
||||||
public static Item itemTeleStaff;
|
public static Item itemTeleStaff;
|
||||||
|
|
||||||
public static Item itemWingsOfTheBats;
|
public static Item itemWingsOfTheBats;
|
||||||
|
|
||||||
|
public static Item itemPicturePlacer;
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
ModUtil.LOGGER.info("Initializing Items...");
|
ModUtil.LOGGER.info("Initializing Items...");
|
||||||
|
|
||||||
|
@ -117,6 +118,9 @@ public class InitItems{
|
||||||
itemTeleStaff = new ItemTeleStaff();
|
itemTeleStaff = new ItemTeleStaff();
|
||||||
ItemUtil.register(itemTeleStaff);
|
ItemUtil.register(itemTeleStaff);
|
||||||
|
|
||||||
|
itemPicturePlacer = new ItemPicturePlacer();
|
||||||
|
ItemUtil.register(itemPicturePlacer);
|
||||||
|
|
||||||
itemWingsOfTheBats = new ItemWingsOfTheBats();
|
itemWingsOfTheBats = new ItemWingsOfTheBats();
|
||||||
ItemUtil.register(itemWingsOfTheBats);
|
ItemUtil.register(itemWingsOfTheBats);
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class ItemCrafterOnAStick extends Item implements INameableItem{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
|
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;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -441,7 +441,7 @@ public class ItemDrill extends ItemEnergy implements INameableItem{
|
||||||
@Override
|
@Override
|
||||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
|
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
|
||||||
if(!world.isRemote && player.isSneaking() && stack == player.getCurrentEquippedItem()){
|
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;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue