2015-04-10 00:17:30 +02:00
|
|
|
package techreborn.client;
|
|
|
|
|
2015-11-23 19:41:29 +01:00
|
|
|
import net.minecraft.util.BlockPos;
|
2015-11-23 15:40:30 +01:00
|
|
|
import net.minecraftforge.fml.common.network.IGuiHandler;
|
2015-04-10 00:17:30 +02:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.world.World;
|
2015-07-13 14:54:44 +02:00
|
|
|
import techreborn.client.container.*;
|
|
|
|
import techreborn.client.gui.*;
|
2015-08-10 19:30:19 +02:00
|
|
|
import techreborn.pda.GuiManual;
|
2015-07-13 14:54:44 +02:00
|
|
|
import techreborn.tiles.*;
|
2015-11-16 16:20:13 +01:00
|
|
|
import techreborn.tiles.fusionReactor.TileEntityFusionController;
|
2015-06-17 18:01:26 +02:00
|
|
|
import techreborn.tiles.idsu.TileIDSU;
|
2015-06-14 17:42:03 +02:00
|
|
|
import techreborn.tiles.lesu.TileLesu;
|
2015-04-10 00:17:30 +02:00
|
|
|
|
|
|
|
public class GuiHandler implements IGuiHandler {
|
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
public static final int thermalGeneratorID = 0;
|
|
|
|
public static final int quantumTankID = 1;
|
|
|
|
public static final int quantumChestID = 2;
|
|
|
|
public static final int centrifugeID = 3;
|
|
|
|
public static final int rollingMachineID = 4;
|
|
|
|
public static final int blastFurnaceID = 5;
|
|
|
|
public static final int alloySmelterID = 6;
|
|
|
|
public static final int grinderID = 7;
|
|
|
|
public static final int compresserID = 8;
|
|
|
|
public static final int matterfabID = 9;
|
|
|
|
public static final int pdaID = 10;
|
|
|
|
public static final int chunkloaderID = 11;
|
2015-11-01 17:24:35 +01:00
|
|
|
public static final int assemblingmachineID = 12;
|
2015-08-09 12:05:32 +02:00
|
|
|
public static final int dieselGeneratorID = 15;
|
|
|
|
public static final int industrialElectrolyzerID = 16;
|
|
|
|
public static final int aesuID = 17;
|
|
|
|
public static final int alloyFurnaceID = 18;
|
|
|
|
public static final int sawMillID = 19;
|
|
|
|
public static final int chemicalReactorID = 20;
|
|
|
|
public static final int semifluidGeneratorID = 21;
|
|
|
|
public static final int gasTurbineID = 22;
|
|
|
|
public static final int digitalChestID = 23;
|
|
|
|
public static final int destructoPackID = 25;
|
2015-06-14 17:42:03 +02:00
|
|
|
public static final int lesuID = 26;
|
2015-08-09 12:05:32 +02:00
|
|
|
public static final int idsuID = 27;
|
|
|
|
public static final int chargeBench = 28;
|
2015-11-16 16:20:13 +01:00
|
|
|
public static final int fusionID = 29;
|
2015-11-17 22:48:06 +01:00
|
|
|
public static final int vacuumFreezerID = 30;
|
2015-08-09 12:05:32 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public Object getServerGuiElement(int ID, EntityPlayer player, World world,
|
|
|
|
int x, int y, int z) {
|
|
|
|
if (ID == thermalGeneratorID) {
|
|
|
|
return new ContainerThermalGenerator(
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileThermalGenerator) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == semifluidGeneratorID) {
|
|
|
|
return new ContainerSemifluidGenerator(
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileSemifluidGenerator) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == gasTurbineID) {
|
|
|
|
return new ContainerGasTurbine(
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileGasTurbine) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == quantumTankID) {
|
|
|
|
return new ContainerQuantumTank(
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileQuantumTank) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == digitalChestID) {
|
|
|
|
return new ContainerDigitalChest(
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileDigitalChest) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == quantumChestID) {
|
|
|
|
return new ContainerQuantumChest(
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileQuantumChest) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == centrifugeID) {
|
|
|
|
return new ContainerCentrifuge(
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileCentrifuge) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == rollingMachineID) {
|
|
|
|
return new ContainerRollingMachine(
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileRollingMachine) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == blastFurnaceID) {
|
|
|
|
return new ContainerBlastFurnace(
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileBlastFurnace) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == alloySmelterID) {
|
|
|
|
return new ContainerAlloySmelter(
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileAlloySmelter) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == grinderID) {
|
|
|
|
return new ContainerGrinder(
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileGrinder) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == compresserID) {
|
|
|
|
return new ContainerImplosionCompressor(
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileImplosionCompressor) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == matterfabID) {
|
|
|
|
return new ContainerMatterFabricator(
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileMatterFabricator) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == chunkloaderID) {
|
|
|
|
return new ContainerChunkloader(
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileChunkLoader) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-11-01 17:24:35 +01:00
|
|
|
} else if (ID == assemblingmachineID) {
|
|
|
|
return new ContainerAssemblingMachine(
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileAssemblingMachine) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-11-08 13:15:45 +01:00
|
|
|
} else if (ID == dieselGeneratorID) {
|
2015-08-09 12:05:32 +02:00
|
|
|
return new ContainerDieselGenerator(
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileDieselGenerator) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == industrialElectrolyzerID) {
|
|
|
|
return new ContainerIndustrialElectrolyzer(
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileIndustrialElectrolyzer) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == aesuID) {
|
|
|
|
return new ContainerAesu(
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileAesu) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == alloyFurnaceID) {
|
|
|
|
return new ContainerAlloyFurnace(
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == sawMillID) {
|
|
|
|
return new ContainerIndustrialSawmill(
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileIndustrialSawmill) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == chemicalReactorID) {
|
|
|
|
return new ContainerChemicalReactor(
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileChemicalReactor) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == pdaID) {
|
|
|
|
return null;
|
|
|
|
} else if (ID == destructoPackID) {
|
|
|
|
return new ContainerDestructoPack(player);
|
|
|
|
} else if (ID == lesuID) {
|
2015-11-23 19:41:29 +01:00
|
|
|
return new ContainerLesu((TileLesu) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-06-16 14:38:46 +02:00
|
|
|
} else if (ID == idsuID) {
|
2015-11-23 19:41:29 +01:00
|
|
|
return new ContainerIDSU((TileIDSU) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-06-29 19:03:40 +02:00
|
|
|
} else if (ID == chargeBench) {
|
2015-11-23 19:41:29 +01:00
|
|
|
return new ContainerChargeBench((TileChargeBench) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-11-16 16:20:13 +01:00
|
|
|
} else if (ID == fusionID) {
|
2015-11-23 19:41:29 +01:00
|
|
|
return new ContainerFusionReactor((TileEntityFusionController) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-11-17 22:48:06 +01:00
|
|
|
}else if (ID == vacuumFreezerID) {
|
2015-11-23 19:41:29 +01:00
|
|
|
return new ContainerVacuumFreezer((TileVacuumFreezer) world.getTileEntity(new BlockPos(x, y, z)), player);
|
2015-07-13 14:54:44 +02:00
|
|
|
}
|
2015-04-11 11:37:47 +02:00
|
|
|
|
2015-04-10 00:17:30 +02:00
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Object getClientGuiElement(int ID, EntityPlayer player, World world,
|
|
|
|
int x, int y, int z) {
|
|
|
|
if (ID == thermalGeneratorID) {
|
|
|
|
return new GuiThermalGenerator(player,
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileThermalGenerator) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == semifluidGeneratorID) {
|
|
|
|
return new GuiSemifluidGenerator(player,
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileSemifluidGenerator) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == gasTurbineID) {
|
|
|
|
return new GuiGasTurbine(player,
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileGasTurbine) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == quantumTankID) {
|
|
|
|
return new GuiQuantumTank(player,
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileQuantumTank) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == digitalChestID) {
|
|
|
|
return new GuiDigitalChest(player,
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileDigitalChest) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == quantumChestID) {
|
|
|
|
return new GuiQuantumChest(player,
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileQuantumChest) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == centrifugeID) {
|
|
|
|
return new GuiCentrifuge(player,
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileCentrifuge) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == rollingMachineID) {
|
|
|
|
return new GuiRollingMachine(player,
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileRollingMachine) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == blastFurnaceID) {
|
|
|
|
return new GuiBlastFurnace(player,
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileBlastFurnace) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == alloySmelterID) {
|
|
|
|
return new GuiAlloySmelter(player,
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileAlloySmelter) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == grinderID) {
|
|
|
|
return new GuiGrinder(player,
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileGrinder) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == compresserID) {
|
|
|
|
return new GuiImplosionCompressor(player,
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileImplosionCompressor) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == matterfabID) {
|
|
|
|
return new GuiMatterFabricator(player,
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileMatterFabricator) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == chunkloaderID) {
|
|
|
|
return new GuiChunkLoader(player,
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileChunkLoader) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-11-01 17:24:35 +01:00
|
|
|
} else if (ID == assemblingmachineID) {
|
|
|
|
return new GuiAssemblingMachine(player,
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileAssemblingMachine) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-11-08 13:15:45 +01:00
|
|
|
} else if (ID == dieselGeneratorID) {
|
2015-08-09 12:05:32 +02:00
|
|
|
return new GuiDieselGenerator(player,
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileDieselGenerator) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == industrialElectrolyzerID) {
|
|
|
|
return new GuiIndustrialElectrolyzer(player,
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileIndustrialElectrolyzer) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == aesuID) {
|
|
|
|
return new GuiAesu(player,
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileAesu) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == alloyFurnaceID) {
|
|
|
|
return new GuiAlloyFurnace(player,
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == sawMillID) {
|
|
|
|
return new GuiIndustrialSawmill(player,
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileIndustrialSawmill) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == chemicalReactorID) {
|
|
|
|
return new GuiChemicalReactor(player,
|
2015-11-23 19:41:29 +01:00
|
|
|
(TileChemicalReactor) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == pdaID) {
|
2015-08-10 19:30:19 +02:00
|
|
|
return new GuiManual();
|
2015-08-09 12:05:32 +02:00
|
|
|
} else if (ID == destructoPackID) {
|
|
|
|
return new GuiDestructoPack(new ContainerDestructoPack(player));
|
|
|
|
} else if (ID == lesuID) {
|
2015-11-23 19:41:29 +01:00
|
|
|
return new GuiLesu(player, (TileLesu) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-06-16 14:38:46 +02:00
|
|
|
} else if (ID == idsuID) {
|
2015-11-23 19:41:29 +01:00
|
|
|
return new GuiIDSU(player, (TileIDSU) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-06-29 19:03:40 +02:00
|
|
|
} else if (ID == chargeBench) {
|
2015-11-23 19:41:29 +01:00
|
|
|
return new GuiChargeBench(player, (TileChargeBench) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-11-16 16:20:13 +01:00
|
|
|
}else if (ID == fusionID) {
|
2015-11-23 19:41:29 +01:00
|
|
|
return new GuiFusionReactor(player, (TileEntityFusionController) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-11-17 22:48:06 +01:00
|
|
|
}else if (ID == vacuumFreezerID) {
|
2015-11-23 19:41:29 +01:00
|
|
|
return new GuiVacuumFreezer(player, (TileVacuumFreezer) world.getTileEntity(new BlockPos(x, y, z)));
|
2015-07-13 14:54:44 +02:00
|
|
|
}
|
2015-08-09 12:05:32 +02:00
|
|
|
return null;
|
|
|
|
}
|
2015-04-10 00:17:30 +02:00
|
|
|
}
|