2015-03-07 12:51:28 +01:00
|
|
|
package ellpeck.actuallyadditions.inventory;
|
2014-12-18 19:24:06 +01:00
|
|
|
|
2015-02-17 16:15:16 +01:00
|
|
|
import cpw.mods.fml.common.network.IGuiHandler;
|
|
|
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
2015-03-07 12:51:28 +01:00
|
|
|
import ellpeck.actuallyadditions.ActuallyAdditions;
|
2015-06-12 19:12:06 +02:00
|
|
|
import ellpeck.actuallyadditions.inventory.gui.*;
|
2015-03-07 12:51:28 +01:00
|
|
|
import ellpeck.actuallyadditions.tile.TileEntityBase;
|
2015-07-01 21:32:48 +02:00
|
|
|
import ellpeck.actuallyadditions.util.ModUtil;
|
2014-12-18 19:24:06 +01:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.world.World;
|
|
|
|
|
2015-02-09 17:25:05 +01:00
|
|
|
public class GuiHandler implements IGuiHandler{
|
2014-12-18 19:24:06 +01:00
|
|
|
|
2015-02-20 22:45:33 +01:00
|
|
|
@Override
|
2015-02-17 16:15:16 +01:00
|
|
|
public Object getServerGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){
|
2015-06-12 19:12:06 +02:00
|
|
|
TileEntityBase tile = null;
|
2015-06-18 13:14:57 +02:00
|
|
|
if(id != CRAFTER_ID && id != DRILL_ID){
|
2015-06-12 19:12:06 +02:00
|
|
|
tile = (TileEntityBase)world.getTileEntity(x, y, z);
|
|
|
|
}
|
2015-05-20 22:39:43 +02:00
|
|
|
switch(id){
|
2015-02-17 16:15:16 +01:00
|
|
|
case FEEDER_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new ContainerFeeder(entityPlayer.inventory, tile);
|
2015-02-20 22:45:33 +01:00
|
|
|
case GIANT_CHEST_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new ContainerGiantChest(entityPlayer.inventory, tile);
|
2015-03-07 02:23:31 +01:00
|
|
|
case CRAFTER_ID:
|
|
|
|
return new ContainerCrafter(entityPlayer);
|
|
|
|
case GRINDER_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new ContainerGrinder(entityPlayer.inventory, tile, false);
|
2015-03-07 02:23:31 +01:00
|
|
|
case GRINDER_DOUBLE_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new ContainerGrinder(entityPlayer.inventory, tile, true);
|
2015-03-07 02:23:31 +01:00
|
|
|
case FURNACE_DOUBLE_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new ContainerFurnaceDouble(entityPlayer.inventory, tile);
|
2015-03-19 21:27:56 +01:00
|
|
|
case INPUTTER_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new ContainerInputter(entityPlayer.inventory, tile, false);
|
2015-04-04 05:20:19 +02:00
|
|
|
case INPUTTER_ADVANCED_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new ContainerInputter(entityPlayer.inventory, tile, true);
|
2015-04-02 12:06:42 +02:00
|
|
|
case REPAIRER_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new ContainerRepairer(entityPlayer.inventory, tile);
|
2015-04-19 01:50:02 +02:00
|
|
|
case BREAKER_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new ContainerBreaker(entityPlayer.inventory, tile);
|
2015-05-04 17:26:50 +02:00
|
|
|
case DROPPER_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new ContainerDropper(entityPlayer.inventory, tile);
|
2015-05-20 22:39:43 +02:00
|
|
|
case CANOLA_PRESS_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new ContainerCanolaPress(entityPlayer.inventory, tile);
|
2015-05-20 22:39:43 +02:00
|
|
|
case FERMENTING_BARREL_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new ContainerFermentingBarrel(entityPlayer.inventory, tile);
|
2015-05-20 22:39:43 +02:00
|
|
|
case COAL_GENERATOR_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new ContainerCoalGenerator(entityPlayer.inventory, tile);
|
2015-05-20 22:39:43 +02:00
|
|
|
case OIL_GENERATOR_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new ContainerOilGenerator(entityPlayer.inventory, tile);
|
2015-05-25 17:00:54 +02:00
|
|
|
case PHANTOM_PLACER_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new ContainerPhantomPlacer(entityPlayer.inventory, tile);
|
2015-05-30 17:47:57 +02:00
|
|
|
case FLUID_COLLECTOR_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new ContainerFluidCollector(entityPlayer.inventory, tile);
|
|
|
|
case COFFEE_MACHINE_ID:
|
|
|
|
return new ContainerCoffeeMachine(entityPlayer.inventory, tile);
|
2015-06-21 02:28:49 +02:00
|
|
|
case DRILL_ID:
|
|
|
|
return new ContainerDrill(entityPlayer.inventory);
|
|
|
|
case ENERGIZER_ID:
|
|
|
|
return new ContainerEnergizer(entityPlayer.inventory, tile);
|
|
|
|
case ENERVATOR_ID:
|
|
|
|
return new ContainerEnervator(entityPlayer.inventory, tile);
|
2014-12-18 19:24:06 +01:00
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-20 22:45:33 +01:00
|
|
|
@Override
|
2015-02-17 16:15:16 +01:00
|
|
|
public Object getClientGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){
|
2015-06-12 19:12:06 +02:00
|
|
|
TileEntityBase tile = null;
|
2015-06-18 13:14:57 +02:00
|
|
|
if(id != CRAFTER_ID && id != DRILL_ID){
|
2015-06-12 19:12:06 +02:00
|
|
|
tile = (TileEntityBase)world.getTileEntity(x, y, z);
|
|
|
|
}
|
2015-05-20 22:39:43 +02:00
|
|
|
switch(id){
|
2015-02-17 16:15:16 +01:00
|
|
|
case FEEDER_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new GuiFeeder(entityPlayer.inventory, tile);
|
2015-02-20 22:45:33 +01:00
|
|
|
case GIANT_CHEST_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new GuiGiantChest(entityPlayer.inventory, tile);
|
2015-03-07 02:23:31 +01:00
|
|
|
case CRAFTER_ID:
|
|
|
|
return new GuiCrafter(entityPlayer);
|
|
|
|
case GRINDER_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new GuiGrinder(entityPlayer.inventory, tile, false);
|
2015-03-07 02:23:31 +01:00
|
|
|
case GRINDER_DOUBLE_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new GuiGrinder(entityPlayer.inventory, tile, true);
|
2015-03-07 02:23:31 +01:00
|
|
|
case FURNACE_DOUBLE_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new GuiFurnaceDouble(entityPlayer.inventory, tile);
|
2015-03-19 21:27:56 +01:00
|
|
|
case INPUTTER_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new GuiInputter(entityPlayer.inventory, tile, x, y, z, world, false);
|
2015-04-04 05:20:19 +02:00
|
|
|
case INPUTTER_ADVANCED_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new GuiInputter(entityPlayer.inventory, tile, x, y, z, world, true);
|
2015-04-02 12:06:42 +02:00
|
|
|
case REPAIRER_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new GuiRepairer(entityPlayer.inventory, tile);
|
2015-04-19 01:50:02 +02:00
|
|
|
case BREAKER_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new GuiBreaker(entityPlayer.inventory, tile);
|
2015-05-04 17:26:50 +02:00
|
|
|
case DROPPER_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new GuiDropper(entityPlayer.inventory, tile);
|
2015-05-20 22:39:43 +02:00
|
|
|
case CANOLA_PRESS_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new GuiCanolaPress(entityPlayer.inventory, tile);
|
2015-05-20 22:39:43 +02:00
|
|
|
case FERMENTING_BARREL_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new GuiFermentingBarrel(entityPlayer.inventory, tile);
|
2015-05-20 22:39:43 +02:00
|
|
|
case COAL_GENERATOR_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new GuiCoalGenerator(entityPlayer.inventory, tile);
|
2015-05-20 22:39:43 +02:00
|
|
|
case OIL_GENERATOR_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new GuiOilGenerator(entityPlayer.inventory, tile);
|
2015-05-25 17:00:54 +02:00
|
|
|
case PHANTOM_PLACER_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new GuiPhantomPlacer(entityPlayer.inventory, tile);
|
2015-05-30 17:47:57 +02:00
|
|
|
case FLUID_COLLECTOR_ID:
|
2015-06-12 19:12:06 +02:00
|
|
|
return new GuiFluidCollector(entityPlayer.inventory, tile);
|
|
|
|
case COFFEE_MACHINE_ID:
|
|
|
|
return new GuiCoffeeMachine(entityPlayer.inventory, tile, x, y, z, world);
|
2015-06-21 02:28:49 +02:00
|
|
|
case DRILL_ID:
|
|
|
|
return new GuiDrill(entityPlayer.inventory);
|
|
|
|
case ENERGIZER_ID:
|
|
|
|
return new GuiEnergizer(entityPlayer.inventory, tile);
|
|
|
|
case ENERVATOR_ID:
|
|
|
|
return new GuiEnervator(entityPlayer.inventory, tile);
|
2014-12-18 19:24:06 +01:00
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-17 16:15:16 +01:00
|
|
|
public static final int FEEDER_ID = 0;
|
2015-02-20 22:45:33 +01:00
|
|
|
public static final int GIANT_CHEST_ID = 1;
|
2015-03-07 02:23:31 +01:00
|
|
|
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;
|
2015-03-19 21:27:56 +01:00
|
|
|
public static final int INPUTTER_ID = 6;
|
2015-04-02 12:06:42 +02:00
|
|
|
public static final int REPAIRER_ID = 7;
|
2015-04-04 05:20:19 +02:00
|
|
|
public static final int INPUTTER_ADVANCED_ID = 8;
|
2015-04-19 01:50:02 +02:00
|
|
|
public static final int BREAKER_ID = 9;
|
2015-05-04 17:26:50 +02:00
|
|
|
public static final int DROPPER_ID = 10;
|
2015-05-20 22:39:43 +02:00
|
|
|
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;
|
2015-05-25 17:00:54 +02:00
|
|
|
public static final int PHANTOM_PLACER_ID = 15;
|
2015-05-30 17:47:57 +02:00
|
|
|
public static final int FLUID_COLLECTOR_ID = 16;
|
2015-06-12 19:12:06 +02:00
|
|
|
public static final int COFFEE_MACHINE_ID = 17;
|
2015-06-15 22:06:07 +02:00
|
|
|
public static final int DRILL_ID = 18;
|
2015-06-21 02:28:49 +02:00
|
|
|
public static final int ENERGIZER_ID = 19;
|
|
|
|
public static final int ENERVATOR_ID = 20;
|
2015-02-17 16:15:16 +01:00
|
|
|
|
2014-12-18 19:24:06 +01:00
|
|
|
public static void init(){
|
2015-07-01 21:32:48 +02:00
|
|
|
ModUtil.LOGGER.info("Initializing GuiHandler...");
|
2015-03-07 12:51:28 +01:00
|
|
|
NetworkRegistry.INSTANCE.registerGuiHandler(ActuallyAdditions.instance, new GuiHandler());
|
2014-12-18 19:24:06 +01:00
|
|
|
}
|
2015-02-20 22:45:33 +01:00
|
|
|
}
|