mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-23 03:49:22 +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){
|
||||
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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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...");
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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