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;
|
|
|
|
import ellpeck.actuallyadditions.tile.TileEntityBase;
|
|
|
|
import ellpeck.actuallyadditions.tile.TileEntityGrinder;
|
|
|
|
import ellpeck.actuallyadditions.util.Util;
|
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){
|
|
|
|
switch (id){
|
|
|
|
case FEEDER_ID:
|
2015-03-07 02:23:31 +01:00
|
|
|
TileEntityBase tileFeeder = (TileEntityBase)world.getTileEntity(x, y, z);
|
|
|
|
return new ContainerFeeder(entityPlayer.inventory, tileFeeder);
|
2015-02-20 22:45:33 +01:00
|
|
|
case GIANT_CHEST_ID:
|
2015-03-07 02:23:31 +01:00
|
|
|
TileEntityBase tileChest = (TileEntityBase)world.getTileEntity(x, y, z);
|
|
|
|
return new ContainerGiantChest(entityPlayer.inventory, tileChest);
|
|
|
|
case CRAFTER_ID:
|
|
|
|
return new ContainerCrafter(entityPlayer);
|
|
|
|
case GRINDER_ID:
|
|
|
|
TileEntityBase tileGrinder = (TileEntityGrinder)world.getTileEntity(x, y, z);
|
|
|
|
return new ContainerGrinder(entityPlayer.inventory, tileGrinder, false);
|
|
|
|
case GRINDER_DOUBLE_ID:
|
|
|
|
TileEntityBase tileGrinderDouble = (TileEntityGrinder)world.getTileEntity(x, y, z);
|
|
|
|
return new ContainerGrinder(entityPlayer.inventory, tileGrinderDouble, true);
|
|
|
|
case FURNACE_DOUBLE_ID:
|
|
|
|
TileEntityBase tileFurnace = (TileEntityBase)world.getTileEntity(x, y, z);
|
|
|
|
return new ContainerFurnaceDouble(entityPlayer.inventory, tileFurnace);
|
2015-03-19 21:27:56 +01:00
|
|
|
case INPUTTER_ID:
|
|
|
|
TileEntityBase tileInputter = (TileEntityBase)world.getTileEntity(x, y, z);
|
2015-04-04 05:20:19 +02:00
|
|
|
return new ContainerInputter(entityPlayer.inventory, tileInputter, false);
|
|
|
|
case INPUTTER_ADVANCED_ID:
|
|
|
|
TileEntityBase tileInputterAdvanced = (TileEntityBase)world.getTileEntity(x, y, z);
|
|
|
|
return new ContainerInputter(entityPlayer.inventory, tileInputterAdvanced, true);
|
2015-04-02 12:06:42 +02:00
|
|
|
case REPAIRER_ID:
|
|
|
|
TileEntityBase tileRepairer = (TileEntityBase)world.getTileEntity(x, y, z);
|
|
|
|
return new ContainerRepairer(entityPlayer.inventory, tileRepairer);
|
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){
|
|
|
|
switch (id){
|
|
|
|
case FEEDER_ID:
|
2015-03-07 02:23:31 +01:00
|
|
|
TileEntityBase tileFeeder = (TileEntityBase)world.getTileEntity(x, y, z);
|
|
|
|
return new GuiFeeder(entityPlayer.inventory, tileFeeder);
|
2015-02-20 22:45:33 +01:00
|
|
|
case GIANT_CHEST_ID:
|
2015-03-07 02:23:31 +01:00
|
|
|
TileEntityBase tileChest = (TileEntityBase)world.getTileEntity(x, y, z);
|
|
|
|
return new GuiGiantChest(entityPlayer.inventory, tileChest);
|
|
|
|
case CRAFTER_ID:
|
|
|
|
return new GuiCrafter(entityPlayer);
|
|
|
|
case GRINDER_ID:
|
|
|
|
TileEntityBase tileGrinder = (TileEntityGrinder)world.getTileEntity(x, y, z);
|
|
|
|
return new GuiGrinder(entityPlayer.inventory, tileGrinder, false);
|
|
|
|
case GRINDER_DOUBLE_ID:
|
|
|
|
TileEntityBase tileGrinderDouble = (TileEntityGrinder)world.getTileEntity(x, y, z);
|
|
|
|
return new GuiGrinder(entityPlayer.inventory, tileGrinderDouble, true);
|
|
|
|
case FURNACE_DOUBLE_ID:
|
|
|
|
TileEntityBase tileFurnace = (TileEntityBase)world.getTileEntity(x, y, z);
|
|
|
|
return new GuiFurnaceDouble(entityPlayer.inventory, tileFurnace);
|
2015-03-19 21:27:56 +01:00
|
|
|
case INPUTTER_ID:
|
|
|
|
TileEntityBase tileInputter = (TileEntityBase)world.getTileEntity(x, y, z);
|
2015-04-04 05:20:19 +02:00
|
|
|
return new GuiInputter(entityPlayer.inventory, tileInputter, x, y, z, world, false);
|
|
|
|
case INPUTTER_ADVANCED_ID:
|
|
|
|
TileEntityBase tileInputterAdvanced = (TileEntityBase)world.getTileEntity(x, y, z);
|
|
|
|
return new GuiInputter(entityPlayer.inventory, tileInputterAdvanced, x, y, z, world, true);
|
2015-04-02 12:06:42 +02:00
|
|
|
case REPAIRER_ID:
|
|
|
|
TileEntityBase tileRepairer = (TileEntityBase)world.getTileEntity(x, y, z);
|
|
|
|
return new GuiRepairer(entityPlayer.inventory, tileRepairer);
|
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-02-17 16:15:16 +01:00
|
|
|
|
2014-12-18 19:24:06 +01:00
|
|
|
public static void init(){
|
2015-02-09 17:25:05 +01:00
|
|
|
Util.logInfo("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
|
|
|
}
|