Added code formatter

This commit is contained in:
modmuss50 2016-03-24 00:39:26 +00:00
parent 710f9c04e7
commit b9448d5d90
444 changed files with 32383 additions and 26254 deletions

View file

@ -1,70 +1,62 @@
package techreborn.client;
import net.minecraft.util.EnumFacing;
import reborncore.client.multiblock.Multiblock;
import techreborn.init.ModBlocks;
public class ClientMultiBlocks {
public class ClientMultiBlocks
{
public static Multiblock reactor;
public static Multiblock frezzer;
public static Multiblock reactor;
public static Multiblock frezzer;
public static void init(){
reactor = new Multiblock();
checkCoils();
public static void init()
{
reactor = new Multiblock();
checkCoils();
frezzer = new Multiblock();
checkMachine();
}
frezzer = new Multiblock();
checkMachine();
}
public static void checkCoils()
{
if ((isCoil(3, 0, 1)) && (isCoil(3, 0, 0)) && (isCoil(3, 0, 0 - 1)) && (isCoil(0 - 3, 0, 1))
&& (isCoil(0 - 3, 0, 0)) && (isCoil(0 - 3, 0, 0 - 1)) && (isCoil(2, 0, 2)) && (isCoil(2, 0, 1))
&& (isCoil(2, 0, 0 - 1)) && (isCoil(2, 0, 0 - 2)) && (isCoil(0 - 2, 0, 2)) && (isCoil(0 - 2, 0, 1))
&& (isCoil(0 - 2, 0, 0 - 1)) && (isCoil(0 - 2, 0, 0 - 2)) && (isCoil(1, 0, 3)) && (isCoil(1, 0, 2))
&& (isCoil(1, 0, 0 - 2)) && (isCoil(1, 0, 0 - 3)) && (isCoil(0 - 1, 0, 3)) && (isCoil(0 - 1, 0, 2))
&& (isCoil(0 - 1, 0, 0 - 2)) && (isCoil(0 - 1, 0, 0 - 3)) && (isCoil(0, 0, 3)) && (isCoil(0, 0, 0 - 3)))
{
}
}
public static void checkCoils() {
if ((isCoil(3, 0, 1)) &&
(isCoil(3, 0, 0)) &&
(isCoil(3, 0, 0 - 1)) &&
(isCoil(0 - 3, 0, 1)) &&
(isCoil(0 - 3, 0, 0)) &&
(isCoil(0 - 3, 0, 0 - 1)) &&
(isCoil(2, 0, 2)) &&
(isCoil(2, 0, 1)) &&
(isCoil(2, 0, 0 - 1)) &&
(isCoil(2, 0, 0 - 2)) &&
(isCoil(0 - 2, 0, 2)) &&
(isCoil(0 - 2, 0, 1)) &&
(isCoil(0 - 2, 0, 0 - 1)) &&
(isCoil(0 - 2, 0, 0 - 2)) &&
(isCoil(1, 0, 3)) &&
(isCoil(1, 0, 2)) &&
(isCoil(1, 0, 0 - 2)) &&
(isCoil(1, 0, 0 - 3)) &&
(isCoil(0 - 1, 0, 3)) &&
(isCoil(0 - 1, 0, 2)) &&
(isCoil(0 - 1, 0, 0 - 2)) &&
(isCoil(0 - 1, 0, 0 - 3)) &&
(isCoil(0, 0, 3)) &&
(isCoil(0, 0, 0 - 3))) {
}
}
private static boolean isCoil(int x, int y, int z)
{
reactor.addComponent(x, y, z, ModBlocks.FusionCoil, 0);
return true;
}
private static boolean isCoil(int x, int y, int z) {
reactor.addComponent(x, y, z, ModBlocks.FusionCoil, 0);
return true;
}
public static void checkMachine()
{
int xDir = EnumFacing.UP.getFrontOffsetX() * 2;
int yDir = EnumFacing.UP.getFrontOffsetY() * 2;
int zDir = EnumFacing.UP.getFrontOffsetZ() * 2;
for (int i = -1; i < 2; i++)
{
for (int j = -1; j < 2; j++)
{
for (int k = -1; k < 2; k++)
{
if ((i != 0) || (j != 0) || (k != 0))
{
frezzer.addComponent(xDir + i, yDir + j, zDir + k, ModBlocks.MachineCasing,
(((i == 0) && (j == 0) && (k != 0)) || ((i == 0) && (j != 0) && (k == 0))
|| ((i != 0) && (j == 0) && (k == 0)) ? 2 : 1));
}
}
}
}
}
public static void checkMachine() {
int xDir = EnumFacing.UP.getFrontOffsetX() * 2;
int yDir = EnumFacing.UP.getFrontOffsetY() * 2;
int zDir = EnumFacing.UP.getFrontOffsetZ() * 2;
for (int i = -1; i < 2; i++) {
for (int j = -1; j < 2; j++) {
for (int k = -1; k < 2; k++) {
if ((i != 0) || (j != 0) || (k != 0)) {
frezzer.addComponent(xDir + i, yDir + j, zDir + k, ModBlocks.MachineCasing, (((i == 0) && (j == 0) && (k != 0)) || ((i == 0) && (j != 0) && (k == 0)) || ((i != 0) && (j == 0) && (k == 0)) ? 2 : 1));
}
}
}
}
}
}

View file

@ -4,258 +4,405 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;
import techreborn.client.container.*;
import techreborn.client.gui.*;
import techreborn.client.container.ContainerAesu;
import techreborn.client.container.ContainerAlloyFurnace;
import techreborn.client.container.ContainerAlloySmelter;
import techreborn.client.container.ContainerAssemblingMachine;
import techreborn.client.container.ContainerBatbox;
import techreborn.client.container.ContainerBlastFurnace;
import techreborn.client.container.ContainerCentrifuge;
import techreborn.client.container.ContainerChargeBench;
import techreborn.client.container.ContainerChemicalReactor;
import techreborn.client.container.ContainerChunkloader;
import techreborn.client.container.ContainerCompressor;
import techreborn.client.container.ContainerDestructoPack;
import techreborn.client.container.ContainerDieselGenerator;
import techreborn.client.container.ContainerDigitalChest;
import techreborn.client.container.ContainerElectricFurnace;
import techreborn.client.container.ContainerExtractor;
import techreborn.client.container.ContainerFusionReactor;
import techreborn.client.container.ContainerGasTurbine;
import techreborn.client.container.ContainerGenerator;
import techreborn.client.container.ContainerGrinder;
import techreborn.client.container.ContainerIDSU;
import techreborn.client.container.ContainerImplosionCompressor;
import techreborn.client.container.ContainerIndustrialElectrolyzer;
import techreborn.client.container.ContainerIndustrialGrinder;
import techreborn.client.container.ContainerIndustrialSawmill;
import techreborn.client.container.ContainerIronFurnace;
import techreborn.client.container.ContainerLesu;
import techreborn.client.container.ContainerMatterFabricator;
import techreborn.client.container.ContainerQuantumChest;
import techreborn.client.container.ContainerQuantumTank;
import techreborn.client.container.ContainerRecycler;
import techreborn.client.container.ContainerRollingMachine;
import techreborn.client.container.ContainerScrapboxinator;
import techreborn.client.container.ContainerSemifluidGenerator;
import techreborn.client.container.ContainerThermalGenerator;
import techreborn.client.container.ContainerVacuumFreezer;
import techreborn.client.gui.GuiAesu;
import techreborn.client.gui.GuiAlloyFurnace;
import techreborn.client.gui.GuiAlloySmelter;
import techreborn.client.gui.GuiAssemblingMachine;
import techreborn.client.gui.GuiBatbox;
import techreborn.client.gui.GuiBlastFurnace;
import techreborn.client.gui.GuiCentrifuge;
import techreborn.client.gui.GuiChargeBench;
import techreborn.client.gui.GuiChemicalReactor;
import techreborn.client.gui.GuiChunkLoader;
import techreborn.client.gui.GuiCompressor;
import techreborn.client.gui.GuiDestructoPack;
import techreborn.client.gui.GuiDieselGenerator;
import techreborn.client.gui.GuiDigitalChest;
import techreborn.client.gui.GuiElectricFurnace;
import techreborn.client.gui.GuiExtractor;
import techreborn.client.gui.GuiFusionReactor;
import techreborn.client.gui.GuiGasTurbine;
import techreborn.client.gui.GuiGenerator;
import techreborn.client.gui.GuiGrinder;
import techreborn.client.gui.GuiIDSU;
import techreborn.client.gui.GuiImplosionCompressor;
import techreborn.client.gui.GuiIndustrialElectrolyzer;
import techreborn.client.gui.GuiIndustrialGrinder;
import techreborn.client.gui.GuiIndustrialSawmill;
import techreborn.client.gui.GuiIronFurnace;
import techreborn.client.gui.GuiLesu;
import techreborn.client.gui.GuiMatterFabricator;
import techreborn.client.gui.GuiQuantumChest;
import techreborn.client.gui.GuiQuantumTank;
import techreborn.client.gui.GuiRecycler;
import techreborn.client.gui.GuiRollingMachine;
import techreborn.client.gui.GuiScrapboxinator;
import techreborn.client.gui.GuiSemifluidGenerator;
import techreborn.client.gui.GuiThermalGenerator;
import techreborn.client.gui.GuiVacuumFreezer;
import techreborn.manual.GuiManual;
import techreborn.tiles.*;
import techreborn.tiles.TileAesu;
import techreborn.tiles.TileAlloyFurnace;
import techreborn.tiles.TileAlloySmelter;
import techreborn.tiles.TileAssemblingMachine;
import techreborn.tiles.TileBlastFurnace;
import techreborn.tiles.TileCentrifuge;
import techreborn.tiles.TileChargeBench;
import techreborn.tiles.TileChemicalReactor;
import techreborn.tiles.TileChunkLoader;
import techreborn.tiles.TileDigitalChest;
import techreborn.tiles.TileImplosionCompressor;
import techreborn.tiles.TileIndustrialElectrolyzer;
import techreborn.tiles.TileIndustrialGrinder;
import techreborn.tiles.TileIndustrialSawmill;
import techreborn.tiles.TileIronFurnace;
import techreborn.tiles.TileMatterFabricator;
import techreborn.tiles.TileQuantumChest;
import techreborn.tiles.TileQuantumTank;
import techreborn.tiles.TileRollingMachine;
import techreborn.tiles.TileScrapboxinator;
import techreborn.tiles.TileVacuumFreezer;
import techreborn.tiles.fusionReactor.TileEntityFusionController;
import techreborn.tiles.generator.*;
import techreborn.tiles.generator.TileDieselGenerator;
import techreborn.tiles.generator.TileGasTurbine;
import techreborn.tiles.generator.TileGenerator;
import techreborn.tiles.generator.TileSemifluidGenerator;
import techreborn.tiles.generator.TileThermalGenerator;
import techreborn.tiles.idsu.TileIDSU;
import techreborn.tiles.lesu.TileLesu;
import techreborn.tiles.storage.TileBatBox;
import techreborn.tiles.teir1.*;
import techreborn.tiles.teir1.TileCompressor;
import techreborn.tiles.teir1.TileElectricFurnace;
import techreborn.tiles.teir1.TileExtractor;
import techreborn.tiles.teir1.TileGrinder;
import techreborn.tiles.teir1.TileRecycler;
public class GuiHandler implements IGuiHandler {
public class GuiHandler implements IGuiHandler
{
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 industrialGrinderID = 7;
public static final int implosionCompresserID = 8;
public static final int matterfabID = 9;
public static final int manuelID = 10;
public static final int chunkloaderID = 11;
public static final int assemblingmachineID = 12;
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;
public static final int lesuID = 26;
public static final int idsuID = 27;
public static final int chargeBench = 28;
public static final int fusionID = 29;
public static final int vacuumFreezerID = 30;
public static final int grinderID = 31;
public static final int generatorID = 32;
public static final int extractorID = 33;
public static final int compressorID = 34;
public static final int electricFurnaceID = 35;
public static final int ironFurnace = 36;
public static final int recyclerID = 37;
public static final int scrapboxinatorID = 38;
public static final int batboxID = 39;
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 industrialGrinderID = 7;
public static final int implosionCompresserID = 8;
public static final int matterfabID = 9;
public static final int manuelID = 10;
public static final int chunkloaderID = 11;
public static final int assemblingmachineID = 12;
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;
public static final int lesuID = 26;
public static final int idsuID = 27;
public static final int chargeBench = 28;
public static final int fusionID = 29;
public static final int vacuumFreezerID = 30;
public static final int grinderID = 31;
public static final int generatorID = 32;
public static final int extractorID = 33;
public static final int compressorID = 34;
public static final int electricFurnaceID = 35;
public static final int ironFurnace = 36;
public static final int recyclerID = 37;
public static final int scrapboxinatorID = 38;
public static final int batboxID = 39;
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
if (ID == thermalGeneratorID)
{
return new ContainerThermalGenerator((TileThermalGenerator) world.getTileEntity(new BlockPos(x, y, z)),
player);
} else if (ID == semifluidGeneratorID)
{
return new ContainerSemifluidGenerator((TileSemifluidGenerator) world.getTileEntity(new BlockPos(x, y, z)),
player);
} else if (ID == gasTurbineID)
{
return new ContainerGasTurbine((TileGasTurbine) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == quantumTankID)
{
return new ContainerQuantumTank((TileQuantumTank) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == digitalChestID)
{
return new ContainerDigitalChest((TileDigitalChest) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == quantumChestID)
{
return new ContainerQuantumChest((TileQuantumChest) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == centrifugeID)
{
return new ContainerCentrifuge((TileCentrifuge) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == rollingMachineID)
{
return new ContainerRollingMachine((TileRollingMachine) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == blastFurnaceID)
{
return new ContainerBlastFurnace((TileBlastFurnace) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == alloySmelterID)
{
return new ContainerAlloySmelter((TileAlloySmelter) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == industrialGrinderID)
{
return new ContainerIndustrialGrinder((TileIndustrialGrinder) world.getTileEntity(new BlockPos(x, y, z)),
player);
} else if (ID == implosionCompresserID)
{
return new ContainerImplosionCompressor(
(TileImplosionCompressor) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == matterfabID)
{
return new ContainerMatterFabricator((TileMatterFabricator) world.getTileEntity(new BlockPos(x, y, z)),
player);
} else if (ID == chunkloaderID)
{
return new ContainerChunkloader((TileChunkLoader) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == assemblingmachineID)
{
return new ContainerAssemblingMachine((TileAssemblingMachine) world.getTileEntity(new BlockPos(x, y, z)),
player);
} else if (ID == dieselGeneratorID)
{
return new ContainerDieselGenerator((TileDieselGenerator) world.getTileEntity(new BlockPos(x, y, z)),
player);
} else if (ID == industrialElectrolyzerID)
{
return new ContainerIndustrialElectrolyzer(
(TileIndustrialElectrolyzer) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == aesuID)
{
return new ContainerAesu((TileAesu) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == alloyFurnaceID)
{
return new ContainerAlloyFurnace((TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == sawMillID)
{
return new ContainerIndustrialSawmill((TileIndustrialSawmill) world.getTileEntity(new BlockPos(x, y, z)),
player);
} else if (ID == chemicalReactorID)
{
return new ContainerChemicalReactor((TileChemicalReactor) world.getTileEntity(new BlockPos(x, y, z)),
player);
} else if (ID == manuelID)
{
return null;
} else if (ID == destructoPackID)
{
return new ContainerDestructoPack(player);
} else if (ID == lesuID)
{
return new ContainerLesu((TileLesu) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == idsuID)
{
return new ContainerIDSU((TileIDSU) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == chargeBench)
{
return new ContainerChargeBench((TileChargeBench) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == fusionID)
{
return new ContainerFusionReactor((TileEntityFusionController) world.getTileEntity(new BlockPos(x, y, z)),
player);
} else if (ID == vacuumFreezerID)
{
return new ContainerVacuumFreezer((TileVacuumFreezer) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == grinderID)
{
return new ContainerGrinder((TileGrinder) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == generatorID)
{
return new ContainerGenerator((TileGenerator) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == extractorID)
{
return new ContainerExtractor((TileExtractor) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == compressorID)
{
return new ContainerCompressor((TileCompressor) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == electricFurnaceID)
{
return new ContainerElectricFurnace((TileElectricFurnace) world.getTileEntity(new BlockPos(x, y, z)),
player);
} else if (ID == ironFurnace)
{
return new ContainerIronFurnace((TileIronFurnace) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == recyclerID)
{
return new ContainerRecycler((TileRecycler) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == scrapboxinatorID)
{
return new ContainerScrapboxinator((TileScrapboxinator) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == batboxID)
{
return new ContainerBatbox((TileBatBox) world.getTileEntity(new BlockPos(x, y, z)), player);
}
return null;
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
if (ID == thermalGeneratorID) {
return new ContainerThermalGenerator(
(TileThermalGenerator) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == semifluidGeneratorID) {
return new ContainerSemifluidGenerator(
(TileSemifluidGenerator) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == gasTurbineID) {
return new ContainerGasTurbine(
(TileGasTurbine) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == quantumTankID) {
return new ContainerQuantumTank(
(TileQuantumTank) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == digitalChestID) {
return new ContainerDigitalChest(
(TileDigitalChest) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == quantumChestID) {
return new ContainerQuantumChest(
(TileQuantumChest) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == centrifugeID) {
return new ContainerCentrifuge(
(TileCentrifuge) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == rollingMachineID) {
return new ContainerRollingMachine(
(TileRollingMachine) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == blastFurnaceID) {
return new ContainerBlastFurnace(
(TileBlastFurnace) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == alloySmelterID) {
return new ContainerAlloySmelter(
(TileAlloySmelter) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == industrialGrinderID) {
return new ContainerIndustrialGrinder(
(TileIndustrialGrinder) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == implosionCompresserID) {
return new ContainerImplosionCompressor(
(TileImplosionCompressor) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == matterfabID) {
return new ContainerMatterFabricator(
(TileMatterFabricator) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == chunkloaderID) {
return new ContainerChunkloader(
(TileChunkLoader) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == assemblingmachineID) {
return new ContainerAssemblingMachine(
(TileAssemblingMachine) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == dieselGeneratorID) {
return new ContainerDieselGenerator(
(TileDieselGenerator) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == industrialElectrolyzerID) {
return new ContainerIndustrialElectrolyzer(
(TileIndustrialElectrolyzer) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == aesuID) {
return new ContainerAesu(
(TileAesu) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == alloyFurnaceID) {
return new ContainerAlloyFurnace(
(TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == sawMillID) {
return new ContainerIndustrialSawmill(
(TileIndustrialSawmill) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == chemicalReactorID) {
return new ContainerChemicalReactor(
(TileChemicalReactor) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == manuelID) {
return null;
} else if (ID == destructoPackID) {
return new ContainerDestructoPack(player);
} else if (ID == lesuID) {
return new ContainerLesu((TileLesu) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == idsuID) {
return new ContainerIDSU((TileIDSU) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == chargeBench) {
return new ContainerChargeBench((TileChargeBench) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == fusionID) {
return new ContainerFusionReactor((TileEntityFusionController) world.getTileEntity(new BlockPos(x, y, z)), player);
}else if (ID == vacuumFreezerID) {
return new ContainerVacuumFreezer((TileVacuumFreezer) world.getTileEntity(new BlockPos(x, y, z)), player);
}else if (ID == grinderID) {
return new ContainerGrinder((TileGrinder) world.getTileEntity(new BlockPos(x, y, z)), player);
}else if (ID == generatorID) {
return new ContainerGenerator((TileGenerator) world.getTileEntity(new BlockPos(x, y, z)), player);
}else if (ID == extractorID) {
return new ContainerExtractor((TileExtractor) world.getTileEntity(new BlockPos(x, y, z)), player);
}else if (ID == compressorID) {
return new ContainerCompressor((TileCompressor) world.getTileEntity(new BlockPos(x, y, z)), player);
}else if (ID == electricFurnaceID) {
return new ContainerElectricFurnace((TileElectricFurnace) world.getTileEntity(new BlockPos(x, y, z)), player);
}else if (ID == ironFurnace) {
return new ContainerIronFurnace((TileIronFurnace) world.getTileEntity(new BlockPos(x, y, z)), player);
}else if (ID == recyclerID) {
return new ContainerRecycler((TileRecycler) world.getTileEntity(new BlockPos(x, y, z)), player);
}else if (ID == scrapboxinatorID) {
return new ContainerScrapboxinator((TileScrapboxinator) world.getTileEntity(new BlockPos(x, y, z)), player);
}else if (ID == batboxID) {
return new ContainerBatbox((TileBatBox) world.getTileEntity(new BlockPos(x, y, z)), player);
}
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,
(TileThermalGenerator) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == semifluidGeneratorID) {
return new GuiSemifluidGenerator(player,
(TileSemifluidGenerator) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == gasTurbineID) {
return new GuiGasTurbine(player,
(TileGasTurbine) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == quantumTankID) {
return new GuiQuantumTank(player,
(TileQuantumTank) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == digitalChestID) {
return new GuiDigitalChest(player,
(TileDigitalChest) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == quantumChestID) {
return new GuiQuantumChest(player,
(TileQuantumChest) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == centrifugeID) {
return new GuiCentrifuge(player,
(TileCentrifuge) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == rollingMachineID) {
return new GuiRollingMachine(player,
(TileRollingMachine) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == blastFurnaceID) {
return new GuiBlastFurnace(player,
(TileBlastFurnace) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == alloySmelterID) {
return new GuiAlloySmelter(player,
(TileAlloySmelter) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == industrialGrinderID) {
return new GuiIndustrialGrinder(player,
(TileIndustrialGrinder) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == implosionCompresserID) {
return new GuiImplosionCompressor(player,
(TileImplosionCompressor) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == matterfabID) {
return new GuiMatterFabricator(player,
(TileMatterFabricator) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == chunkloaderID) {
return new GuiChunkLoader(player,
(TileChunkLoader) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == assemblingmachineID) {
return new GuiAssemblingMachine(player,
(TileAssemblingMachine) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == dieselGeneratorID) {
return new GuiDieselGenerator(player,
(TileDieselGenerator) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == industrialElectrolyzerID) {
return new GuiIndustrialElectrolyzer(player,
(TileIndustrialElectrolyzer) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == aesuID) {
return new GuiAesu(player,
(TileAesu) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == alloyFurnaceID) {
return new GuiAlloyFurnace(player,
(TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == sawMillID) {
return new GuiIndustrialSawmill(player,
(TileIndustrialSawmill) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == chemicalReactorID) {
return new GuiChemicalReactor(player,
(TileChemicalReactor) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == manuelID) {
return new GuiManual();
} else if (ID == destructoPackID) {
return new GuiDestructoPack(new ContainerDestructoPack(player));
} else if (ID == lesuID) {
return new GuiLesu(player, (TileLesu) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == idsuID) {
return new GuiIDSU(player, (TileIDSU) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == chargeBench) {
return new GuiChargeBench(player, (TileChargeBench) world.getTileEntity(new BlockPos(x, y, z)));
}else if (ID == fusionID) {
return new GuiFusionReactor(player, (TileEntityFusionController) world.getTileEntity(new BlockPos(x, y, z)));
}else if (ID == vacuumFreezerID) {
return new GuiVacuumFreezer(player, (TileVacuumFreezer) world.getTileEntity(new BlockPos(x, y, z)));
}else if (ID == grinderID) {
return new GuiGrinder(player, (TileGrinder) world.getTileEntity(new BlockPos(x, y, z)));
}else if (ID == generatorID) {
return new GuiGenerator(player, (TileGenerator) world.getTileEntity(new BlockPos(x, y, z)));
}else if (ID == extractorID) {
return new GuiExtractor(player, (TileExtractor) world.getTileEntity(new BlockPos(x, y, z)));
}else if (ID == compressorID) {
return new GuiCompressor(player, (TileCompressor) world.getTileEntity(new BlockPos(x, y, z)));
}else if (ID == electricFurnaceID) {
return new GuiElectricFurnace(player, (TileElectricFurnace) world.getTileEntity(new BlockPos(x, y, z)));
}else if (ID == ironFurnace) {
return new GuiIronFurnace(player, (TileIronFurnace) world.getTileEntity(new BlockPos(x, y, z)));
}else if (ID == recyclerID) {
return new GuiRecycler(player, (TileRecycler) world.getTileEntity(new BlockPos(x, y, z)));
}else if (ID == scrapboxinatorID) {
return new GuiScrapboxinator(player, (TileScrapboxinator) world.getTileEntity(new BlockPos(x, y, z)));
}else if (ID == batboxID) {
return new GuiBatbox(player, (TileBatBox) world.getTileEntity(new BlockPos(x, y, z)));
}
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, (TileThermalGenerator) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == semifluidGeneratorID)
{
return new GuiSemifluidGenerator(player,
(TileSemifluidGenerator) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == gasTurbineID)
{
return new GuiGasTurbine(player, (TileGasTurbine) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == quantumTankID)
{
return new GuiQuantumTank(player, (TileQuantumTank) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == digitalChestID)
{
return new GuiDigitalChest(player, (TileDigitalChest) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == quantumChestID)
{
return new GuiQuantumChest(player, (TileQuantumChest) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == centrifugeID)
{
return new GuiCentrifuge(player, (TileCentrifuge) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == rollingMachineID)
{
return new GuiRollingMachine(player, (TileRollingMachine) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == blastFurnaceID)
{
return new GuiBlastFurnace(player, (TileBlastFurnace) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == alloySmelterID)
{
return new GuiAlloySmelter(player, (TileAlloySmelter) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == industrialGrinderID)
{
return new GuiIndustrialGrinder(player, (TileIndustrialGrinder) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == implosionCompresserID)
{
return new GuiImplosionCompressor(player,
(TileImplosionCompressor) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == matterfabID)
{
return new GuiMatterFabricator(player, (TileMatterFabricator) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == chunkloaderID)
{
return new GuiChunkLoader(player, (TileChunkLoader) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == assemblingmachineID)
{
return new GuiAssemblingMachine(player, (TileAssemblingMachine) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == dieselGeneratorID)
{
return new GuiDieselGenerator(player, (TileDieselGenerator) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == industrialElectrolyzerID)
{
return new GuiIndustrialElectrolyzer(player,
(TileIndustrialElectrolyzer) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == aesuID)
{
return new GuiAesu(player, (TileAesu) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == alloyFurnaceID)
{
return new GuiAlloyFurnace(player, (TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == sawMillID)
{
return new GuiIndustrialSawmill(player, (TileIndustrialSawmill) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == chemicalReactorID)
{
return new GuiChemicalReactor(player, (TileChemicalReactor) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == manuelID)
{
return new GuiManual();
} else if (ID == destructoPackID)
{
return new GuiDestructoPack(new ContainerDestructoPack(player));
} else if (ID == lesuID)
{
return new GuiLesu(player, (TileLesu) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == idsuID)
{
return new GuiIDSU(player, (TileIDSU) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == chargeBench)
{
return new GuiChargeBench(player, (TileChargeBench) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == fusionID)
{
return new GuiFusionReactor(player,
(TileEntityFusionController) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == vacuumFreezerID)
{
return new GuiVacuumFreezer(player, (TileVacuumFreezer) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == grinderID)
{
return new GuiGrinder(player, (TileGrinder) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == generatorID)
{
return new GuiGenerator(player, (TileGenerator) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == extractorID)
{
return new GuiExtractor(player, (TileExtractor) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == compressorID)
{
return new GuiCompressor(player, (TileCompressor) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == electricFurnaceID)
{
return new GuiElectricFurnace(player, (TileElectricFurnace) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == ironFurnace)
{
return new GuiIronFurnace(player, (TileIronFurnace) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == recyclerID)
{
return new GuiRecycler(player, (TileRecycler) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == scrapboxinatorID)
{
return new GuiScrapboxinator(player, (TileScrapboxinator) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == batboxID)
{
return new GuiBatbox(player, (TileBatBox) world.getTileEntity(new BlockPos(x, y, z)));
}
return null;
}
}

View file

@ -1,40 +1,51 @@
package techreborn.client;
//TODO recode for 1.8
public class IconSupplier {
// public static IIcon insulatedCopperCable;
// public static IIcon copperCable;
// public static IIcon goldCable;
// public static IIcon insulatedGoldCable;
// public static IIcon doubleInsulatedGoldCable;
// public static IIcon ironCable;
// public static IIcon insulatedIronCable;
// public static IIcon doubleInsulatedIronCable;
// public static IIcon trippleInsulatedIronCable;
// public static IIcon glassFiberCable;
// public static IIcon tinCable;
// public static IIcon detectorCableBlock;
// public static IIcon splitterCableBlock;
// public static IIcon insulatedtinCableBlock;
public class IconSupplier
{
// public static IIcon insulatedCopperCable;
// public static IIcon copperCable;
// public static IIcon goldCable;
// public static IIcon insulatedGoldCable;
// public static IIcon doubleInsulatedGoldCable;
// public static IIcon ironCable;
// public static IIcon insulatedIronCable;
// public static IIcon doubleInsulatedIronCable;
// public static IIcon trippleInsulatedIronCable;
// public static IIcon glassFiberCable;
// public static IIcon tinCable;
// public static IIcon detectorCableBlock;
// public static IIcon splitterCableBlock;
// public static IIcon insulatedtinCableBlock;
// @SubscribeEvent
// public void onTextureStitch(TextureStitchEvent.Pre event) {
// TextureMap reg = event.map;
// if (reg.getTextureType() == 0) {
// insulatedCopperCable = reg.registerIcon("ic2" + ":wiring/cable/blockCable");
// copperCable = reg.registerIcon("ic2" + ":wiring/cable/blockCableO");
// goldCable = reg.registerIcon("ic2" + ":wiring/cable/blockGoldCable");
// insulatedGoldCable = reg.registerIcon("ic2" + ":wiring/cable/blockGoldCableI");
// doubleInsulatedGoldCable = reg.registerIcon("ic2" + ":wiring/cable/blockGoldCableII");
// ironCable = reg.registerIcon("ic2" + ":wiring/cable/blockIronCable");
// insulatedIronCable = reg.registerIcon("ic2" + ":wiring/cable/blockIronCableI");
// doubleInsulatedIronCable = reg.registerIcon("ic2" + ":wiring/cable/blockIronCableII");
// trippleInsulatedIronCable = reg.registerIcon("ic2" + ":wiring/cable/blockIronCableIII");
// glassFiberCable = reg.registerIcon("ic2" + ":wiring/cable/blockGlassCable");
// tinCable = reg.registerIcon("ic2" + ":wiring/cable/blockTinCable");
// detectorCableBlock = reg.registerIcon("ic2" + ":wiring/cable/blockDetectorCable");
// splitterCableBlock = reg.registerIcon("ic2" + ":wiring/cable/blockSplitterCable");
// insulatedtinCableBlock = reg.registerIcon("ic2" + ":wiring/cable/blockTinCableI");
// }
// }
// @SubscribeEvent
// public void onTextureStitch(TextureStitchEvent.Pre event) {
// TextureMap reg = event.map;
// if (reg.getTextureType() == 0) {
// insulatedCopperCable = reg.registerIcon("ic2" +
// ":wiring/cable/blockCable");
// copperCable = reg.registerIcon("ic2" + ":wiring/cable/blockCableO");
// goldCable = reg.registerIcon("ic2" + ":wiring/cable/blockGoldCable");
// insulatedGoldCable = reg.registerIcon("ic2" +
// ":wiring/cable/blockGoldCableI");
// doubleInsulatedGoldCable = reg.registerIcon("ic2" +
// ":wiring/cable/blockGoldCableII");
// ironCable = reg.registerIcon("ic2" + ":wiring/cable/blockIronCable");
// insulatedIronCable = reg.registerIcon("ic2" +
// ":wiring/cable/blockIronCableI");
// doubleInsulatedIronCable = reg.registerIcon("ic2" +
// ":wiring/cable/blockIronCableII");
// trippleInsulatedIronCable = reg.registerIcon("ic2" +
// ":wiring/cable/blockIronCableIII");
// glassFiberCable = reg.registerIcon("ic2" +
// ":wiring/cable/blockGlassCable");
// tinCable = reg.registerIcon("ic2" + ":wiring/cable/blockTinCable");
// detectorCableBlock = reg.registerIcon("ic2" +
// ":wiring/cable/blockDetectorCable");
// splitterCableBlock = reg.registerIcon("ic2" +
// ":wiring/cable/blockSplitterCable");
// insulatedtinCableBlock = reg.registerIcon("ic2" +
// ":wiring/cable/blockTinCableI");
// }
// }
}

View file

@ -5,16 +5,22 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import techreborn.init.ModBlocks;
public class RegisterItemJsons {
public static void registerModels() {
public class RegisterItemJsons
{
public static void registerModels()
{
registerItems();
registerBlocks();
}
private static void registerItems() {
private static void registerItems()
{
}
private static void registerBlocks() {
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.ironFence), 0, new ModelResourceLocation("techreborn:ironFence", "inventory"));
private static void registerBlocks()
{
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(
Item.getItemFromBlock(ModBlocks.ironFence), 0,
new ModelResourceLocation("techreborn:ironFence", "inventory"));
}
}

View file

@ -1,61 +1,90 @@
package techreborn.client;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.client.Minecraft;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.lwjgl.input.Keyboard;
import reborncore.api.IListInfoProvider;
import reborncore.api.power.IEnergyInterfaceItem;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.util.Color;
import techreborn.Core;
public class StackToolTipEvent {
import com.mojang.realmsclient.gui.ChatFormatting;
@SubscribeEvent
public void handleItemTooltipEvent(ItemTooltipEvent event) {
if (event.itemStack.getItem() instanceof IListInfoProvider) {
((IListInfoProvider) event.itemStack.getItem()).addInfo(event.toolTip, false);
} else if (event.itemStack.getItem() instanceof IEnergyInterfaceItem) {
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
int percentage = percentage((int) ((IEnergyInterfaceItem) event.itemStack.getItem()).getMaxPower(event.itemStack), (int) ((IEnergyInterfaceItem) event.itemStack.getItem()).getEnergy(event.itemStack));
ChatFormatting color;
if (percentage <= 10) {
color = ChatFormatting.RED;
} else if (percentage >= 75) {
color = ChatFormatting.GREEN;
} else {
color = ChatFormatting.YELLOW;
}
event.toolTip.add(color + "" + PowerSystem.getLocaliszedPower((int) ((IEnergyInterfaceItem) event.itemStack.getItem()).getEnergy(event.itemStack)) + ChatFormatting.LIGHT_PURPLE + " stored");
event.toolTip.add(Color.GREEN + "" + PowerSystem.getLocaliszedPower((int) ((IEnergyInterfaceItem) event.itemStack.getItem()).getMaxPower(event.itemStack)) + ChatFormatting.LIGHT_PURPLE + " max");
event.toolTip.add(ChatFormatting.GREEN + "" + percentage + "%" + ChatFormatting.LIGHT_PURPLE + " charged");
event.toolTip.add(Color.GREEN + "" + PowerSystem.getLocaliszedPower((int) ((IEnergyInterfaceItem) event.itemStack.getItem()).getMaxTransfer(event.itemStack)) + ChatFormatting.LIGHT_PURPLE + " /tick in/out");
}
} else {
try{
Block block = Block.getBlockFromItem(event.itemStack.getItem());
if (block != null && block instanceof BlockContainer && block.getClass().getCanonicalName().startsWith("techreborn.")) {
TileEntity tile = block.createTileEntity(Minecraft.getMinecraft().theWorld, block.getDefaultState());
if (tile instanceof IListInfoProvider) {
((IListInfoProvider) tile).addInfo(event.toolTip, false);
}
}
} catch (NullPointerException e){
Core.logHelper.debug("Failed to load info for " + event.itemStack.getDisplayName());
}
}
}
public class StackToolTipEvent
{
@SubscribeEvent
public void handleItemTooltipEvent(ItemTooltipEvent event)
{
if (event.itemStack.getItem() instanceof IListInfoProvider)
{
((IListInfoProvider) event.itemStack.getItem()).addInfo(event.toolTip, false);
} else if (event.itemStack.getItem() instanceof IEnergyInterfaceItem)
{
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT))
{
int percentage = percentage(
(int) ((IEnergyInterfaceItem) event.itemStack.getItem()).getMaxPower(event.itemStack),
(int) ((IEnergyInterfaceItem) event.itemStack.getItem()).getEnergy(event.itemStack));
ChatFormatting color;
if (percentage <= 10)
{
color = ChatFormatting.RED;
} else if (percentage >= 75)
{
color = ChatFormatting.GREEN;
} else
{
color = ChatFormatting.YELLOW;
}
event.toolTip.add(color + ""
+ PowerSystem.getLocaliszedPower(
(int) ((IEnergyInterfaceItem) event.itemStack.getItem()).getEnergy(event.itemStack))
+ ChatFormatting.LIGHT_PURPLE + " stored");
event.toolTip.add(Color.GREEN + ""
+ PowerSystem.getLocaliszedPower(
(int) ((IEnergyInterfaceItem) event.itemStack.getItem()).getMaxPower(event.itemStack))
+ ChatFormatting.LIGHT_PURPLE + " max");
event.toolTip
.add(ChatFormatting.GREEN + "" + percentage + "%" + ChatFormatting.LIGHT_PURPLE + " charged");
event.toolTip.add(Color.GREEN + "" + PowerSystem.getLocaliszedPower(
(int) ((IEnergyInterfaceItem) event.itemStack.getItem()).getMaxTransfer(event.itemStack))
+ ChatFormatting.LIGHT_PURPLE + " /tick in/out");
}
} else
{
try
{
Block block = Block.getBlockFromItem(event.itemStack.getItem());
if (block != null && block instanceof BlockContainer
&& block.getClass().getCanonicalName().startsWith("techreborn."))
{
TileEntity tile = block.createTileEntity(Minecraft.getMinecraft().theWorld,
block.getDefaultState());
if (tile instanceof IListInfoProvider)
{
((IListInfoProvider) tile).addInfo(event.toolTip, false);
}
}
} catch (NullPointerException e)
{
Core.logHelper.debug("Failed to load info for " + event.itemStack.getDisplayName());
}
}
}
public int percentage(int MaxValue, int CurrentValue) {
if (CurrentValue == 0)
return 0;
return (int) ((CurrentValue * 100.0f) / MaxValue);
}
public int percentage(int MaxValue, int CurrentValue)
{
if (CurrentValue == 0)
return 0;
return (int) ((CurrentValue * 100.0f) / MaxValue);
}
}

View file

@ -4,16 +4,19 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import techreborn.init.ModBlocks;
public class TechRebornCreativeTab extends CreativeTabs {
public class TechRebornCreativeTab extends CreativeTabs
{
public static TechRebornCreativeTab instance = new TechRebornCreativeTab();
public static TechRebornCreativeTab instance = new TechRebornCreativeTab();
public TechRebornCreativeTab() {
super("techreborn");
}
public TechRebornCreativeTab()
{
super("techreborn");
}
@Override
public Item getTabIconItem() {
return Item.getItemFromBlock(ModBlocks.thermalGenerator);
}
@Override
public Item getTabIconItem()
{
return Item.getItemFromBlock(ModBlocks.thermalGenerator);
}
}

View file

@ -4,17 +4,20 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import techreborn.init.ModItems;
public class TechRebornCreativeTabMisc extends CreativeTabs {
public class TechRebornCreativeTabMisc extends CreativeTabs
{
public static TechRebornCreativeTabMisc instance = new TechRebornCreativeTabMisc();
public static TechRebornCreativeTabMisc instance = new TechRebornCreativeTabMisc();
public TechRebornCreativeTabMisc() {
super("techreborn");
}
public TechRebornCreativeTabMisc()
{
super("techreborn");
}
@Override
public Item getTabIconItem() {
return ModItems.cells;
}
@Override
public Item getTabIconItem()
{
return ModItems.cells;
}
}

View file

@ -1,5 +1,8 @@
package techreborn.client;
import java.awt.*;
import java.util.ArrayList;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.fml.client.GuiModList;
@ -7,39 +10,46 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import reborncore.client.gui.GuiUtil;
import techreborn.Core;
import java.awt.*;
import java.util.ArrayList;
public class VersionCheckerClient
{
ResourceLocation texture;
public class VersionCheckerClient {
ResourceLocation texture;
public VersionCheckerClient()
{
texture = new ResourceLocation("textures/gui/demo_background.png");
}
public VersionCheckerClient() {
texture = new ResourceLocation("textures/gui/demo_background.png");
}
@SubscribeEvent
public void drawGui(GuiScreenEvent.DrawScreenEvent event) {
if (event.gui instanceof GuiModList) {
ArrayList<String> changeLog = Core.INSTANCE.versionChecker.getChangeLogSinceCurrentVersion();
String s = "";
if (Core.INSTANCE.versionChecker.isChecking) {
s = "Checking for update...";
} else if (Core.INSTANCE.versionChecker.isLatestVersion()) {
s = "You have the latest version of TechReborn";
} else {
s = "There is an update for TechReborn with " + changeLog.size() + " changes.";
}
event.gui.drawString(event.gui.mc.fontRendererObj, s, 10, 5, Color.white.getRGB());
if (!Core.INSTANCE.versionChecker.isLatestVersion()) {
if (event.mouseY < 20) {
GuiUtil.drawTooltipBox(5, 15, 330, changeLog.size() * 10 + 5);
int y = 20;
for (String change : changeLog) {
event.gui.drawString(event.gui.mc.fontRendererObj, change, 10, y, Color.white.getRGB());
y += 10;
}
}
}
}
}
@SubscribeEvent
public void drawGui(GuiScreenEvent.DrawScreenEvent event)
{
if (event.gui instanceof GuiModList)
{
ArrayList<String> changeLog = Core.INSTANCE.versionChecker.getChangeLogSinceCurrentVersion();
String s = "";
if (Core.INSTANCE.versionChecker.isChecking)
{
s = "Checking for update...";
} else if (Core.INSTANCE.versionChecker.isLatestVersion())
{
s = "You have the latest version of TechReborn";
} else
{
s = "There is an update for TechReborn with " + changeLog.size() + " changes.";
}
event.gui.drawString(event.gui.mc.fontRendererObj, s, 10, 5, Color.white.getRGB());
if (!Core.INSTANCE.versionChecker.isLatestVersion())
{
if (event.mouseY < 20)
{
GuiUtil.drawTooltipBox(5, 15, 330, changeLog.size() * 10 + 5);
int y = 20;
for (String change : changeLog)
{
event.gui.drawString(event.gui.mc.fontRendererObj, change, 10, y, Color.white.getRGB());
y += 10;
}
}
}
}
}
}

View file

@ -7,88 +7,101 @@ import reborncore.client.gui.SlotOutput;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.TileAlloyFurnace;
public class ContainerAlloyFurnace extends RebornContainer {
public class ContainerAlloyFurnace extends RebornContainer
{
EntityPlayer player;
EntityPlayer player;
TileAlloyFurnace tile;
TileAlloyFurnace tile;
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
public int tickTime;
public int tickTime;
public ContainerAlloyFurnace(TileAlloyFurnace tileAlloyfurnace,
EntityPlayer player) {
tile = tileAlloyfurnace;
this.player = player;
public ContainerAlloyFurnace(TileAlloyFurnace tileAlloyfurnace, EntityPlayer player)
{
tile = tileAlloyfurnace;
this.player = player;
// input
this.addSlotToContainer(new Slot(tileAlloyfurnace.inventory, 0, 47, 17));
this.addSlotToContainer(new Slot(tileAlloyfurnace.inventory, 1, 65, 17));
// outputs
this.addSlotToContainer(new SlotOutput(tileAlloyfurnace.inventory, 2, 116, 35));
// Fuel
this.addSlotToContainer(new Slot(tileAlloyfurnace.inventory, 3, 56, 53));
// input
this.addSlotToContainer(new Slot(tileAlloyfurnace.inventory, 0, 47, 17));
this.addSlotToContainer(new Slot(tileAlloyfurnace.inventory, 1, 65, 17));
// outputs
this.addSlotToContainer(new SlotOutput(tileAlloyfurnace.inventory, 2, 116, 35));
// Fuel
this.addSlotToContainer(new Slot(tileAlloyfurnace.inventory, 3, 56, 53));
int i;
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
int currentItemBurnTime;
int burnTime;
int cookTime;
int currentItemBurnTime;
int burnTime;
int cookTime;
@Override
public void onCraftGuiOpened(ICrafting crafting) {
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 0, tile.currentItemBurnTime);
crafting.sendProgressBarUpdate(this, 1, tile.burnTime);
crafting.sendProgressBarUpdate(this, 2, tile.cookTime);
}
@Override
public void onCraftGuiOpened(ICrafting crafting)
{
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 0, tile.currentItemBurnTime);
crafting.sendProgressBarUpdate(this, 1, tile.burnTime);
crafting.sendProgressBarUpdate(this, 2, tile.cookTime);
}
@Override
public void detectAndSendChanges() {
for (int i = 0; i < this.crafters.size(); i++) {
ICrafting crafting = (ICrafting) this.crafters.get(i);
if (this.currentItemBurnTime != tile.currentItemBurnTime) {
crafting.sendProgressBarUpdate(this, 0, tile.currentItemBurnTime);
}
if (this.burnTime != tile.burnTime) {
crafting.sendProgressBarUpdate(this, 1, tile.burnTime);
}
if (this.cookTime != tile.cookTime) {
crafting.sendProgressBarUpdate(this, 2, tile.cookTime);
}
}
super.detectAndSendChanges();
}
@Override
public void detectAndSendChanges()
{
for (int i = 0; i < this.crafters.size(); i++)
{
ICrafting crafting = (ICrafting) this.crafters.get(i);
if (this.currentItemBurnTime != tile.currentItemBurnTime)
{
crafting.sendProgressBarUpdate(this, 0, tile.currentItemBurnTime);
}
if (this.burnTime != tile.burnTime)
{
crafting.sendProgressBarUpdate(this, 1, tile.burnTime);
}
if (this.cookTime != tile.cookTime)
{
crafting.sendProgressBarUpdate(this, 2, tile.cookTime);
}
}
super.detectAndSendChanges();
}
@Override
public void updateProgressBar(int id, int value) {
super.updateProgressBar(id, value);
if (id == 0) {
this.currentItemBurnTime = value;
} else if (id == 1) {
this.burnTime = value;
} else if (id == 2) {
this.cookTime = value;
}
this.tile.currentItemBurnTime = this.currentItemBurnTime;
this.tile.burnTime = this.burnTime;
this.tile.cookTime = this.cookTime;
}
@Override
public void updateProgressBar(int id, int value)
{
super.updateProgressBar(id, value);
if (id == 0)
{
this.currentItemBurnTime = value;
} else if (id == 1)
{
this.burnTime = value;
} else if (id == 2)
{
this.cookTime = value;
}
this.tile.currentItemBurnTime = this.currentItemBurnTime;
this.tile.burnTime = this.burnTime;
this.tile.cookTime = this.cookTime;
}
}

View file

@ -6,52 +6,54 @@ import reborncore.client.gui.SlotOutput;
import techreborn.api.SlotUpgrade;
import techreborn.tiles.TileAlloySmelter;
public class ContainerAlloySmelter extends ContainerCrafting {
public class ContainerAlloySmelter extends ContainerCrafting
{
EntityPlayer player;
EntityPlayer player;
TileAlloySmelter tile;
TileAlloySmelter tile;
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
public int tickTime;
public int tickTime;
public ContainerAlloySmelter(TileAlloySmelter tileAlloysmelter,
EntityPlayer player) {
super(tileAlloysmelter.crafter);
tile = tileAlloysmelter;
this.player = player;
public ContainerAlloySmelter(TileAlloySmelter tileAlloysmelter, EntityPlayer player)
{
super(tileAlloysmelter.crafter);
tile = tileAlloysmelter;
this.player = player;
// input
this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 0, 47, 17));
this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 1, 65, 17));
// outputs
this.addSlotToContainer(new SlotOutput(tileAlloysmelter.inventory, 2, 116, 35));
// battery
this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 3, 56, 53));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tileAlloysmelter.inventory, 4, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tileAlloysmelter.inventory, 5, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tileAlloysmelter.inventory, 6, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tileAlloysmelter.inventory, 7, 152, 62));
// input
this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 0, 47, 17));
this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 1, 65, 17));
// outputs
this.addSlotToContainer(new SlotOutput(tileAlloysmelter.inventory, 2, 116, 35));
// battery
this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 3, 56, 53));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tileAlloysmelter.inventory, 4, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tileAlloysmelter.inventory, 5, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tileAlloysmelter.inventory, 6, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tileAlloysmelter.inventory, 7, 152, 62));
int i;
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
}

View file

@ -6,51 +6,54 @@ import reborncore.client.gui.SlotOutput;
import techreborn.api.SlotUpgrade;
import techreborn.tiles.TileAssemblingMachine;
public class ContainerAssemblingMachine extends ContainerCrafting {
public class ContainerAssemblingMachine extends ContainerCrafting
{
EntityPlayer player;
EntityPlayer player;
TileAssemblingMachine tile;
TileAssemblingMachine tile;
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
public int tickTime;
public int tickTime;
public ContainerAssemblingMachine(TileAssemblingMachine tileAssemblingMachine,
EntityPlayer player) {
super(tileAssemblingMachine.crafter);
tile = tileAssemblingMachine;
this.player = player;
public ContainerAssemblingMachine(TileAssemblingMachine tileAssemblingMachine, EntityPlayer player)
{
super(tileAssemblingMachine.crafter);
tile = tileAssemblingMachine;
this.player = player;
// input
this.addSlotToContainer(new Slot(tileAssemblingMachine.inventory, 0, 47, 17));
this.addSlotToContainer(new Slot(tileAssemblingMachine.inventory, 1, 65, 17));
// outputs
this.addSlotToContainer(new SlotOutput(tileAssemblingMachine.inventory, 2, 116, 35));
// power
this.addSlotToContainer(new Slot(tileAssemblingMachine.inventory, 3, 56, 53));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tileAssemblingMachine.inventory, 4, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tileAssemblingMachine.inventory, 5, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tileAssemblingMachine.inventory, 6, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tileAssemblingMachine.inventory, 7, 152, 62));
// input
this.addSlotToContainer(new Slot(tileAssemblingMachine.inventory, 0, 47, 17));
this.addSlotToContainer(new Slot(tileAssemblingMachine.inventory, 1, 65, 17));
// outputs
this.addSlotToContainer(new SlotOutput(tileAssemblingMachine.inventory, 2, 116, 35));
// power
this.addSlotToContainer(new Slot(tileAssemblingMachine.inventory, 3, 56, 53));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tileAssemblingMachine.inventory, 4, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tileAssemblingMachine.inventory, 5, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tileAssemblingMachine.inventory, 6, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tileAssemblingMachine.inventory, 7, 152, 62));
int i;
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
}

View file

@ -3,82 +3,92 @@ package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotFurnaceFuel;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.generator.TileGenerator;
import techreborn.tiles.storage.TileBatBox;
public class ContainerBatbox extends RebornContainer {
public class ContainerBatbox extends RebornContainer
{
EntityPlayer player;
EntityPlayer player;
TileBatBox tile;
TileBatBox tile;
public int burnTime = 0;
public int totalBurnTime = 0;
public int energy;
public int burnTime = 0;
public int totalBurnTime = 0;
public int energy;
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
public int tickTime;
public int tickTime;
public ContainerBatbox(TileBatBox tile, EntityPlayer player) {
super();
this.tile = tile;
this.player = player;
public ContainerBatbox(TileBatBox tile, EntityPlayer player)
{
super();
this.tile = tile;
this.player = player;
int i;
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++)
{
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.energy != (int) tile.getEnergy())
{
icrafting.sendProgressBarUpdate(this, 2, (int) tile.getEnergy());
}
}
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++) {
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.energy != (int) tile.getEnergy()) {
icrafting.sendProgressBarUpdate(this, 2, (int) tile.getEnergy());
}
}
}
@Override
public void onCraftGuiOpened(ICrafting crafting)
{
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 2, (int) tile.getEnergy());
}
@Override
public void onCraftGuiOpened(ICrafting crafting) {
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 2, (int) tile.getEnergy());
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value)
{
if (id == 0)
{
this.burnTime = value;
} else if (id == 1)
{
this.totalBurnTime = value;
} else if (id == 2)
{
this.energy = value;
}
this.tile.setEnergy(energy);
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value) {
if (id == 0) {
this.burnTime = value;
} else if (id == 1) {
this.totalBurnTime = value;
} else if (id == 2) {
this.energy = value;
}
this.tile.setEnergy(energy);
}
public int getScaledBurnTime(int i) {
return (int) (((float) burnTime / (float) totalBurnTime) * i);
}
public int getScaledBurnTime(int i)
{
return (int) (((float) burnTime / (float) totalBurnTime) * i);
}
}

View file

@ -6,71 +6,84 @@ import net.minecraft.inventory.Slot;
import reborncore.client.gui.SlotOutput;
import techreborn.tiles.TileBlastFurnace;
public class ContainerBlastFurnace extends ContainerCrafting {
public class ContainerBlastFurnace extends ContainerCrafting
{
EntityPlayer player;
EntityPlayer player;
TileBlastFurnace tile;
TileBlastFurnace tile;
public int heat;
public int heat;
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
public int tickTime;
public int tickTime;
public ContainerBlastFurnace(TileBlastFurnace tileblastfurnace,
EntityPlayer player) {
super(tileblastfurnace.crafter);
tile = tileblastfurnace;
this.player = player;
public ContainerBlastFurnace(TileBlastFurnace tileblastfurnace, EntityPlayer player)
{
super(tileblastfurnace.crafter);
tile = tileblastfurnace;
this.player = player;
// input
this.addSlotToContainer(new Slot(tileblastfurnace.inventory, 0, 40, 25));//Input 1
this.addSlotToContainer(new Slot(tileblastfurnace.inventory, 1, 40, 43));//Input 2
// outputs
this.addSlotToContainer(new SlotOutput(tileblastfurnace.inventory, 2, 100, 35));//Output 1
this.addSlotToContainer(new SlotOutput(tileblastfurnace.inventory, 3, 118, 35));//Output 2
// input
this.addSlotToContainer(new Slot(tileblastfurnace.inventory, 0, 40, 25));// Input
// 1
this.addSlotToContainer(new Slot(tileblastfurnace.inventory, 1, 40, 43));// Input
// 2
// outputs
this.addSlotToContainer(new SlotOutput(tileblastfurnace.inventory, 2, 100, 35));// Output
// 1
this.addSlotToContainer(new SlotOutput(tileblastfurnace.inventory, 3, 118, 35));// Output
// 2
int i;
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++) {
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.heat != tile.getHeat()) {
icrafting.sendProgressBarUpdate(this, 10, tile.getHeat());
}
}
}
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++)
{
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.heat != tile.getHeat())
{
icrafting.sendProgressBarUpdate(this, 10, tile.getHeat());
}
}
}
@Override
public void onCraftGuiOpened(ICrafting crafting) {
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 10, tile.getHeat());
}
@Override
public void onCraftGuiOpened(ICrafting crafting)
{
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 10, tile.getHeat());
}
@Override
public void updateProgressBar(int id, int value) {
if (id == 10) {
this.heat = value;
}
super.updateProgressBar(id, value);
}
@Override
public void updateProgressBar(int id, int value)
{
if (id == 10)
{
this.heat = value;
}
super.updateProgressBar(id, value);
}
}

View file

@ -6,53 +6,57 @@ import reborncore.client.gui.SlotOutput;
import techreborn.api.SlotUpgrade;
import techreborn.tiles.TileCentrifuge;
public class ContainerCentrifuge extends ContainerCrafting {
public class ContainerCentrifuge extends ContainerCrafting
{
EntityPlayer player;
EntityPlayer player;
TileCentrifuge tile;
TileCentrifuge tile;
public int tickTime;
public int tickTime;
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
public ContainerCentrifuge(TileCentrifuge tileCentrifuge, EntityPlayer player) {
super(tileCentrifuge.crafter);
tile = tileCentrifuge;
this.player = player;
public ContainerCentrifuge(TileCentrifuge tileCentrifuge, EntityPlayer player)
{
super(tileCentrifuge.crafter);
tile = tileCentrifuge;
this.player = player;
// input
this.addSlotToContainer(new Slot(tileCentrifuge.inventory, 0, 80, 35));
this.addSlotToContainer(new Slot(tileCentrifuge.inventory, 1, 50, 5));
// outputs
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 2, 80, 5));
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 3, 110, 35));
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 4, 80, 65));
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 5, 50, 35));
// battery
this.addSlotToContainer(new Slot(tileCentrifuge.inventory, 6, 8, 51));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tileCentrifuge.inventory, 7, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tileCentrifuge.inventory, 8, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tileCentrifuge.inventory, 9, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tileCentrifuge.inventory, 10, 152, 62));
// input
this.addSlotToContainer(new Slot(tileCentrifuge.inventory, 0, 80, 35));
this.addSlotToContainer(new Slot(tileCentrifuge.inventory, 1, 50, 5));
// outputs
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 2, 80, 5));
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 3, 110, 35));
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 4, 80, 65));
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 5, 50, 35));
// battery
this.addSlotToContainer(new Slot(tileCentrifuge.inventory, 6, 8, 51));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tileCentrifuge.inventory, 7, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tileCentrifuge.inventory, 8, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tileCentrifuge.inventory, 9, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tileCentrifuge.inventory, 10, 152, 62));
int i;
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
}

View file

@ -5,41 +5,47 @@ import net.minecraft.inventory.Slot;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.TileChargeBench;
public class ContainerChargeBench extends RebornContainer {
public class ContainerChargeBench extends RebornContainer
{
EntityPlayer player;
EntityPlayer player;
TileChargeBench tile;
TileChargeBench tile;
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
public int tickTime;
public int tickTime;
public ContainerChargeBench(TileChargeBench tileChargeBench, EntityPlayer player) {
tile = tileChargeBench;
this.player = player;
public ContainerChargeBench(TileChargeBench tileChargeBench, EntityPlayer player)
{
tile = tileChargeBench;
this.player = player;
this.addSlotToContainer(new Slot(tileChargeBench.inventory, 0, 62, 21));
this.addSlotToContainer(new Slot(tileChargeBench.inventory, 1, 80, 21));
this.addSlotToContainer(new Slot(tileChargeBench.inventory, 2, 98, 21));
this.addSlotToContainer(new Slot(tileChargeBench.inventory, 3, 62, 39));
this.addSlotToContainer(new Slot(tileChargeBench.inventory, 4, 80, 39));
this.addSlotToContainer(new Slot(tileChargeBench.inventory, 5, 98, 39));
this.addSlotToContainer(new Slot(tileChargeBench.inventory, 0, 62, 21));
this.addSlotToContainer(new Slot(tileChargeBench.inventory, 1, 80, 21));
this.addSlotToContainer(new Slot(tileChargeBench.inventory, 2, 98, 21));
this.addSlotToContainer(new Slot(tileChargeBench.inventory, 3, 62, 39));
this.addSlotToContainer(new Slot(tileChargeBench.inventory, 4, 80, 39));
this.addSlotToContainer(new Slot(tileChargeBench.inventory, 5, 98, 39));
int i;
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
}

View file

@ -6,51 +6,54 @@ import reborncore.client.gui.SlotOutput;
import techreborn.api.SlotUpgrade;
import techreborn.tiles.TileChemicalReactor;
public class ContainerChemicalReactor extends ContainerCrafting {
public class ContainerChemicalReactor extends ContainerCrafting
{
EntityPlayer player;
EntityPlayer player;
TileChemicalReactor tile;
TileChemicalReactor tile;
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
public int tickTime;
public int tickTime;
public ContainerChemicalReactor(TileChemicalReactor tilechemicalReactor,
EntityPlayer player) {
super(tilechemicalReactor.crafter);
tile = tilechemicalReactor;
this.player = player;
public ContainerChemicalReactor(TileChemicalReactor tilechemicalReactor, EntityPlayer player)
{
super(tilechemicalReactor.crafter);
tile = tilechemicalReactor;
this.player = player;
// input
this.addSlotToContainer(new Slot(tilechemicalReactor.inventory, 0, 70, 21));
this.addSlotToContainer(new Slot(tilechemicalReactor.inventory, 1, 90, 21));
// outputs
this.addSlotToContainer(new SlotOutput(tilechemicalReactor.inventory, 2, 80, 51));
// battery
this.addSlotToContainer(new Slot(tilechemicalReactor.inventory, 3, 8, 51));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tilechemicalReactor.inventory, 4, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tilechemicalReactor.inventory, 5, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tilechemicalReactor.inventory, 6, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tilechemicalReactor.inventory, 7, 152, 62));
// input
this.addSlotToContainer(new Slot(tilechemicalReactor.inventory, 0, 70, 21));
this.addSlotToContainer(new Slot(tilechemicalReactor.inventory, 1, 90, 21));
// outputs
this.addSlotToContainer(new SlotOutput(tilechemicalReactor.inventory, 2, 80, 51));
// battery
this.addSlotToContainer(new Slot(tilechemicalReactor.inventory, 3, 8, 51));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tilechemicalReactor.inventory, 4, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tilechemicalReactor.inventory, 5, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tilechemicalReactor.inventory, 6, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tilechemicalReactor.inventory, 7, 152, 62));
int i;
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
}

View file

@ -5,33 +5,36 @@ import net.minecraft.inventory.Slot;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.TileChunkLoader;
public class ContainerChunkloader extends RebornContainer {
public class ContainerChunkloader extends RebornContainer
{
EntityPlayer player;
EntityPlayer player;
public ContainerChunkloader(TileChunkLoader tilechunkloader, EntityPlayer player)
{
this.player = player;
public ContainerChunkloader(TileChunkLoader tilechunkloader, EntityPlayer player) {
this.player = player;
int i;
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_)
{
return true;
}
}

View file

@ -2,53 +2,54 @@ package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.client.gui.SlotOutput;
import techreborn.api.SlotUpgrade;
import techreborn.tiles.teir1.TileCompressor;
public class ContainerCompressor extends ContainerCrafting {
public class ContainerCompressor extends ContainerCrafting
{
EntityPlayer player;
EntityPlayer player;
TileCompressor tile;
TileCompressor tile;
public int connectionStatus;
public int connectionStatus;
public ContainerCompressor(TileCompressor tileGrinder, EntityPlayer player) {
super(tileGrinder.crafter);
tile = tileGrinder;
this.player = player;
public ContainerCompressor(TileCompressor tileGrinder, EntityPlayer player)
{
super(tileGrinder.crafter);
tile = tileGrinder;
this.player = player;
// input
this.addSlotToContainer(new Slot(tileGrinder.inventory, 0, 56, 34));
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 1, 116, 34));
// input
this.addSlotToContainer(new Slot(tileGrinder.inventory, 0, 56, 34));
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 1, 116, 34));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 2, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 3, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 4, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 5, 152, 62));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 2, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 3, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 4, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 5, 152, 62));
int i;
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_)
{
return true;
}
}

View file

@ -6,58 +6,71 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.common.container.RebornContainer;
import techreborn.api.recipe.RecipeCrafter;
public abstract class ContainerCrafting extends RebornContainer {
public abstract class ContainerCrafting extends RebornContainer
{
RecipeCrafter crafter;
RecipeCrafter crafter;
int currentTickTime = 0;
int currentNeededTicks = 0;
int energy;
int currentTickTime = 0;
int currentNeededTicks = 0;
int energy;
public ContainerCrafting(RecipeCrafter crafter) {
this.crafter = crafter;
}
public ContainerCrafting(RecipeCrafter crafter)
{
this.crafter = crafter;
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++) {
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.currentTickTime != crafter.currentTickTime || crafter.currentTickTime == -1) {
icrafting.sendProgressBarUpdate(this, 0, crafter.currentTickTime);
}
if (this.currentNeededTicks != crafter.currentNeededTicks) {
icrafting.sendProgressBarUpdate(this, 1, crafter.currentNeededTicks);
}
if (this.energy != (int) crafter.energy.getEnergy()) {
icrafting.sendProgressBarUpdate(this, 2, (int) crafter.energy.getEnergy());
}
}
}
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++)
{
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.currentTickTime != crafter.currentTickTime || crafter.currentTickTime == -1)
{
icrafting.sendProgressBarUpdate(this, 0, crafter.currentTickTime);
}
if (this.currentNeededTicks != crafter.currentNeededTicks)
{
icrafting.sendProgressBarUpdate(this, 1, crafter.currentNeededTicks);
}
if (this.energy != (int) crafter.energy.getEnergy())
{
icrafting.sendProgressBarUpdate(this, 2, (int) crafter.energy.getEnergy());
}
}
}
@Override
public void onCraftGuiOpened(ICrafting crafting) {
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 0, crafter.currentTickTime);
crafting.sendProgressBarUpdate(this, 1, crafter.currentNeededTicks);
crafting.sendProgressBarUpdate(this, 2, (int) crafter.energy.getEnergy());
}
@Override
public void onCraftGuiOpened(ICrafting crafting)
{
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 0, crafter.currentTickTime);
crafting.sendProgressBarUpdate(this, 1, crafter.currentNeededTicks);
crafting.sendProgressBarUpdate(this, 2, (int) crafter.energy.getEnergy());
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value) {
if (id == 0) {
this.currentTickTime = value;
if(this.currentTickTime == -1){
this.currentTickTime = 0;
}
} else if (id == 1) {
this.currentNeededTicks = value;
} else if (id == 2) {
this.energy = value;
}
this.crafter.currentTickTime = currentTickTime;
this.crafter.currentNeededTicks = currentNeededTicks;
this.crafter.energy.setEnergy(energy);
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value)
{
if (id == 0)
{
this.currentTickTime = value;
if (this.currentTickTime == -1)
{
this.currentTickTime = 0;
}
} else if (id == 1)
{
this.currentNeededTicks = value;
} else if (id == 2)
{
this.energy = value;
}
this.crafter.currentTickTime = currentTickTime;
this.crafter.currentNeededTicks = currentNeededTicks;
this.crafter.energy.setEnergy(energy);
}
}

View file

@ -8,37 +8,42 @@ import reborncore.common.container.RebornContainer;
import reborncore.common.util.Inventory;
import techreborn.init.ModItems;
public class ContainerDestructoPack extends RebornContainer {
public class ContainerDestructoPack extends RebornContainer
{
private EntityPlayer player;
private Inventory inv;
private EntityPlayer player;
private Inventory inv;
public ContainerDestructoPack(EntityPlayer player) {
this.player = player;
inv = new Inventory(1, "destructopack", 64, null);
buildContainer();
}
public ContainerDestructoPack(EntityPlayer player)
{
this.player = player;
inv = new Inventory(1, "destructopack", 64, null);
buildContainer();
}
@Override
public boolean canInteractWith(EntityPlayer arg0) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer arg0)
{
return true;
}
private void buildContainer()
{
this.addSlotToContainer(
new SlotFilteredVoid(inv, 0, 80, 36, new ItemStack[] { new ItemStack(ModItems.parts, 1, 37) }));
int i;
private void buildContainer() {
this.addSlotToContainer(new SlotFilteredVoid(inv, 0, 80, 36, new ItemStack[]{new ItemStack(ModItems.parts, 1, 37)}));
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
}

View file

@ -10,73 +10,81 @@ import reborncore.client.gui.SlotOutput;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.generator.TileDieselGenerator;
public class ContainerDieselGenerator extends RebornContainer {
public TileDieselGenerator tiledieselGenerator;
public EntityPlayer player;
public int energy;
public int fluid;
public class ContainerDieselGenerator extends RebornContainer
{
public TileDieselGenerator tiledieselGenerator;
public EntityPlayer player;
public int energy;
public int fluid;
public ContainerDieselGenerator(TileDieselGenerator tiledieselGenerator,
EntityPlayer player) {
super();
this.tiledieselGenerator = tiledieselGenerator;
this.player = player;
public ContainerDieselGenerator(TileDieselGenerator tiledieselGenerator, EntityPlayer player)
{
super();
this.tiledieselGenerator = tiledieselGenerator;
this.player = player;
this.addSlotToContainer(new Slot(tiledieselGenerator.inventory, 0, 80,
17));
this.addSlotToContainer(new SlotOutput(tiledieselGenerator.inventory,
1, 80, 53));
this.addSlotToContainer(new SlotFake(tiledieselGenerator.inventory, 2,
59, 42, false, false, 1));
this.addSlotToContainer(new Slot(tiledieselGenerator.inventory, 0, 80, 17));
this.addSlotToContainer(new SlotOutput(tiledieselGenerator.inventory, 1, 80, 53));
this.addSlotToContainer(new SlotFake(tiledieselGenerator.inventory, 2, 59, 42, false, false, 1));
int i;
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++) {
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.energy != (int) tiledieselGenerator.getEnergy()) {
icrafting.sendProgressBarUpdate(this, 0, (int) tiledieselGenerator.getEnergy());
}
if (this.fluid != tiledieselGenerator.tank.getFluidAmount()) {
icrafting.sendProgressBarUpdate(this, 1, tiledieselGenerator.tank.getFluidAmount());
}
}
}
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++)
{
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.energy != (int) tiledieselGenerator.getEnergy())
{
icrafting.sendProgressBarUpdate(this, 0, (int) tiledieselGenerator.getEnergy());
}
if (this.fluid != tiledieselGenerator.tank.getFluidAmount())
{
icrafting.sendProgressBarUpdate(this, 1, tiledieselGenerator.tank.getFluidAmount());
}
}
}
@Override
public void onCraftGuiOpened(ICrafting crafting) {
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 0, (int) tiledieselGenerator.getEnergy());
crafting.sendProgressBarUpdate(this, 1, tiledieselGenerator.tank.getFluidAmount());
}
@Override
public void onCraftGuiOpened(ICrafting crafting)
{
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 0, (int) tiledieselGenerator.getEnergy());
crafting.sendProgressBarUpdate(this, 1, tiledieselGenerator.tank.getFluidAmount());
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value) {
if (id == 0) {
this.energy = value;
} else if (id == 1) {
this.fluid = value;
}
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value)
{
if (id == 0)
{
this.energy = value;
} else if (id == 1)
{
this.fluid = value;
}
}
}

View file

@ -7,40 +7,41 @@ import reborncore.client.gui.SlotOutput;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.TileDigitalChest;
public class ContainerDigitalChest extends RebornContainer {
public TileDigitalChest tileDigitalChest;
public EntityPlayer player;
public class ContainerDigitalChest extends RebornContainer
{
public TileDigitalChest tileDigitalChest;
public EntityPlayer player;
public ContainerDigitalChest(TileDigitalChest tileDigitalChest,
EntityPlayer player) {
super();
this.tileDigitalChest = tileDigitalChest;
this.player = player;
public ContainerDigitalChest(TileDigitalChest tileDigitalChest, EntityPlayer player)
{
super();
this.tileDigitalChest = tileDigitalChest;
this.player = player;
this.addSlotToContainer(new Slot(tileDigitalChest.inventory, 0, 80, 17));
this.addSlotToContainer(new SlotOutput(tileDigitalChest.inventory, 1,
80, 53));
this.addSlotToContainer(new SlotFake(tileDigitalChest.inventory, 2, 59,
42, false, false, Integer.MAX_VALUE));
this.addSlotToContainer(new Slot(tileDigitalChest.inventory, 0, 80, 17));
this.addSlotToContainer(new SlotOutput(tileDigitalChest.inventory, 1, 80, 53));
this.addSlotToContainer(new SlotFake(tileDigitalChest.inventory, 2, 59, 42, false, false, Integer.MAX_VALUE));
int i;
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
}

View file

@ -9,56 +9,61 @@ import reborncore.common.container.RebornContainer;
import techreborn.api.SlotUpgrade;
import techreborn.tiles.teir1.TileElectricFurnace;
public class ContainerElectricFurnace extends RebornContainer {
public class ContainerElectricFurnace extends RebornContainer
{
EntityPlayer player;
EntityPlayer player;
TileElectricFurnace tile;
TileElectricFurnace tile;
public int connectionStatus;
public int connectionStatus;
public ContainerElectricFurnace(TileElectricFurnace tileGrinder, EntityPlayer player) {
super();
tile = tileGrinder;
this.player = player;
public ContainerElectricFurnace(TileElectricFurnace tileGrinder, EntityPlayer player)
{
super();
tile = tileGrinder;
this.player = player;
// input
this.addSlotToContainer(new Slot(tileGrinder.inventory, 0, 56, 34));
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 1, 116, 34));
// input
this.addSlotToContainer(new Slot(tileGrinder.inventory, 0, 56, 34));
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 1, 116, 34));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 2, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 3, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 4, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 5, 152, 62));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 2, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 3, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 4, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 5, 152, 62));
int i;
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_)
{
return true;
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_) {
return true;
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value) {
if (id == 10) {
this.connectionStatus = value;
}
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value)
{
if (id == 10)
{
this.connectionStatus = value;
}
}
}

View file

@ -1,82 +1,82 @@
package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.client.gui.SlotOutput;
import techreborn.api.SlotUpgrade;
import techreborn.tiles.teir1.TileExtractor;
public class ContainerExtractor extends ContainerCrafting {
public class ContainerExtractor extends ContainerCrafting
{
EntityPlayer player;
EntityPlayer player;
TileExtractor tile;
public int connectionStatus;
TileExtractor tile;
public ContainerExtractor(TileExtractor tileGrinder, EntityPlayer player) {
super(tileGrinder.crafter);
tile = tileGrinder;
this.player = player;
public int connectionStatus;
// input
this.addSlotToContainer(new Slot(tileGrinder.inventory, 0, 56, 34));
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 1, 116, 34));
public ContainerExtractor(TileExtractor tileGrinder, EntityPlayer player)
{
super(tileGrinder.crafter);
tile = tileGrinder;
this.player = player;
// input
this.addSlotToContainer(new Slot(tileGrinder.inventory, 0, 56, 34));
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 1, 116, 34));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 2, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 3, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 4, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 5, 152, 62));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 2, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 3, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 4, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 5, 152, 62));
int i;
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_) {
return true;
}
// @Override
// public void onCraftGuiOpened(ICrafting crafting) {
// super.onCraftGuiOpened(crafting);
// crafting.sendProgressBarUpdate(this, 0, (int) tile.getProgressScaled(0));
// crafting.sendProgressBarUpdate(this, 2, (int) tile.getEnergy());
// }
//
// @SideOnly(Side.CLIENT)
// @Override
// public void updateProgressBar(int id, int value) {
// if (id == 0) {
// this.progress = value;
// }
// else if (id == 2) {
// this.energy = value;
// }
// this.tile.setEnergy(energy);
// }
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_)
{
return true;
}
// @SideOnly(Side.CLIENT)
// @Override
// public void updateProgressBar(int id, int value) {
// if (id == 10) {
// this.connectionStatus = value;
// }
// }
// @Override
// public void onCraftGuiOpened(ICrafting crafting) {
// super.onCraftGuiOpened(crafting);
// crafting.sendProgressBarUpdate(this, 0, (int) tile.getProgressScaled(0));
// crafting.sendProgressBarUpdate(this, 2, (int) tile.getEnergy());
// }
//
// @SideOnly(Side.CLIENT)
// @Override
// public void updateProgressBar(int id, int value) {
// if (id == 0) {
// this.progress = value;
// }
// else if (id == 2) {
// this.energy = value;
// }
// this.tile.setEnergy(energy);
// }
// @SideOnly(Side.CLIENT)
// @Override
// public void updateProgressBar(int id, int value) {
// if (id == 10) {
// this.connectionStatus = value;
// }
// }
}

View file

@ -9,106 +9,127 @@ import reborncore.client.gui.SlotOutput;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.fusionReactor.TileEntityFusionController;
public class ContainerFusionReactor extends RebornContainer
{
public class ContainerFusionReactor extends RebornContainer {
public int coilStatus;
public int energy;
public int tickTime;
public int finalTickTime;
public int neededEU;
public int coilStatus;
public int energy;
public int tickTime;
public int finalTickTime;
public int neededEU;
TileEntityFusionController fusionController;
TileEntityFusionController fusionController;
public ContainerFusionReactor(TileEntityFusionController tileEntityFusionController, EntityPlayer player)
{
super();
this.fusionController = tileEntityFusionController;
public ContainerFusionReactor(TileEntityFusionController tileEntityFusionController,
EntityPlayer player) {
super();
this.fusionController = tileEntityFusionController;
addSlotToContainer(new Slot(tileEntityFusionController, 0, 88, 17));
addSlotToContainer(new Slot(tileEntityFusionController, 1, 88, 53));
addSlotToContainer(new SlotOutput(tileEntityFusionController, 2, 148, 35));
addSlotToContainer(new Slot(tileEntityFusionController, 0, 88, 17));
addSlotToContainer(new Slot(tileEntityFusionController, 1, 88, 53));
addSlotToContainer(new SlotOutput(tileEntityFusionController, 2, 148, 35));
int i;
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++)
{
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.coilStatus != fusionController.coilStatus)
{
icrafting.sendProgressBarUpdate(this, 0, fusionController.coilStatus);
}
if (this.energy != (int) fusionController.getEnergy())
{
icrafting.sendProgressBarUpdate(this, 1, (int) fusionController.getEnergy());
}
if (this.tickTime != fusionController.crafingTickTime)
{
icrafting.sendProgressBarUpdate(this, 2, fusionController.crafingTickTime);
}
if (this.finalTickTime != fusionController.finalTickTime)
{
icrafting.sendProgressBarUpdate(this, 3, fusionController.finalTickTime);
}
if (this.neededEU != fusionController.neededPower)
{
icrafting.sendProgressBarUpdate(this, 4, fusionController.neededPower);
}
}
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++) {
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.coilStatus != fusionController.coilStatus) {
icrafting.sendProgressBarUpdate(this, 0, fusionController.coilStatus);
}
if (this.energy != (int) fusionController.getEnergy()) {
icrafting.sendProgressBarUpdate(this, 1, (int) fusionController.getEnergy());
}
if (this.tickTime != fusionController.crafingTickTime) {
icrafting.sendProgressBarUpdate(this, 2, fusionController.crafingTickTime);
}
if (this.finalTickTime != fusionController.finalTickTime) {
icrafting.sendProgressBarUpdate(this, 3, fusionController.finalTickTime);
}
if (this.neededEU != fusionController.neededPower) {
icrafting.sendProgressBarUpdate(this, 4, fusionController.neededPower);
}
}
}
@Override
public void onCraftGuiOpened(ICrafting crafting)
{
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 0, fusionController.coilStatus);
crafting.sendProgressBarUpdate(this, 1, (int) fusionController.getEnergy());
crafting.sendProgressBarUpdate(this, 2, fusionController.crafingTickTime);
crafting.sendProgressBarUpdate(this, 3, fusionController.finalTickTime);
crafting.sendProgressBarUpdate(this, 4, fusionController.neededPower);
}
@Override
public void onCraftGuiOpened(ICrafting crafting) {
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 0, fusionController.coilStatus);
crafting.sendProgressBarUpdate(this, 1, (int) fusionController.getEnergy());
crafting.sendProgressBarUpdate(this, 2, fusionController.crafingTickTime);
crafting.sendProgressBarUpdate(this, 3, fusionController.finalTickTime);
crafting.sendProgressBarUpdate(this, 4, fusionController.neededPower);
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value)
{
if (id == 0)
{
this.coilStatus = value;
} else if (id == 1)
{
this.energy = value;
} else if (id == 2)
{
this.tickTime = value;
} else if (id == 3)
{
this.finalTickTime = value;
} else if (id == 4)
{
this.neededEU = value;
}
if (tickTime == -1)
{
tickTime = 0;
}
if (finalTickTime == -1)
{
finalTickTime = 0;
}
if (neededEU == -1)
{
neededEU = 0;
}
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value) {
if (id == 0) {
this.coilStatus = value;
} else if (id == 1) {
this.energy = value;
} else if(id == 2){
this.tickTime = value;
} else if(id == 3){
this.finalTickTime = value;
} else if(id == 4){
this.neededEU = value;
}
if(tickTime == -1){
tickTime = 0;
}
if(finalTickTime == -1){
finalTickTime = 0;
}
if(neededEU == -1){
neededEU = 0;
}
}
public int getProgressScaled(){
return Math.max(0, Math.min(24, (this.tickTime > 0 ? 1 : 0) + this.tickTime * 24 / (this.finalTickTime < 1 ? 1 : this.finalTickTime)));
}
public int getProgressScaled()
{
return Math.max(0, Math.min(24,
(this.tickTime > 0 ? 1 : 0) + this.tickTime * 24 / (this.finalTickTime < 1 ? 1 : this.finalTickTime)));
}
}

View file

@ -7,40 +7,40 @@ import reborncore.client.gui.SlotOutput;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.generator.TileGasTurbine;
public class ContainerGasTurbine extends RebornContainer {
public TileGasTurbine tileGasTurbine;
public EntityPlayer player;
public class ContainerGasTurbine extends RebornContainer
{
public TileGasTurbine tileGasTurbine;
public EntityPlayer player;
public ContainerGasTurbine(TileGasTurbine tileGasTurbine,
EntityPlayer player) {
super();
this.tileGasTurbine = tileGasTurbine;
this.player = player;
public ContainerGasTurbine(TileGasTurbine tileGasTurbine, EntityPlayer player)
{
super();
this.tileGasTurbine = tileGasTurbine;
this.player = player;
this.addSlotToContainer(new Slot(tileGasTurbine.inventory, 0, 80,
17));
this.addSlotToContainer(new SlotOutput(tileGasTurbine.inventory,
1, 80, 53));
this.addSlotToContainer(new SlotFake(tileGasTurbine.inventory, 2,
59, 42, false, false, 1));
this.addSlotToContainer(new Slot(tileGasTurbine.inventory, 0, 80, 17));
this.addSlotToContainer(new SlotOutput(tileGasTurbine.inventory, 1, 80, 53));
this.addSlotToContainer(new SlotFake(tileGasTurbine.inventory, 2, 59, 42, false, false, 1));
int i;
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
}

View file

@ -9,89 +9,103 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.generator.TileGenerator;
public class ContainerGenerator extends RebornContainer {
public class ContainerGenerator extends RebornContainer
{
EntityPlayer player;
EntityPlayer player;
TileGenerator tile;
TileGenerator tile;
public int burnTime = 0;
public int totalBurnTime = 0;
public int energy;
public int burnTime = 0;
public int totalBurnTime = 0;
public int energy;
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
public int tickTime;
public int tickTime;
public ContainerGenerator(TileGenerator tile, EntityPlayer player) {
super();
this.tile = tile;
this.player = player;
public ContainerGenerator(TileGenerator tile, EntityPlayer player)
{
super();
this.tile = tile;
this.player = player;
// fuel
this.addSlotToContainer(new Slot(tile.inventory, 0, 80, 53));
// charge
this.addSlotToContainer(new SlotFurnaceFuel(tile.inventory, 1, 80, 17));
// fuel
this.addSlotToContainer(new Slot(tile.inventory, 0, 80, 53));
// charge
this.addSlotToContainer(new SlotFurnaceFuel(tile.inventory, 1, 80, 17));
int i;
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++)
{
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.burnTime != tile.burnTime)
{
icrafting.sendProgressBarUpdate(this, 0, tile.burnTime);
}
if (this.totalBurnTime != tile.totalBurnTime)
{
icrafting.sendProgressBarUpdate(this, 1, tile.totalBurnTime);
}
if (this.energy != (int) tile.getEnergy())
{
icrafting.sendProgressBarUpdate(this, 2, (int) tile.getEnergy());
}
}
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++) {
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.burnTime != tile.burnTime) {
icrafting.sendProgressBarUpdate(this, 0, tile.burnTime);
}
if (this.totalBurnTime != tile.totalBurnTime) {
icrafting.sendProgressBarUpdate(this, 1, tile.totalBurnTime);
}
if (this.energy != (int) tile.getEnergy()) {
icrafting.sendProgressBarUpdate(this, 2, (int) tile.getEnergy());
}
}
}
@Override
public void onCraftGuiOpened(ICrafting crafting)
{
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 0, tile.burnTime);
crafting.sendProgressBarUpdate(this, 1, tile.totalBurnTime);
crafting.sendProgressBarUpdate(this, 2, (int) tile.getEnergy());
}
@Override
public void onCraftGuiOpened(ICrafting crafting) {
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 0, tile.burnTime);
crafting.sendProgressBarUpdate(this, 1, tile.totalBurnTime);
crafting.sendProgressBarUpdate(this, 2, (int) tile.getEnergy());
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value)
{
if (id == 0)
{
this.burnTime = value;
} else if (id == 1)
{
this.totalBurnTime = value;
} else if (id == 2)
{
this.energy = value;
}
this.tile.setEnergy(energy);
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value) {
if (id == 0) {
this.burnTime = value;
} else if (id == 1) {
this.totalBurnTime = value;
} else if (id == 2) {
this.energy = value;
}
this.tile.setEnergy(energy);
}
public int getScaledBurnTime(int i) {
return (int) (((float) burnTime / (float) totalBurnTime) * i);
}
public int getScaledBurnTime(int i)
{
return (int) (((float) burnTime / (float) totalBurnTime) * i);
}
}

View file

@ -2,53 +2,54 @@ package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.client.gui.SlotOutput;
import techreborn.api.SlotUpgrade;
import techreborn.tiles.teir1.TileGrinder;
public class ContainerGrinder extends ContainerCrafting {
public class ContainerGrinder extends ContainerCrafting
{
EntityPlayer player;
EntityPlayer player;
TileGrinder tile;
TileGrinder tile;
public int connectionStatus;
public int connectionStatus;
public ContainerGrinder(TileGrinder tileGrinder, EntityPlayer player) {
super(tileGrinder.crafter);
tile = tileGrinder;
this.player = player;
public ContainerGrinder(TileGrinder tileGrinder, EntityPlayer player)
{
super(tileGrinder.crafter);
tile = tileGrinder;
this.player = player;
// input
this.addSlotToContainer(new Slot(tileGrinder.inventory, 0, 56, 34));
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 1, 116, 34));
// input
this.addSlotToContainer(new Slot(tileGrinder.inventory, 0, 56, 34));
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 1, 116, 34));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 2, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 3, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 4, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 5, 152, 62));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 2, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 3, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 4, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 5, 152, 62));
int i;
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_)
{
return true;
}
}

View file

@ -8,80 +8,93 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.idsu.TileIDSU;
public class ContainerIDSU extends RebornContainer
{
public class ContainerIDSU extends RebornContainer {
EntityPlayer player;
EntityPlayer player;
TileIDSU tile;
TileIDSU tile;
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
public int euOut;
public int storedEu;
public int euChange;
public int channel;
public int euOut;
public int storedEu;
public int euChange;
public int channel;
public ContainerIDSU(TileIDSU tileIDSU, EntityPlayer player)
{
tile = tileIDSU;
this.player = player;
public ContainerIDSU(TileIDSU tileIDSU,
EntityPlayer player) {
tile = tileIDSU;
this.player = player;
int i;
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++)
{
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.euOut != tile.output)
{
icrafting.sendProgressBarUpdate(this, 0, tile.output);
}
if (this.storedEu != (int) tile.getEnergy())
{
icrafting.sendProgressBarUpdate(this, 1, (int) tile.getEnergy());
}
if (this.euChange != tile.getEuChange() && tile.getEuChange() != -1)
{
icrafting.sendProgressBarUpdate(this, 2, (int) tile.getEuChange());
}
}
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++) {
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.euOut != tile.output) {
icrafting.sendProgressBarUpdate(this, 0, tile.output);
}
if (this.storedEu != (int) tile.getEnergy()) {
icrafting.sendProgressBarUpdate(this, 1, (int) tile.getEnergy());
}
if (this.euChange != tile.getEuChange() && tile.getEuChange() != -1) {
icrafting.sendProgressBarUpdate(this, 2, (int) tile.getEuChange());
}
}
}
@Override
public void onCraftGuiOpened(ICrafting crafting)
{
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 0, tile.output);
crafting.sendProgressBarUpdate(this, 1, (int) tile.getEnergy());
crafting.sendProgressBarUpdate(this, 2, (int) tile.getEuChange());
}
@Override
public void onCraftGuiOpened(ICrafting crafting) {
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 0, tile.output);
crafting.sendProgressBarUpdate(this, 1, (int) tile.getEnergy());
crafting.sendProgressBarUpdate(this, 2, (int) tile.getEuChange());
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value) {
if (id == 0) {
this.euOut = value;
} else if (id == 1) {
this.storedEu = value;
} else if (id == 2) {
this.euChange = value;
} else if (id == 3) {
this.channel = value;
}
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value)
{
if (id == 0)
{
this.euOut = value;
} else if (id == 1)
{
this.storedEu = value;
} else if (id == 2)
{
this.euChange = value;
} else if (id == 3)
{
this.channel = value;
}
}
}

View file

@ -8,77 +8,85 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.client.gui.SlotOutput;
import techreborn.tiles.TileImplosionCompressor;
public class ContainerImplosionCompressor extends ContainerCrafting {
public class ContainerImplosionCompressor extends ContainerCrafting
{
EntityPlayer player;
EntityPlayer player;
TileImplosionCompressor tile;
TileImplosionCompressor tile;
public int tickTime;
public int multIBlockState = 0;
public int tickTime;
public int multIBlockState = 0;
public ContainerImplosionCompressor(TileImplosionCompressor tilecompressor,
EntityPlayer player) {
super(tilecompressor.crafter);
tile = tilecompressor;
this.player = player;
public ContainerImplosionCompressor(TileImplosionCompressor tilecompressor, EntityPlayer player)
{
super(tilecompressor.crafter);
tile = tilecompressor;
this.player = player;
// input
this.addSlotToContainer(new Slot(tilecompressor.inventory, 0, 37, 26));
this.addSlotToContainer(new Slot(tilecompressor.inventory, 1, 37, 44));
// outputs
this.addSlotToContainer(new SlotOutput(tilecompressor.inventory, 2, 93, 35));
this.addSlotToContainer(new SlotOutput(tilecompressor.inventory, 3, 111, 35));
// input
this.addSlotToContainer(new Slot(tilecompressor.inventory, 0, 37, 26));
this.addSlotToContainer(new Slot(tilecompressor.inventory, 1, 37, 44));
// outputs
this.addSlotToContainer(new SlotOutput(tilecompressor.inventory, 2, 93, 35));
this.addSlotToContainer(new SlotOutput(tilecompressor.inventory, 3, 111, 35));
int i;
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_)
{
return true;
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_) {
return true;
}
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++)
{
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.multIBlockState != getMultIBlockStateint())
{
icrafting.sendProgressBarUpdate(this, 3, getMultIBlockStateint());
}
}
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++) {
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.multIBlockState != getMultIBlockStateint()) {
icrafting.sendProgressBarUpdate(this, 3, getMultIBlockStateint());
}
}
}
@Override
public void onCraftGuiOpened(ICrafting crafting)
{
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 3, getMultIBlockStateint());
}
@Override
public void onCraftGuiOpened(ICrafting crafting) {
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 3, getMultIBlockStateint());
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value) {
if (id == 3) {
this.multIBlockState = value;
}
}
public int getMultIBlockStateint(){
return tile.getMutliBlock() ? 1 : 0;
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value)
{
if (id == 3)
{
this.multIBlockState = value;
}
}
public int getMultIBlockStateint()
{
return tile.getMutliBlock() ? 1 : 0;
}
}

View file

@ -5,48 +5,52 @@ import net.minecraft.inventory.Slot;
import reborncore.client.gui.SlotOutput;
import techreborn.tiles.TileIndustrialElectrolyzer;
public class ContainerIndustrialElectrolyzer extends ContainerCrafting {
public class ContainerIndustrialElectrolyzer extends ContainerCrafting
{
EntityPlayer player;
EntityPlayer player;
TileIndustrialElectrolyzer tile;
TileIndustrialElectrolyzer tile;
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
public int tickTime;
public int tickTime;
public ContainerIndustrialElectrolyzer(TileIndustrialElectrolyzer electrolyzer, EntityPlayer player) {
super(electrolyzer.crafter);
tile = electrolyzer;
this.player = player;
public ContainerIndustrialElectrolyzer(TileIndustrialElectrolyzer electrolyzer, EntityPlayer player)
{
super(electrolyzer.crafter);
tile = electrolyzer;
this.player = player;
// input
this.addSlotToContainer(new Slot(electrolyzer.inventory, 0, 80, 51));
this.addSlotToContainer(new Slot(electrolyzer.inventory, 1, 50, 51));
// outputs
this.addSlotToContainer(new SlotOutput(electrolyzer.inventory, 2, 50, 19));
this.addSlotToContainer(new SlotOutput(electrolyzer.inventory, 3, 70, 19));
this.addSlotToContainer(new SlotOutput(electrolyzer.inventory, 4, 90, 19));
this.addSlotToContainer(new SlotOutput(electrolyzer.inventory, 5, 110, 19));
// battery
this.addSlotToContainer(new Slot(electrolyzer.inventory, 6, 18, 51));
// input
this.addSlotToContainer(new Slot(electrolyzer.inventory, 0, 80, 51));
this.addSlotToContainer(new Slot(electrolyzer.inventory, 1, 50, 51));
// outputs
this.addSlotToContainer(new SlotOutput(electrolyzer.inventory, 2, 50, 19));
this.addSlotToContainer(new SlotOutput(electrolyzer.inventory, 3, 70, 19));
this.addSlotToContainer(new SlotOutput(electrolyzer.inventory, 4, 90, 19));
this.addSlotToContainer(new SlotOutput(electrolyzer.inventory, 5, 110, 19));
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
// battery
this.addSlotToContainer(new Slot(electrolyzer.inventory, 6, 18, 51));
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
}

View file

@ -8,74 +8,82 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.client.gui.SlotOutput;
import techreborn.tiles.TileIndustrialGrinder;
public class ContainerIndustrialGrinder extends ContainerCrafting {
public class ContainerIndustrialGrinder extends ContainerCrafting
{
EntityPlayer player;
EntityPlayer player;
TileIndustrialGrinder tile;
TileIndustrialGrinder tile;
public int connectionStatus;
public int connectionStatus;
public ContainerIndustrialGrinder(TileIndustrialGrinder tileGrinder,
EntityPlayer player) {
super(tileGrinder.crafter);
tile = tileGrinder;
this.player = player;
public ContainerIndustrialGrinder(TileIndustrialGrinder tileGrinder, EntityPlayer player)
{
super(tileGrinder.crafter);
tile = tileGrinder;
this.player = player;
// input
this.addSlotToContainer(new Slot(tileGrinder.inventory, 0, 32, 26));
this.addSlotToContainer(new Slot(tileGrinder.inventory, 1, 32, 44));
// input
this.addSlotToContainer(new Slot(tileGrinder.inventory, 0, 32, 26));
this.addSlotToContainer(new Slot(tileGrinder.inventory, 1, 32, 44));
// outputs
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 2, 77, 35));
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 3, 95, 35));
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 4, 113, 35));
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 5, 131, 35));
// outputs
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 2, 77, 35));
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 3, 95, 35));
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 4, 113, 35));
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 5, 131, 35));
int i;
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_)
{
return true;
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_) {
return true;
}
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++)
{
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.connectionStatus != tile.connectionStatus)
{
icrafting.sendProgressBarUpdate(this, 10, tile.connectionStatus);
}
}
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++) {
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.connectionStatus != tile.connectionStatus) {
icrafting.sendProgressBarUpdate(this, 10, tile.connectionStatus);
}
}
}
@Override
public void onCraftGuiOpened(ICrafting crafting)
{
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 10, tile.connectionStatus);
}
@Override
public void onCraftGuiOpened(ICrafting crafting) {
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 10, tile.connectionStatus);
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value) {
if (id == 10) {
this.connectionStatus = value;
}
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value)
{
if (id == 10)
{
this.connectionStatus = value;
}
}
}

View file

@ -5,47 +5,49 @@ import net.minecraft.inventory.Slot;
import reborncore.client.gui.SlotOutput;
import techreborn.tiles.TileIndustrialSawmill;
public class ContainerIndustrialSawmill extends ContainerCrafting {
public class ContainerIndustrialSawmill extends ContainerCrafting
{
EntityPlayer player;
EntityPlayer player;
TileIndustrialSawmill tile;
TileIndustrialSawmill tile;
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
public int tickTime;
public int tickTime;
public ContainerIndustrialSawmill(TileIndustrialSawmill tileIndustrialSawmill,
EntityPlayer player) {
super(tileIndustrialSawmill.crafter);
tile = tileIndustrialSawmill;
this.player = player;
public ContainerIndustrialSawmill(TileIndustrialSawmill tileIndustrialSawmill, EntityPlayer player)
{
super(tileIndustrialSawmill.crafter);
tile = tileIndustrialSawmill;
this.player = player;
// input
this.addSlotToContainer(new Slot(tileIndustrialSawmill.inventory, 0, 32, 26));
this.addSlotToContainer(new Slot(tileIndustrialSawmill.inventory, 1, 32, 44));
// outputs
this.addSlotToContainer(new SlotOutput(tileIndustrialSawmill.inventory, 2, 84, 35));
this.addSlotToContainer(new SlotOutput(tileIndustrialSawmill.inventory, 3, 102, 35));
this.addSlotToContainer(new SlotOutput(tileIndustrialSawmill.inventory, 4, 120, 35));
// input
this.addSlotToContainer(new Slot(tileIndustrialSawmill.inventory, 0, 32, 26));
this.addSlotToContainer(new Slot(tileIndustrialSawmill.inventory, 1, 32, 44));
// outputs
this.addSlotToContainer(new SlotOutput(tileIndustrialSawmill.inventory, 2, 84, 35));
this.addSlotToContainer(new SlotOutput(tileIndustrialSawmill.inventory, 3, 102, 35));
this.addSlotToContainer(new SlotOutput(tileIndustrialSawmill.inventory, 4, 120, 35));
int i;
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
}

View file

@ -9,50 +9,56 @@ import reborncore.client.gui.SlotOutput;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.TileIronFurnace;
public class ContainerIronFurnace extends RebornContainer {
public class ContainerIronFurnace extends RebornContainer
{
EntityPlayer player;
EntityPlayer player;
TileIronFurnace tile;
TileIronFurnace tile;
public int connectionStatus;
public int connectionStatus;
public ContainerIronFurnace(TileIronFurnace tileGrinder, EntityPlayer player) {
super();
tile = tileGrinder;
this.player = player;
public ContainerIronFurnace(TileIronFurnace tileGrinder, EntityPlayer player)
{
super();
tile = tileGrinder;
this.player = player;
// input
this.addSlotToContainer(new Slot(tileGrinder.inventory, 0, 56, 17));
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 1, 116, 34));
//Fuel
this.addSlotToContainer(new SlotFurnaceFuel(tileGrinder.inventory, 2, 56, 53));
// input
this.addSlotToContainer(new Slot(tileGrinder.inventory, 0, 56, 17));
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 1, 116, 34));
// Fuel
this.addSlotToContainer(new SlotFurnaceFuel(tileGrinder.inventory, 2, 56, 53));
int i;
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value) {
if (id == 10) {
this.connectionStatus = value;
}
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value)
{
if (id == 10)
{
this.connectionStatus = value;
}
}
}

View file

@ -9,81 +9,91 @@ import reborncore.client.gui.SlotOutput;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.TileMatterFabricator;
public class ContainerMatterFabricator extends RebornContainer {
public class ContainerMatterFabricator extends RebornContainer
{
EntityPlayer player;
EntityPlayer player;
TileMatterFabricator tile;
TileMatterFabricator tile;
public int progressTime;
public int progressTime;
public ContainerMatterFabricator(TileMatterFabricator tileMatterfab,
EntityPlayer player) {
tile = tileMatterfab;
this.player = player;
public ContainerMatterFabricator(TileMatterFabricator tileMatterfab, EntityPlayer player)
{
tile = tileMatterfab;
this.player = player;
// input
this.addSlotToContainer(new Slot(tileMatterfab.inventory, 0, 33, 17));
this.addSlotToContainer(new Slot(tileMatterfab.inventory, 1, 33, 35));
this.addSlotToContainer(new Slot(tileMatterfab.inventory, 2, 33, 53));
this.addSlotToContainer(new Slot(tileMatterfab.inventory, 3, 51, 17));
this.addSlotToContainer(new Slot(tileMatterfab.inventory, 4, 51, 35));
this.addSlotToContainer(new Slot(tileMatterfab.inventory, 5, 51, 53));
// input
this.addSlotToContainer(new Slot(tileMatterfab.inventory, 0, 33, 17));
this.addSlotToContainer(new Slot(tileMatterfab.inventory, 1, 33, 35));
this.addSlotToContainer(new Slot(tileMatterfab.inventory, 2, 33, 53));
this.addSlotToContainer(new Slot(tileMatterfab.inventory, 3, 51, 17));
this.addSlotToContainer(new Slot(tileMatterfab.inventory, 4, 51, 35));
this.addSlotToContainer(new Slot(tileMatterfab.inventory, 5, 51, 53));
// outputs
this.addSlotToContainer(new SlotOutput(tileMatterfab.inventory, 6,
116, 35));
// outputs
this.addSlotToContainer(new SlotOutput(tileMatterfab.inventory, 6, 116, 35));
int i;
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_)
{
return true;
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++) {
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.progressTime != tile.progresstime) {
icrafting.sendProgressBarUpdate(this, 0, tile.progresstime);
}
}
}
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++)
{
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.progressTime != tile.progresstime)
{
icrafting.sendProgressBarUpdate(this, 0, tile.progresstime);
}
}
}
@Override
public void onCraftGuiOpened(ICrafting crafting) {
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 0, tile.progresstime);
}
@Override
public void onCraftGuiOpened(ICrafting crafting)
{
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 0, tile.progresstime);
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value) {
if (id == 0) {
this.progressTime = value;
}
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value)
{
if (id == 0)
{
this.progressTime = value;
}
}
public int getProgressScaled(int scale) {
if (progressTime != 0) {
return progressTime * scale / tile.maxProgresstime();
}
return 0;
}
public int getProgressScaled(int scale)
{
if (progressTime != 0)
{
return progressTime * scale / tile.maxProgresstime();
}
return 0;
}
}

View file

@ -3,17 +3,20 @@ package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import reborncore.common.container.RebornContainer;
public class ContainerPda extends RebornContainer {
public class ContainerPda extends RebornContainer
{
EntityPlayer player;
EntityPlayer player;
public ContainerPda(EntityPlayer player) {
public ContainerPda(EntityPlayer player)
{
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
}

View file

@ -7,40 +7,41 @@ import reborncore.client.gui.SlotOutput;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.TileQuantumChest;
public class ContainerQuantumChest extends RebornContainer {
public TileQuantumChest tileQuantumChest;
public EntityPlayer player;
public class ContainerQuantumChest extends RebornContainer
{
public TileQuantumChest tileQuantumChest;
public EntityPlayer player;
public ContainerQuantumChest(TileQuantumChest tileQuantumChest,
EntityPlayer player) {
super();
this.tileQuantumChest = tileQuantumChest;
this.player = player;
public ContainerQuantumChest(TileQuantumChest tileQuantumChest, EntityPlayer player)
{
super();
this.tileQuantumChest = tileQuantumChest;
this.player = player;
this.addSlotToContainer(new Slot(tileQuantumChest.inventory, 0, 80, 17));
this.addSlotToContainer(new SlotOutput(tileQuantumChest.inventory, 1,
80, 53));
this.addSlotToContainer(new SlotFake(tileQuantumChest.inventory, 2, 59,
42, false, false, Integer.MAX_VALUE));
this.addSlotToContainer(new Slot(tileQuantumChest.inventory, 0, 80, 17));
this.addSlotToContainer(new SlotOutput(tileQuantumChest.inventory, 1, 80, 53));
this.addSlotToContainer(new SlotFake(tileQuantumChest.inventory, 2, 59, 42, false, false, Integer.MAX_VALUE));
int i;
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
}

View file

@ -8,39 +8,40 @@ import reborncore.client.gui.SlotOutput;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.TileQuantumTank;
public class ContainerQuantumTank extends RebornContainer {
public TileQuantumTank tileQuantumTank;
public EntityPlayer player;
public class ContainerQuantumTank extends RebornContainer
{
public TileQuantumTank tileQuantumTank;
public EntityPlayer player;
public ContainerQuantumTank(TileQuantumTank tileQuantumTank,
EntityPlayer player) {
super();
this.tileQuantumTank = tileQuantumTank;
this.player = player;
public ContainerQuantumTank(TileQuantumTank tileQuantumTank, EntityPlayer player)
{
super();
this.tileQuantumTank = tileQuantumTank;
this.player = player;
this.addSlotToContainer(new SlotFluid(tileQuantumTank.inventory, 0, 80, 17));
this.addSlotToContainer(new SlotOutput(tileQuantumTank.inventory, 1,
80, 53));
this.addSlotToContainer(new SlotFake(tileQuantumTank.inventory, 2, 59,
42, false, false, 1));
this.addSlotToContainer(new SlotFluid(tileQuantumTank.inventory, 0, 80, 17));
this.addSlotToContainer(new SlotOutput(tileQuantumTank.inventory, 1, 80, 53));
this.addSlotToContainer(new SlotFake(tileQuantumTank.inventory, 2, 59, 42, false, false, 1));
int i;
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
}

View file

@ -9,55 +9,60 @@ import reborncore.common.container.RebornContainer;
import techreborn.api.SlotUpgrade;
import techreborn.tiles.teir1.TileRecycler;
public class ContainerRecycler extends RebornContainer {
public class ContainerRecycler extends RebornContainer
{
EntityPlayer player;
EntityPlayer player;
TileRecycler tile;
TileRecycler tile;
public int connectionStatus;
public int connectionStatus;
public ContainerRecycler(TileRecycler tileGrinder, EntityPlayer player) {
super();
tile = tileGrinder;
this.player = player;
public ContainerRecycler(TileRecycler tileGrinder, EntityPlayer player)
{
super();
tile = tileGrinder;
this.player = player;
// input
this.addSlotToContainer(new Slot(tileGrinder.inventory, 0, 56, 34));
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 1, 116, 34));
// input
this.addSlotToContainer(new Slot(tileGrinder.inventory, 0, 56, 34));
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 1, 116, 34));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 2, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 3, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 4, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 5, 152, 62));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 2, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 3, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 4, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 5, 152, 62));
int i;
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_)
{
return true;
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_) {
return true;
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value) {
if (id == 10) {
this.connectionStatus = value;
}
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value)
{
if (id == 10)
{
this.connectionStatus = value;
}
}
}

View file

@ -10,107 +10,125 @@ import reborncore.common.container.RebornContainer;
import techreborn.api.RollingMachineRecipe;
import techreborn.tiles.TileRollingMachine;
public class ContainerRollingMachine extends RebornContainer {
public class ContainerRollingMachine extends RebornContainer
{
EntityPlayer player;
TileRollingMachine tile;
EntityPlayer player;
TileRollingMachine tile;
public ContainerRollingMachine(TileRollingMachine tileRollingmachine, EntityPlayer player) {
tile = tileRollingmachine;
this.player = player;
public ContainerRollingMachine(TileRollingMachine tileRollingmachine, EntityPlayer player)
{
tile = tileRollingmachine;
this.player = player;
for (int l = 0; l < 3; l++) {
for (int k1 = 0; k1 < 3; k1++) {
this.addSlotToContainer(new Slot(
tileRollingmachine.craftMatrix, k1 + l * 3,
30 + k1 * 18, 17 + l * 18));
}
}
for (int l = 0; l < 3; l++)
{
for (int k1 = 0; k1 < 3; k1++)
{
this.addSlotToContainer(
new Slot(tileRollingmachine.craftMatrix, k1 + l * 3, 30 + k1 * 18, 17 + l * 18));
}
}
// output
this.addSlotToContainer(new SlotOutput(tileRollingmachine.inventory, 0, 124, 35));
// battery
this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 2, 8, 51));
// output
this.addSlotToContainer(new SlotOutput(tileRollingmachine.inventory, 0, 124, 35));
// battery
this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 2, 8, 51));
int i;
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
@Override
public final void onCraftMatrixChanged(IInventory inv) {
ItemStack output = RollingMachineRecipe.instance.findMatchingRecipe(
tile.craftMatrix, tile.getWorld());
tile.inventory.setInventorySlotContents(1, output);
}
@Override
public final void onCraftMatrixChanged(IInventory inv)
{
ItemStack output = RollingMachineRecipe.instance.findMatchingRecipe(tile.craftMatrix, tile.getWorld());
tile.inventory.setInventorySlotContents(1, output);
}
int currentItemBurnTime;
int burnTime;
int energy;
int currentItemBurnTime;
int burnTime;
int energy;
@Override
public void onCraftGuiOpened(ICrafting crafting) {
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 0, tile.runTime);
crafting.sendProgressBarUpdate(this, 1, tile.tickTime);
crafting.sendProgressBarUpdate(this, 2, (int) tile.getEnergy());
}
@Override
public void onCraftGuiOpened(ICrafting crafting)
{
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 0, tile.runTime);
crafting.sendProgressBarUpdate(this, 1, tile.tickTime);
crafting.sendProgressBarUpdate(this, 2, (int) tile.getEnergy());
}
@Override
public void detectAndSendChanges() {
for (int i = 0; i < this.crafters.size(); i++) {
ICrafting crafting = (ICrafting) this.crafters.get(i);
if (this.currentItemBurnTime != tile.runTime) {
crafting.sendProgressBarUpdate(this, 0, tile.runTime);
}
if (this.burnTime != tile.tickTime || tile.tickTime == -1) {
crafting.sendProgressBarUpdate(this, 1, tile.tickTime);
}
if (this.energy != (int) tile.getEnergy()) {
crafting.sendProgressBarUpdate(this, 2, (int) tile.getEnergy());
}
}
super.detectAndSendChanges();
}
@Override
public void detectAndSendChanges()
{
for (int i = 0; i < this.crafters.size(); i++)
{
ICrafting crafting = (ICrafting) this.crafters.get(i);
if (this.currentItemBurnTime != tile.runTime)
{
crafting.sendProgressBarUpdate(this, 0, tile.runTime);
}
if (this.burnTime != tile.tickTime || tile.tickTime == -1)
{
crafting.sendProgressBarUpdate(this, 1, tile.tickTime);
}
if (this.energy != (int) tile.getEnergy())
{
crafting.sendProgressBarUpdate(this, 2, (int) tile.getEnergy());
}
}
super.detectAndSendChanges();
}
@Override
public void updateProgressBar(int id, int value) {
super.updateProgressBar(id, value);
if (id == 0) {
this.currentItemBurnTime = value;
} else if (id == 1) {
this.burnTime = value;
} else if (id == 2) {
this.energy = value;
}
this.tile.runTime = this.currentItemBurnTime;
if(this.burnTime == -1){
this.burnTime = 0;
}
this.tile.tickTime = this.burnTime;
this.tile.setEnergy(this.energy);
}
@Override
public void updateProgressBar(int id, int value)
{
super.updateProgressBar(id, value);
if (id == 0)
{
this.currentItemBurnTime = value;
} else if (id == 1)
{
this.burnTime = value;
} else if (id == 2)
{
this.energy = value;
}
this.tile.runTime = this.currentItemBurnTime;
if (this.burnTime == -1)
{
this.burnTime = 0;
}
this.tile.tickTime = this.burnTime;
this.tile.setEnergy(this.energy);
}
public int getBurnTimeRemainingScaled(int scale) {
if (burnTime == 0 || this.currentItemBurnTime == 0) {
return 0;
}
return this.burnTime * scale / this.currentItemBurnTime;
}
public int getBurnTimeRemainingScaled(int scale)
{
if (burnTime == 0 || this.currentItemBurnTime == 0)
{
return 0;
}
return this.burnTime * scale / this.currentItemBurnTime;
}
}

View file

@ -9,55 +9,60 @@ import reborncore.common.container.RebornContainer;
import techreborn.api.SlotUpgrade;
import techreborn.tiles.TileScrapboxinator;
public class ContainerScrapboxinator extends RebornContainer {
public class ContainerScrapboxinator extends RebornContainer
{
EntityPlayer player;
EntityPlayer player;
TileScrapboxinator tile;
TileScrapboxinator tile;
public int connectionStatus;
public int connectionStatus;
public ContainerScrapboxinator(TileScrapboxinator tileScrapboxinator, EntityPlayer player) {
super();
tile = tileScrapboxinator;
this.player = player;
public ContainerScrapboxinator(TileScrapboxinator tileScrapboxinator, EntityPlayer player)
{
super();
tile = tileScrapboxinator;
this.player = player;
// input
this.addSlotToContainer(new SlotScrapbox(tileScrapboxinator.inventory, 0, 56, 34));
this.addSlotToContainer(new SlotOutput(tileScrapboxinator.inventory, 1, 116, 34));
// input
this.addSlotToContainer(new SlotScrapbox(tileScrapboxinator.inventory, 0, 56, 34));
this.addSlotToContainer(new SlotOutput(tileScrapboxinator.inventory, 1, 116, 34));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tileScrapboxinator.inventory, 2, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tileScrapboxinator.inventory, 3, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tileScrapboxinator.inventory, 4, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tileScrapboxinator.inventory, 5, 152, 62));
// upgrades
this.addSlotToContainer(new SlotUpgrade(tileScrapboxinator.inventory, 2, 152, 8));
this.addSlotToContainer(new SlotUpgrade(tileScrapboxinator.inventory, 3, 152, 26));
this.addSlotToContainer(new SlotUpgrade(tileScrapboxinator.inventory, 4, 152, 44));
this.addSlotToContainer(new SlotUpgrade(tileScrapboxinator.inventory, 5, 152, 62));
int i;
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_)
{
return true;
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_) {
return true;
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value) {
if (id == 10) {
this.connectionStatus = value;
}
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value)
{
if (id == 10)
{
this.connectionStatus = value;
}
}
}

View file

@ -7,40 +7,40 @@ import reborncore.client.gui.SlotOutput;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.generator.TileSemifluidGenerator;
public class ContainerSemifluidGenerator extends RebornContainer {
public TileSemifluidGenerator tileSemifluidGenerator;
public EntityPlayer player;
public class ContainerSemifluidGenerator extends RebornContainer
{
public TileSemifluidGenerator tileSemifluidGenerator;
public EntityPlayer player;
public ContainerSemifluidGenerator(TileSemifluidGenerator tileSemifluidGenerator,
EntityPlayer player) {
super();
this.tileSemifluidGenerator = tileSemifluidGenerator;
this.player = player;
public ContainerSemifluidGenerator(TileSemifluidGenerator tileSemifluidGenerator, EntityPlayer player)
{
super();
this.tileSemifluidGenerator = tileSemifluidGenerator;
this.player = player;
this.addSlotToContainer(new Slot(tileSemifluidGenerator.inventory, 0, 80,
17));
this.addSlotToContainer(new SlotOutput(tileSemifluidGenerator.inventory,
1, 80, 53));
this.addSlotToContainer(new SlotFake(tileSemifluidGenerator.inventory, 2,
59, 42, false, false, 1));
this.addSlotToContainer(new Slot(tileSemifluidGenerator.inventory, 0, 80, 17));
this.addSlotToContainer(new SlotOutput(tileSemifluidGenerator.inventory, 1, 80, 53));
this.addSlotToContainer(new SlotFake(tileSemifluidGenerator.inventory, 2, 59, 42, false, false, 1));
int i;
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
}

View file

@ -8,40 +8,40 @@ import reborncore.client.gui.SlotOutput;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.generator.TileThermalGenerator;
public class ContainerThermalGenerator extends RebornContainer {
public TileThermalGenerator tileThermalGenerator;
public EntityPlayer player;
public class ContainerThermalGenerator extends RebornContainer
{
public TileThermalGenerator tileThermalGenerator;
public EntityPlayer player;
public ContainerThermalGenerator(TileThermalGenerator tileThermalGenerator,
EntityPlayer player) {
super();
this.tileThermalGenerator = tileThermalGenerator;
this.player = player;
public ContainerThermalGenerator(TileThermalGenerator tileThermalGenerator, EntityPlayer player)
{
super();
this.tileThermalGenerator = tileThermalGenerator;
this.player = player;
this.addSlotToContainer(new SlotFluid(tileThermalGenerator.inventory, 0, 80,
17));
this.addSlotToContainer(new SlotOutput(tileThermalGenerator.inventory,
1, 80, 53));
this.addSlotToContainer(new SlotFake(tileThermalGenerator.inventory, 2,
59, 42, false, false, 1));
this.addSlotToContainer(new SlotFluid(tileThermalGenerator.inventory, 0, 80, 17));
this.addSlotToContainer(new SlotOutput(tileThermalGenerator.inventory, 1, 80, 53));
this.addSlotToContainer(new SlotFake(tileThermalGenerator.inventory, 2, 59, 42, false, false, 1));
int i;
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
}

View file

@ -8,70 +8,79 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.client.gui.SlotOutput;
import techreborn.tiles.TileVacuumFreezer;
public class ContainerVacuumFreezer extends ContainerCrafting {
public class ContainerVacuumFreezer extends ContainerCrafting
{
EntityPlayer player;
EntityPlayer player;
TileVacuumFreezer tile;
TileVacuumFreezer tile;
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
public int tickTime;
public int machineStatus;
public int tickTime;
public int machineStatus;
public ContainerVacuumFreezer(TileVacuumFreezer tileAlloysmelter,
EntityPlayer player) {
super(tileAlloysmelter.crafter);
tile = tileAlloysmelter;
this.player = player;
public ContainerVacuumFreezer(TileVacuumFreezer tileAlloysmelter, EntityPlayer player)
{
super(tileAlloysmelter.crafter);
tile = tileAlloysmelter;
this.player = player;
// input
this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 0, 56, 34));
// outputs
this.addSlotToContainer(new SlotOutput(tileAlloysmelter.inventory, 1, 116, 35));
// input
this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 0, 56, 34));
// outputs
this.addSlotToContainer(new SlotOutput(tileAlloysmelter.inventory, 1, 116, 35));
int i;
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++) {
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.machineStatus != tile.multiBlockStatus) {
icrafting.sendProgressBarUpdate(this, 3, tile.multiBlockStatus);
}
}
}
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++)
{
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.machineStatus != tile.multiBlockStatus)
{
icrafting.sendProgressBarUpdate(this, 3, tile.multiBlockStatus);
}
}
}
@Override
public void onCraftGuiOpened(ICrafting crafting) {
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 3, tile.multiBlockStatus);
}
@Override
public void onCraftGuiOpened(ICrafting crafting)
{
super.onCraftGuiOpened(crafting);
crafting.sendProgressBarUpdate(this, 3, tile.multiBlockStatus);
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value) {
super.updateProgressBar(id, value);
if (id == 3) {
machineStatus = value;
}
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(int id, int value)
{
super.updateProgressBar(id, value);
if (id == 3)
{
machineStatus = value;
}
}
}

View file

@ -5,20 +5,25 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import techreborn.init.ModItems;
public class SlotScrapbox extends Slot {
public class SlotScrapbox extends Slot
{
public SlotScrapbox(IInventory par1iInventory, int par2, int par3, int par4) {
super(par1iInventory, par2, par3, par4);
}
public SlotScrapbox(IInventory par1iInventory, int par2, int par3, int par4)
{
super(par1iInventory, par2, par3, par4);
}
public boolean isItemValid(ItemStack par1ItemStack) {
if(par1ItemStack.getItem()==ModItems.scrapBox){
return true;
}
return false;
}
public boolean isItemValid(ItemStack par1ItemStack)
{
if (par1ItemStack.getItem() == ModItems.scrapBox)
{
return true;
}
return false;
}
public int getSlotStackLimit() {
return 64;
}
public int getSlotStackLimit()
{
return 64;
}
}

View file

@ -1,5 +1,8 @@
package techreborn.client.gui;
import java.awt.*;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
@ -12,54 +15,61 @@ import techreborn.client.container.ContainerAesu;
import techreborn.packets.PacketAesu;
import techreborn.tiles.TileAesu;
import java.awt.*;
import java.io.IOException;
public class GuiAesu extends GuiContainer
{
public class GuiAesu extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/aesu.png");
TileAesu aesu;
ContainerAesu containerAesu;
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/aesu.png");
TileAesu aesu;
ContainerAesu containerAesu;
public GuiAesu(EntityPlayer player, TileAesu tileaesu)
{
super(new ContainerAesu(tileaesu, player));
this.xSize = 176;
this.ySize = 197;
aesu = tileaesu;
this.containerAesu = (ContainerAesu) this.inventorySlots;
}
public GuiAesu(EntityPlayer player, TileAesu tileaesu) {
super(new ContainerAesu(tileaesu, player));
this.xSize = 176;
this.ySize = 197;
aesu = tileaesu;
this.containerAesu = (ContainerAesu) this.inventorySlots;
}
@Override
public void initGui()
{
super.initGui();
this.buttonList.clear();
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.buttonList.add(new GuiButton(0, k + 117, l + 20, 15, 15, "++"));
this.buttonList.add(new GuiButton(1, k + 117, l + 20 + 20, 15, 15, "+"));
this.buttonList.add(new GuiButton(2, k + 117, l + 20 + (20 * 2), 15, 15, "-"));
this.buttonList.add(new GuiButton(3, k + 117, l + 20 + (20 * 3), 15, 15, "--"));
}
@Override
public void initGui() {
super.initGui();
this.buttonList.clear();
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.buttonList.add(new GuiButton(0, k + 117, l + 20, 15, 15, "++"));
this.buttonList.add(new GuiButton(1, k + 117, l + 20 + 20, 15, 15, "+"));
this.buttonList.add(new GuiButton(2, k + 117, l + 20 + (20 * 2), 15, 15, "-"));
this.buttonList.add(new GuiButton(3, k + 117, l + 20 + (20 * 3), 15, 15, "--"));
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
this.fontRendererObj.drawString(I18n.translateToLocal("tile.techreborn.aesu.name"), 40, 10,
Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerAesu.euOut) + " /tick", 10, 20,
Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerAesu.storedEu) + " ", 10, 30,
Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerAesu.euChange) + " change", 10, 40,
Color.WHITE.getRGB());
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
this.fontRendererObj.drawString(I18n.translateToLocal("tile.techreborn.aesu.name"), 40, 10, Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerAesu.euOut) + " /tick", 10, 20, Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerAesu.storedEu) + " ", 10, 30, Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerAesu.euChange) + " change", 10, 40, Color.WHITE.getRGB());
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
super.actionPerformed(button);
PacketHandler.sendPacketToServer(new PacketAesu(button.id, aesu));
}
@Override
protected void actionPerformed(GuiButton button) throws IOException
{
super.actionPerformed(button);
PacketHandler.sendPacketToServer(new PacketAesu(button.id, aesu));
}
}

View file

@ -8,56 +8,58 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerAlloyFurnace;
import techreborn.tiles.TileAlloyFurnace;
public class GuiAlloyFurnace extends GuiContainer {
public class GuiAlloyFurnace extends GuiContainer
{
private static final ResourceLocation texture = new ResourceLocation(
"techreborn", "textures/gui/alloy_furnace.png");
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/alloy_furnace.png");
TileAlloyFurnace alloyfurnace;
TileAlloyFurnace alloyfurnace;
ContainerAlloyFurnace containerAlloyFurnace;
ContainerAlloyFurnace containerAlloyFurnace;
public GuiAlloyFurnace(EntityPlayer player,
TileAlloyFurnace tileAlloyFurnace) {
super(new ContainerAlloyFurnace(tileAlloyFurnace, player));
this.xSize = 176;
this.ySize = 167;
this.alloyfurnace = tileAlloyFurnace;
this.containerAlloyFurnace = (ContainerAlloyFurnace) this.inventorySlots;
}
public GuiAlloyFurnace(EntityPlayer player, TileAlloyFurnace tileAlloyFurnace)
{
super(new ContainerAlloyFurnace(tileAlloyFurnace, player));
this.xSize = 176;
this.ySize = 167;
this.alloyfurnace = tileAlloyFurnace;
this.containerAlloyFurnace = (ContainerAlloyFurnace) this.inventorySlots;
}
@Override
public void initGui() {
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
public void initGui()
{
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
if (this.alloyfurnace.isBurning()) {
int i1 = this.alloyfurnace.getBurnTimeRemainingScaled(13);
this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);
i1 = this.alloyfurnace.getCookProgressScaled(24);
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16);
}
}
if (this.alloyfurnace.isBurning())
{
int i1 = this.alloyfurnace.getBurnTimeRemainingScaled(13);
this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);
i1 = this.alloyfurnace.getCookProgressScaled(24);
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16);
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.alloyfurnace.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.alloyfurnace.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(
I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
}
}
}

View file

@ -8,50 +8,60 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerAlloySmelter;
import techreborn.tiles.TileAlloySmelter;
public class GuiAlloySmelter extends GuiContainer {
public class GuiAlloySmelter extends GuiContainer
{
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/electric_alloy_furnace.png");
public static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/electric_alloy_furnace.png");
TileAlloySmelter alloysmelter;
TileAlloySmelter alloysmelter;
public GuiAlloySmelter(EntityPlayer player, TileAlloySmelter tilealloysmelter) {
super(new ContainerAlloySmelter(tilealloysmelter, player));
this.xSize = 176;
this.ySize = 167;
alloysmelter = tilealloysmelter;
}
public GuiAlloySmelter(EntityPlayer player, TileAlloySmelter tilealloysmelter)
{
super(new ContainerAlloySmelter(tilealloysmelter, player));
this.xSize = 176;
this.ySize = 167;
alloysmelter = tilealloysmelter;
}
@Override
public void initGui() {
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
public void initGui()
{
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
int j = 0;
j = alloysmelter.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, j + 1, 16);
}
j = alloysmelter.getProgressScaled(24);
if (j > 0)
{
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, j + 1, 16);
}
j = alloysmelter.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
j = alloysmelter.getEnergyScaled(12);
if (j > 0)
{
this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.alloysmelter.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.alloysmelter.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
}
}

View file

@ -8,52 +8,62 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerAssemblingMachine;
import techreborn.tiles.TileAssemblingMachine;
public class GuiAssemblingMachine extends GuiContainer {
public class GuiAssemblingMachine extends GuiContainer
{
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/assembling_machine.png");
public static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/assembling_machine.png");
TileAssemblingMachine assemblingmachine;
ContainerAssemblingMachine containerAssemblingMachine;
TileAssemblingMachine assemblingmachine;
ContainerAssemblingMachine containerAssemblingMachine;
public GuiAssemblingMachine(EntityPlayer player, TileAssemblingMachine tileassemblinmachine) {
super(new ContainerAssemblingMachine(tileassemblinmachine, player));
containerAssemblingMachine = (ContainerAssemblingMachine) this.inventorySlots;
this.xSize = 176;
this.ySize = 167;
assemblingmachine = tileassemblinmachine;
}
public GuiAssemblingMachine(EntityPlayer player, TileAssemblingMachine tileassemblinmachine)
{
super(new ContainerAssemblingMachine(tileassemblinmachine, player));
containerAssemblingMachine = (ContainerAssemblingMachine) this.inventorySlots;
this.xSize = 176;
this.ySize = 167;
assemblingmachine = tileassemblinmachine;
}
@Override
public void initGui() {
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
public void initGui()
{
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
int j = 0;
j = assemblingmachine.getProgressScaled(20);
if (j > 0) {
this.drawTexturedModalRect(k + 86, l + 34, 176, 14, j + 1, 16);
}
j = assemblingmachine.getProgressScaled(20);
if (j > 0)
{
this.drawTexturedModalRect(k + 86, l + 34, 176, 14, j + 1, 16);
}
j = assemblingmachine.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
j = assemblingmachine.getEnergyScaled(12);
if (j > 0)
{
this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.assemblinmachine.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.assemblinmachine.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
}
}

View file

@ -6,60 +6,69 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import reborncore.common.powerSystem.PowerSystem;
import techreborn.client.container.ContainerBatbox;
import techreborn.client.container.ContainerGenerator;
import techreborn.tiles.generator.TileGenerator;
import techreborn.tiles.storage.TileBatBox;
public class GuiBatbox extends GuiContainer {
public class GuiBatbox extends GuiContainer
{
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/batbox.png");
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/batbox.png");
TileBatBox generator;
TileBatBox generator;
ContainerBatbox containerGenerator;
ContainerBatbox containerGenerator;
public GuiBatbox(EntityPlayer player, TileBatBox generator) {
super(new ContainerBatbox(generator, player));
this.xSize = 176;
this.ySize = 167;
this.generator = generator;
this.containerGenerator = (ContainerBatbox) this.inventorySlots;
}
public GuiBatbox(EntityPlayer player, TileBatBox generator)
{
super(new ContainerBatbox(generator, player));
this.xSize = 176;
this.ySize = 167;
this.generator = generator;
this.containerGenerator = (ContainerBatbox) this.inventorySlots;
}
@Override
public void initGui() {
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
public void initGui()
{
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
int j = 0;
j = generator.getEnergyScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 109, l + 21 + 12, 176, 0, j + 1, 16);
}
//
// if (containerGenerator.burnTime != 0)
// {
// j = containerGenerator.getScaledBurnTime(13);
// this.drawTexturedModalRect(k + 80, l + 38 + 12 - j, 176, 30 - j, 14, j + 1);
// }
}
j = generator.getEnergyScaled(24);
if (j > 0)
{
this.drawTexturedModalRect(k + 109, l + 21 + 12, 176, 0, j + 1, 16);
}
//
// if (containerGenerator.burnTime != 0)
// {
// j = containerGenerator.getScaledBurnTime(13);
// this.drawTexturedModalRect(k + 80, l + 38 + 12 - j, 176, 30 - j, 14,
// j + 1);
// }
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.batbox.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.batbox.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(generator.getMaxPower()), 25, this.ySize- 140, 4210752);
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerGenerator.energy), 25, this.ySize- 150, 4210752);
}
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(generator.getMaxPower()), 25, this.ySize - 140,
4210752);
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerGenerator.energy), 25, this.ySize - 150,
4210752);
}
}

View file

@ -1,5 +1,7 @@
package techreborn.client.gui;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
@ -17,84 +19,103 @@ import techreborn.init.ModBlocks;
import techreborn.proxies.ClientProxy;
import techreborn.tiles.TileBlastFurnace;
import java.io.IOException;
public class GuiBlastFurnace extends GuiContainer
{
public static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/industrial_blast_furnace.png");
public class GuiBlastFurnace extends GuiContainer {
TileBlastFurnace blastfurnace;
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/industrial_blast_furnace.png");
ContainerBlastFurnace containerBlastFurnace;
TileBlastFurnace blastfurnace;
ContainerBlastFurnace containerBlastFurnace;
public GuiBlastFurnace(EntityPlayer player, TileBlastFurnace tileblastfurnace) {
super(new ContainerBlastFurnace(tileblastfurnace, player));
this.xSize = 176;
this.ySize = 167;
blastfurnace = tileblastfurnace;
this.containerBlastFurnace = (ContainerBlastFurnace) this.inventorySlots;
}
@Override
public void initGui() {
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
GuiButton button = new GuiButton(212, k + 4, l + 6, 20, 20, "");
buttonList.add(button);
super.initGui();
CoordTriplet coordinates = new CoordTriplet(blastfurnace.getPos().getX() - (EnumFacing.getFront(blastfurnace.getFacingInt()).getFrontOffsetX() * 2), blastfurnace.getPos().getY() - 1, blastfurnace.getPos().getZ() - (EnumFacing.getFront(blastfurnace.getFacingInt()).getFrontOffsetZ() * 2));
if(coordinates.equals(ClientProxy.multiblockRenderEvent.anchor) && blastfurnace.getHeat() != 0){
ClientProxy.multiblockRenderEvent.setMultiblock(null);
button.displayString = "B";
} else {
button.displayString = "A";
}
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
if (containerBlastFurnace.heat == 0) {
GuiUtil.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38, l + 52 + 12 - 0, -1);
}
int j = 0;
this.mc.getTextureManager().bindTexture(texture);
j = blastfurnace.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 64, l + 37, 176, 14, j + 1, 16);
}
j = blastfurnace.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 9, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
super.drawGuiContainerForegroundLayer(p_146979_1_, p_146979_2_);
String name = I18n.translateToLocal("tile.techreborn.blastfurnace.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
if (containerBlastFurnace.heat != 0) {
this.fontRendererObj.drawString("Current Heat: " + containerBlastFurnace.heat, 40, 60, 4210752);
}
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
public GuiBlastFurnace(EntityPlayer player, TileBlastFurnace tileblastfurnace)
{
super(new ContainerBlastFurnace(tileblastfurnace, player));
this.xSize = 176;
this.ySize = 167;
blastfurnace = tileblastfurnace;
this.containerBlastFurnace = (ContainerBlastFurnace) this.inventorySlots;
}
@Override
public void actionPerformed(GuiButton button) throws IOException {
public void initGui()
{
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
GuiButton button = new GuiButton(212, k + 4, l + 6, 20, 20, "");
buttonList.add(button);
super.initGui();
CoordTriplet coordinates = new CoordTriplet(
blastfurnace.getPos().getX() - (EnumFacing.getFront(blastfurnace.getFacingInt()).getFrontOffsetX() * 2),
blastfurnace.getPos().getY() - 1, blastfurnace.getPos().getZ()
- (EnumFacing.getFront(blastfurnace.getFacingInt()).getFrontOffsetZ() * 2));
if (coordinates.equals(ClientProxy.multiblockRenderEvent.anchor) && blastfurnace.getHeat() != 0)
{
ClientProxy.multiblockRenderEvent.setMultiblock(null);
button.displayString = "B";
} else
{
button.displayString = "A";
}
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
if (containerBlastFurnace.heat == 0)
{
GuiUtil.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38,
l + 52 + 12 - 0, -1);
}
int j = 0;
this.mc.getTextureManager().bindTexture(texture);
j = blastfurnace.getProgressScaled(24);
if (j > 0)
{
this.drawTexturedModalRect(k + 64, l + 37, 176, 14, j + 1, 16);
}
j = blastfurnace.getEnergyScaled(12);
if (j > 0)
{
this.drawTexturedModalRect(k + 9, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
super.drawGuiContainerForegroundLayer(p_146979_1_, p_146979_2_);
String name = I18n.translateToLocal("tile.techreborn.blastfurnace.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
if (containerBlastFurnace.heat != 0)
{
this.fontRendererObj.drawString("Current Heat: " + containerBlastFurnace.heat, 40, 60, 4210752);
}
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
}
@Override
public void actionPerformed(GuiButton button) throws IOException
{
super.actionPerformed(button);
if(button.id == 212){
if(ClientProxy.multiblockRenderEvent.currentMultiblock == null){
{//This code here makes a basic multiblock and then sets to the selected one.
if (button.id == 212)
{
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null)
{
{// This code here makes a basic multiblock and then sets to the
// selected one.
Multiblock multiblock = new Multiblock();
multiblock.addComponent(0, 0, 0, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 0, 0, ModBlocks.MachineCasing, 0);
@ -105,7 +126,7 @@ public class GuiBlastFurnace extends GuiContainer {
multiblock.addComponent(-1, 0, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 0, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 0, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 1, 0, ModBlocks.MachineCasing, 0);
multiblock.addComponent(0, 1, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 1, 0, ModBlocks.MachineCasing, 0);
@ -114,7 +135,7 @@ public class GuiBlastFurnace extends GuiContainer {
multiblock.addComponent(-1, 1, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 1, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 1, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 2, 0, ModBlocks.MachineCasing, 0);
multiblock.addComponent(0, 2, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 2, 0, ModBlocks.MachineCasing, 0);
@ -133,14 +154,20 @@ public class GuiBlastFurnace extends GuiContainer {
multiblock.addComponent(-1, 3, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 3, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 3, 1, ModBlocks.MachineCasing, 0);
MultiblockSet set = new MultiblockSet(multiblock);
ClientProxy.multiblockRenderEvent.setMultiblock(set);
ClientProxy.multiblockRenderEvent.partent = new Location(blastfurnace.getPos().getX(), blastfurnace.getPos().getY(), blastfurnace.getPos().getZ(), blastfurnace.getWorld());
ClientProxy.multiblockRenderEvent.anchor = new CoordTriplet(blastfurnace.getPos().getX() - (EnumFacing.getFront(blastfurnace.getFacingInt()).getFrontOffsetX() * 2), blastfurnace.getPos().getY() - 1, blastfurnace.getPos().getZ() - (EnumFacing.getFront(blastfurnace.getFacingInt()).getFrontOffsetZ() * 2));
ClientProxy.multiblockRenderEvent.partent = new Location(blastfurnace.getPos().getX(),
blastfurnace.getPos().getY(), blastfurnace.getPos().getZ(), blastfurnace.getWorld());
ClientProxy.multiblockRenderEvent.anchor = new CoordTriplet(
blastfurnace.getPos().getX()
- (EnumFacing.getFront(blastfurnace.getFacingInt()).getFrontOffsetX() * 2),
blastfurnace.getPos().getY() - 1, blastfurnace.getPos().getZ()
- (EnumFacing.getFront(blastfurnace.getFacingInt()).getFrontOffsetZ() * 2));
}
button.displayString = "A";
} else {
} else
{
ClientProxy.multiblockRenderEvent.setMultiblock(null);
button.displayString = "B";
}

View file

@ -8,57 +8,66 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerCentrifuge;
import techreborn.tiles.TileCentrifuge;
public class GuiCentrifuge extends GuiContainer {
public class GuiCentrifuge extends GuiContainer
{
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/industrial_centrifuge.png");
public static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/industrial_centrifuge.png");
TileCentrifuge centrifuge;
TileCentrifuge centrifuge;
public GuiCentrifuge(EntityPlayer player, TileCentrifuge tileCentrifuge) {
super(new ContainerCentrifuge(tileCentrifuge, player));
this.xSize = 176;
this.ySize = 167;
centrifuge = tileCentrifuge;
}
public GuiCentrifuge(EntityPlayer player, TileCentrifuge tileCentrifuge)
{
super(new ContainerCentrifuge(tileCentrifuge, player));
this.xSize = 176;
this.ySize = 167;
centrifuge = tileCentrifuge;
}
@Override
public void initGui() {
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
public void initGui()
{
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
int j = 0;
j = centrifuge.getProgressScaled(11);
if (j > 0) {
this.drawTexturedModalRect(k + 83, l + 23 + 10 - j, 177, 15 + 10 - j, 10, j);
this.drawTexturedModalRect(k + 98, l + 38, 177, 51, j, 10);
this.drawTexturedModalRect(k + 83, l + 53, 177, 39, 10, j);
this.drawTexturedModalRect(k + 68 + 10 - j, l + 38, 177 + 10 - j, 27, j, 10);
}
j = centrifuge.getProgressScaled(11);
if (j > 0)
{
this.drawTexturedModalRect(k + 83, l + 23 + 10 - j, 177, 15 + 10 - j, 10, j);
this.drawTexturedModalRect(k + 98, l + 38, 177, 51, j, 10);
this.drawTexturedModalRect(k + 83, l + 53, 177, 39, 10, j);
this.drawTexturedModalRect(k + 68 + 10 - j, l + 38, 177 + 10 - j, 27, j, 10);
}
j = centrifuge.getEnergyScaled(12);
j = centrifuge.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 9, l + 32 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
if (j > 0)
{
this.drawTexturedModalRect(k + 9, l + 32 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String namePt1 = I18n.translateToLocal("tile.techreborn.industrialBlock.name");
String namePt2 = I18n.translateToLocal("tile.techreborn.centrifuge.name").replace(namePt1 + " ", "");
this.fontRendererObj.drawString(namePt1, 98, 6, 4210752);
this.fontRendererObj.drawString(namePt2, 98, 14, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString(centrifuge.getProgressScaled(100) + "%", 98, this.ySize - 96 + 2, 4210752);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String namePt1 = I18n.translateToLocal("tile.techreborn.industrialBlock.name");
String namePt2 = I18n.translateToLocal("tile.techreborn.centrifuge.name").replace(namePt1 + " ", "");
this.fontRendererObj.drawString(namePt1, 98, 6, 4210752);
this.fontRendererObj.drawString(namePt2, 98, 14, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString(centrifuge.getProgressScaled(100) + "%", 98, this.ySize - 96 + 2, 4210752);
}
}

View file

@ -8,45 +8,53 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerChargeBench;
import techreborn.tiles.TileChargeBench;
public class GuiChargeBench extends GuiContainer {
public class GuiChargeBench extends GuiContainer
{
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/chargebench.png");
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/chargebench.png");
TileChargeBench chargebench;
TileChargeBench chargebench;
public GuiChargeBench(EntityPlayer player, TileChargeBench tile) {
super(new ContainerChargeBench(tile, player));
this.xSize = 176;
this.ySize = 167;
chargebench = tile;
}
public GuiChargeBench(EntityPlayer player, TileChargeBench tile)
{
super(new ContainerChargeBench(tile, player));
this.xSize = 176;
this.ySize = 167;
chargebench = tile;
}
@Override
public void initGui() {
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
public void initGui()
{
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
int j = 0;
j = chargebench.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 10, l + 32 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
j = chargebench.getEnergyScaled(12);
if (j > 0)
{
this.drawTexturedModalRect(k + 10, l + 32 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.chargebench.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.chargebench.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
}
}

View file

@ -8,53 +8,63 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerChemicalReactor;
import techreborn.tiles.TileChemicalReactor;
public class GuiChemicalReactor extends GuiContainer {
public class GuiChemicalReactor extends GuiContainer
{
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/chemical_reactor.png");
public static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/chemical_reactor.png");
TileChemicalReactor chemicalReactor;
ContainerChemicalReactor containerChemicalReactor;
TileChemicalReactor chemicalReactor;
ContainerChemicalReactor containerChemicalReactor;
public GuiChemicalReactor(EntityPlayer player, TileChemicalReactor tilechemicalReactor) {
super(new ContainerChemicalReactor(tilechemicalReactor, player));
containerChemicalReactor = (ContainerChemicalReactor) this.inventorySlots;
this.xSize = 176;
this.ySize = 167;
chemicalReactor = tilechemicalReactor;
}
public GuiChemicalReactor(EntityPlayer player, TileChemicalReactor tilechemicalReactor)
{
super(new ContainerChemicalReactor(tilechemicalReactor, player));
containerChemicalReactor = (ContainerChemicalReactor) this.inventorySlots;
this.xSize = 176;
this.ySize = 167;
chemicalReactor = tilechemicalReactor;
}
@Override
public void initGui() {
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
public void initGui()
{
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
int j = 0;
j = chemicalReactor.getProgressScaled(11);
if (j > 0) {
this.drawTexturedModalRect(k + 73, l + 39, 177, 15, 30, j);
}
j = chemicalReactor.getProgressScaled(11);
if (j > 0)
{
this.drawTexturedModalRect(k + 73, l + 39, 177, 15, 30, j);
}
j = chemicalReactor.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 9, l + 32 + 12 - j, 176, 12 - j, 14, j + 2);
}
j = chemicalReactor.getEnergyScaled(12);
if (j > 0)
{
this.drawTexturedModalRect(k + 9, l + 32 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.chemicalreactor.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.chemicalreactor.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
}
}

View file

@ -9,59 +9,62 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerChunkloader;
import techreborn.tiles.TileChunkLoader;
public class GuiChunkLoader extends GuiContainer {
public class GuiChunkLoader extends GuiContainer
{
private GuiButton plusOneButton;
private GuiButton plusTenButton;
private GuiButton minusOneButton;
private GuiButton minusTenButton;
private GuiButton plusOneButton;
private GuiButton plusTenButton;
private GuiButton minusOneButton;
private GuiButton minusTenButton;
private static final ResourceLocation texture = new ResourceLocation(
"techreborn", "textures/gui/industrial_chunkloader.png");
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/industrial_chunkloader.png");
TileChunkLoader chunkloader;
TileChunkLoader chunkloader;
public GuiChunkLoader(EntityPlayer player, TileChunkLoader tilechunkloader) {
super(new ContainerChunkloader(tilechunkloader, player));
this.xSize = 176;
this.ySize = 167;
chunkloader = tilechunkloader;
}
public GuiChunkLoader(EntityPlayer player, TileChunkLoader tilechunkloader)
{
super(new ContainerChunkloader(tilechunkloader, player));
this.xSize = 176;
this.ySize = 167;
chunkloader = tilechunkloader;
}
@Override
public void initGui() {
super.initGui();
this.guiLeft = this.width / 2 - this.xSize / 2;
this.guiTop = this.height / 2 - this.ySize / 2;
plusOneButton = new GuiButton(0, guiLeft + 5, guiTop + 37, 40, 20, "+1");
plusTenButton = new GuiButton(0, guiLeft + 45, guiTop + 37, 40, 20, "+10");
@Override
public void initGui()
{
super.initGui();
this.guiLeft = this.width / 2 - this.xSize / 2;
this.guiTop = this.height / 2 - this.ySize / 2;
plusOneButton = new GuiButton(0, guiLeft + 5, guiTop + 37, 40, 20, "+1");
plusTenButton = new GuiButton(0, guiLeft + 45, guiTop + 37, 40, 20, "+10");
minusOneButton = new GuiButton(0, guiLeft + 90, guiTop + 37, 40, 20, "-1");
minusTenButton = new GuiButton(0, guiLeft + 130, guiTop + 37, 40, 20, "-10");
minusOneButton = new GuiButton(0, guiLeft + 90, guiTop + 37, 40, 20, "-1");
minusTenButton = new GuiButton(0, guiLeft + 130, guiTop + 37, 40, 20, "-10");
buttonList.add(plusOneButton);
buttonList.add(plusTenButton);
buttonList.add(minusOneButton);
buttonList.add(minusTenButton);
}
buttonList.add(plusOneButton);
buttonList.add(plusTenButton);
buttonList.add(minusOneButton);
buttonList.add(minusTenButton);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.chunkloader.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(
I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.chunkloader.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
}
}

View file

@ -8,45 +8,53 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerCompressor;
import techreborn.tiles.teir1.TileCompressor;
public class GuiCompressor extends GuiContainer {
public class GuiCompressor extends GuiContainer
{
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/compressor.png");
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/compressor.png");
TileCompressor compressor;
ContainerCompressor containerGrinder;
TileCompressor compressor;
ContainerCompressor containerGrinder;
public GuiCompressor(EntityPlayer player, TileCompressor tilegrinder) {
super(new ContainerCompressor(tilegrinder, player));
this.xSize = 176;
this.ySize = 167;
compressor = tilegrinder;
containerGrinder = (ContainerCompressor) this.inventorySlots;
}
public GuiCompressor(EntityPlayer player, TileCompressor tilegrinder)
{
super(new ContainerCompressor(tilegrinder, player));
this.xSize = 176;
this.ySize = 167;
compressor = tilegrinder;
containerGrinder = (ContainerCompressor) this.inventorySlots;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
int j = 0;
j = compressor.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
}
j = compressor.getProgressScaled(24);
if (j > 0)
{
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
}
j = compressor.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
j = compressor.getEnergyScaled(12);
if (j > 0)
{
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.compressor.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.compressor.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
}
}

View file

@ -7,30 +7,34 @@ import net.minecraft.inventory.Container;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
public class GuiDestructoPack extends GuiContainer {
public class GuiDestructoPack extends GuiContainer
{
private static final ResourceLocation texture = new ResourceLocation(
"techreborn", "textures/gui/destructopack.png");
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/destructopack.png");
public GuiDestructoPack(Container container) {
super(container);
this.xSize = 176;
this.ySize = 166;
}
public GuiDestructoPack(Container container)
{
super(container);
this.xSize = 176;
this.ySize = 166;
}
@Override
protected void drawGuiContainerBackgroundLayer(float arg0, int arg1, int arg2) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 176, 166);
}
@Override
protected void drawGuiContainerBackgroundLayer(float arg0, int arg1, int arg2)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 176, 166);
}
@Override
protected void drawGuiContainerForegroundLayer(int arg0, int arg1) {
String name = I18n.translateToLocal("item.techreborn.part.destructoPack.name");
fontRendererObj.drawString(name, xSize / 2 - fontRendererObj.getStringWidth(name) / 2, 5, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory"), 8,
this.ySize - 96 + 2, 4210752);
super.drawGuiContainerForegroundLayer(arg0, arg1);
}
@Override
protected void drawGuiContainerForegroundLayer(int arg0, int arg1)
{
String name = I18n.translateToLocal("item.techreborn.part.destructoPack.name");
fontRendererObj.drawString(name, xSize / 2 - fontRendererObj.getStringWidth(name) / 2, 5, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory"), 8, this.ySize - 96 + 2,
4210752);
super.drawGuiContainerForegroundLayer(arg0, arg1);
}
}

View file

@ -8,46 +8,54 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerElectricFurnace;
import techreborn.tiles.teir1.TileElectricFurnace;
public class GuiElectricFurnace extends GuiContainer {
public class GuiElectricFurnace extends GuiContainer
{
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/compressor.png");
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/compressor.png");
TileElectricFurnace furnace;
ContainerElectricFurnace containerGrinder;
TileElectricFurnace furnace;
ContainerElectricFurnace containerGrinder;
public GuiElectricFurnace(EntityPlayer player, TileElectricFurnace tilegrinder) {
super(new ContainerElectricFurnace(tilegrinder, player));
this.xSize = 176;
this.ySize = 167;
furnace = tilegrinder;
containerGrinder = (ContainerElectricFurnace) this.inventorySlots;
}
public GuiElectricFurnace(EntityPlayer player, TileElectricFurnace tilegrinder)
{
super(new ContainerElectricFurnace(tilegrinder, player));
this.xSize = 176;
this.ySize = 167;
furnace = tilegrinder;
containerGrinder = (ContainerElectricFurnace) this.inventorySlots;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
int j = 0;
j = furnace.gaugeProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 78, l + 34, 176, 14, j + 1, 16);
}
j = furnace.gaugeProgressScaled(24);
if (j > 0)
{
this.drawTexturedModalRect(k + 78, l + 34, 176, 14, j + 1, 16);
}
j = furnace.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
j = furnace.getEnergyScaled(12);
if (j > 0)
{
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.electricfurnace.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.electricfurnace.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
}
}

View file

@ -8,45 +8,53 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerExtractor;
import techreborn.tiles.teir1.TileExtractor;
public class GuiExtractor extends GuiContainer {
public class GuiExtractor extends GuiContainer
{
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/compressor.png");
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/compressor.png");
TileExtractor extractor;
ContainerExtractor containerGrinder;
TileExtractor extractor;
ContainerExtractor containerGrinder;
public GuiExtractor(EntityPlayer player, TileExtractor tilegrinder) {
super(new ContainerExtractor(tilegrinder, player));
this.xSize = 176;
this.ySize = 167;
extractor = tilegrinder;
containerGrinder = (ContainerExtractor) this.inventorySlots;
}
public GuiExtractor(EntityPlayer player, TileExtractor tilegrinder)
{
super(new ContainerExtractor(tilegrinder, player));
this.xSize = 176;
this.ySize = 167;
extractor = tilegrinder;
containerGrinder = (ContainerExtractor) this.inventorySlots;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
int j = 0;
j = extractor.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
}
j = extractor.getProgressScaled(24);
if (j > 0)
{
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
}
j = extractor.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
j = extractor.getEnergyScaled(12);
if (j > 0)
{
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.extractor.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.extractor.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
}
}

View file

@ -1,5 +1,7 @@
package techreborn.client.gui;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
@ -10,88 +12,110 @@ import reborncore.common.powerSystem.PowerSystem;
import techreborn.client.container.ContainerFusionReactor;
import techreborn.tiles.fusionReactor.TileEntityFusionController;
import java.io.IOException;
public class GuiFusionReactor extends GuiContainer
{
public static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/fusion_reactor.png");
public class GuiFusionReactor extends GuiContainer {
ContainerFusionReactor containerFusionReactor;
TileEntityFusionController fusionController;
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/fusion_reactor.png");
public GuiFusionReactor(EntityPlayer player, TileEntityFusionController tileaesu)
{
super(new ContainerFusionReactor(tileaesu, player));
containerFusionReactor = (ContainerFusionReactor) this.inventorySlots;
this.fusionController = tileaesu;
}
ContainerFusionReactor containerFusionReactor;
TileEntityFusionController fusionController;
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.fusioncontrolcomputer.name");
this.fontRendererObj.drawString(name, 87, 6, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
public GuiFusionReactor(EntityPlayer player,
TileEntityFusionController tileaesu) {
super(new ContainerFusionReactor(tileaesu, player));
containerFusionReactor = (ContainerFusionReactor) this.inventorySlots;
this.fusionController = tileaesu;
}
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerFusionReactor.energy), 11, 8, 16448255);
this.fontRendererObj.drawString("Coils: " + (containerFusionReactor.coilStatus == 1 ? "Yes" : "No"), 11, 16,
16448255);
if (containerFusionReactor.neededEU > 1 && containerFusionReactor.tickTime < 1)
this.fontRendererObj.drawString(
"Start: " + percentage(containerFusionReactor.neededEU, containerFusionReactor.energy) + "%", 11,
24, 16448255);
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.fusioncontrolcomputer.name");
this.fontRendererObj.drawString(name, 87, 6, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerFusionReactor.energy), 11, 8, 16448255);
this.fontRendererObj.drawString("Coils: " + (containerFusionReactor.coilStatus == 1 ? "Yes" : "No"), 11, 16, 16448255);
if(containerFusionReactor.neededEU > 1 && containerFusionReactor.tickTime < 1)
this.fontRendererObj.drawString("Start: " + percentage(containerFusionReactor.neededEU, containerFusionReactor.energy) + "%", 11, 24, 16448255);
@Override
public void initGui()
{
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
// GuiButton button = new GuiButton(212, k + this.xSize - 24, l + 4, 20,
// 20, "");
// buttonList.add(button);
super.initGui();
// CoordTriplet coordinates = new
// CoordTriplet(fusionController.getPos().getX() -
// (EnumFacing.getFront(fusionController.getFacingInt()).getFrontOffsetX()
// * 2), fusionController.getPos().getY() - 1,
// fusionController.getPos().getZ() -
// (EnumFacing.getFront(fusionController.getFacingInt()).getFrontOffsetZ()
// * 2));
// if(coordinates.equals(ClientProxy.multiblockRenderEvent.anchor)){
// ClientProxy.multiblockRenderEvent.setMultiblock(null);
// button.displayString = "B";
// } else {
// button.displayString = "A";
// }
}
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
public void initGui() {
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
//GuiButton button = new GuiButton(212, k + this.xSize - 24, l + 4, 20, 20, "");
//buttonList.add(button);
super.initGui();
// CoordTriplet coordinates = new CoordTriplet(fusionController.getPos().getX() - (EnumFacing.getFront(fusionController.getFacingInt()).getFrontOffsetX() * 2), fusionController.getPos().getY() - 1, fusionController.getPos().getZ() - (EnumFacing.getFront(fusionController.getFacingInt()).getFrontOffsetZ() * 2));
// if(coordinates.equals(ClientProxy.multiblockRenderEvent.anchor)){
// ClientProxy.multiblockRenderEvent.setMultiblock(null);
// button.displayString = "B";
// } else {
// button.displayString = "A";
// }
}
drawTexturedModalRect(k + 88, l + 36, 176, 0, 14, 14);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
// progressBar
drawTexturedModalRect(k + 111, l + 34, 176, 14, containerFusionReactor.getProgressScaled(), 16);
drawTexturedModalRect(k + 88, l + 36, 176, 0, 14, 14);
}
//progressBar
drawTexturedModalRect(k + 111, l + 34, 176, 14, containerFusionReactor.getProgressScaled(), 16);
public int percentage(int MaxValue, int CurrentValue)
{
if (CurrentValue == 0)
return 0;
return (int) ((CurrentValue * 100.0f) / MaxValue);
}
}
public int percentage(int MaxValue, int CurrentValue) {
if (CurrentValue == 0)
return 0;
return (int) ((CurrentValue * 100.0f) / MaxValue);
}
@Override
public void actionPerformed(GuiButton button) throws IOException {
super.actionPerformed(button);
// if(button.id == 212){
// if(ClientProxy.multiblockRenderEvent.currentMultiblock == null){
// {//This code here makes a basic multiblock and then sets to the selected one.
// MultiblockSet set = new MultiblockSet(ClientMultiBlocks.reactor);
// ClientProxy.multiblockRenderEvent.setMultiblock(set);
// ClientProxy.multiblockRenderEvent.partent = new Location(fusionController.getPos().getX(), fusionController.getPos().getY(), fusionController.getPos().getZ(), fusionController.getWorld());
// ClientProxy.multiblockRenderEvent.anchor = new CoordTriplet(fusionController.getPos().getX() , fusionController.getPos().getY() -1 , fusionController.getPos().getZ());
// }
// button.displayString = "A";
// } else {
// ClientProxy.multiblockRenderEvent.setMultiblock(null);
// button.displayString = "B";
// }
// }
}
@Override
public void actionPerformed(GuiButton button) throws IOException
{
super.actionPerformed(button);
// if(button.id == 212){
// if(ClientProxy.multiblockRenderEvent.currentMultiblock == null){
// {//This code here makes a basic multiblock and then sets to the
// selected one.
// MultiblockSet set = new MultiblockSet(ClientMultiBlocks.reactor);
// ClientProxy.multiblockRenderEvent.setMultiblock(set);
// ClientProxy.multiblockRenderEvent.partent = new
// Location(fusionController.getPos().getX(),
// fusionController.getPos().getY(), fusionController.getPos().getZ(),
// fusionController.getWorld());
// ClientProxy.multiblockRenderEvent.anchor = new
// CoordTriplet(fusionController.getPos().getX() ,
// fusionController.getPos().getY() -1 ,
// fusionController.getPos().getZ());
// }
// button.displayString = "A";
// } else {
// ClientProxy.multiblockRenderEvent.setMultiblock(null);
// button.displayString = "B";
// }
// }
}
}

View file

@ -8,39 +8,41 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerGasTurbine;
import techreborn.tiles.generator.TileGasTurbine;
public class GuiGasTurbine extends GuiContainer {
public class GuiGasTurbine extends GuiContainer
{
//TODO: use semifluid generator texture
private static final ResourceLocation texture = new ResourceLocation(
"techreborn", "textures/gui/ThermalGenerator.png");
// TODO: use semifluid generator texture
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/ThermalGenerator.png");
TileGasTurbine tile;
TileGasTurbine tile;
public GuiGasTurbine(EntityPlayer player, TileGasTurbine tile) {
super(new ContainerGasTurbine(tile, player));
this.xSize = 176;
this.ySize = 167;
this.tile = tile;
}
public GuiGasTurbine(EntityPlayer player, TileGasTurbine tile)
{
super(new ContainerGasTurbine(tile, player));
this.xSize = 176;
this.ySize = 167;
this.tile = tile;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
int p_146979_2_) {
String name = "Gas Turbine";
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(
I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);
this.fontRendererObj.drawString(tile.tank.getFluidAmount() + "", 10,
30, 16448255);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = "Gas Turbine";
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);
this.fontRendererObj.drawString(tile.tank.getFluidAmount() + "", 10, 30, 16448255);
}
}

View file

@ -8,55 +8,64 @@ import reborncore.common.powerSystem.PowerSystem;
import techreborn.client.container.ContainerGenerator;
import techreborn.tiles.generator.TileGenerator;
public class GuiGenerator extends GuiContainer {
public class GuiGenerator extends GuiContainer
{
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/generator.png");
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/generator.png");
TileGenerator generator;
TileGenerator generator;
ContainerGenerator containerGenerator;
ContainerGenerator containerGenerator;
public GuiGenerator(EntityPlayer player, TileGenerator generator) {
super(new ContainerGenerator(generator, player));
this.xSize = 176;
this.ySize = 167;
this.generator = generator;
this.containerGenerator = (ContainerGenerator) this.inventorySlots;
}
public GuiGenerator(EntityPlayer player, TileGenerator generator)
{
super(new ContainerGenerator(generator, player));
this.xSize = 176;
this.ySize = 167;
this.generator = generator;
this.containerGenerator = (ContainerGenerator) this.inventorySlots;
}
@Override
public void initGui() {
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
public void initGui()
{
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
int j = 0;
j = generator.getEnergyScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 109, l + 21 + 12, 176, 0, j + 1, 16);
}
j = generator.getEnergyScaled(24);
if (j > 0)
{
this.drawTexturedModalRect(k + 109, l + 21 + 12, 176, 0, j + 1, 16);
}
if (containerGenerator.burnTime != 0)
{
j = containerGenerator.getScaledBurnTime(13);
this.drawTexturedModalRect(k + 80, l + 38 + 12 - j, 176, 30 - j, 14, j + 1);
}
}
if (containerGenerator.burnTime != 0)
{
j = containerGenerator.getScaledBurnTime(13);
this.drawTexturedModalRect(k + 80, l + 38 + 12 - j, 176, 30 - j, 14, j + 1);
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.generator.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.generator.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerGenerator.energy), 25, this.ySize- 150, 4210752);
}
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerGenerator.energy), 25, this.ySize - 150,
4210752);
}
}

View file

@ -8,46 +8,54 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerGrinder;
import techreborn.tiles.teir1.TileGrinder;
public class GuiGrinder extends GuiContainer {
public class GuiGrinder extends GuiContainer
{
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/grinder.png");
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/grinder.png");
TileGrinder grinder;
ContainerGrinder containerGrinder;
TileGrinder grinder;
ContainerGrinder containerGrinder;
public GuiGrinder(EntityPlayer player, TileGrinder tilegrinder) {
super(new ContainerGrinder(tilegrinder, player));
this.xSize = 176;
this.ySize = 167;
grinder = tilegrinder;
containerGrinder = (ContainerGrinder) this.inventorySlots;
}
public GuiGrinder(EntityPlayer player, TileGrinder tilegrinder)
{
super(new ContainerGrinder(tilegrinder, player));
this.xSize = 176;
this.ySize = 167;
grinder = tilegrinder;
containerGrinder = (ContainerGrinder) this.inventorySlots;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
int j = 0;
j = grinder.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 79, l + 37, 176, 14, j + 1, 16);
}
j = grinder.getProgressScaled(24);
if (j > 0)
{
this.drawTexturedModalRect(k + 79, l + 37, 176, 14, j + 1, 16);
}
j = grinder.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
j = grinder.getEnergyScaled(12);
if (j > 0)
{
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.grinder.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.grinder.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
}
}

View file

@ -1,5 +1,8 @@
package techreborn.client.gui;
import java.awt.*;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
@ -12,80 +15,90 @@ import techreborn.client.container.ContainerIDSU;
import techreborn.packets.PacketIdsu;
import techreborn.tiles.idsu.TileIDSU;
import java.awt.*;
import java.io.IOException;
public class GuiIDSU extends GuiContainer
{
public class GuiIDSU extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/aesu.png");
private static final ResourceLocation texture = new ResourceLocation(
"techreborn", "textures/gui/aesu.png");
TileIDSU idsu;
ContainerIDSU containerIDSU;
TileIDSU idsu;
public GuiIDSU(EntityPlayer player, TileIDSU tileIDSU)
{
super(new ContainerIDSU(tileIDSU, player));
this.xSize = 176;
this.ySize = 165;
idsu = tileIDSU;
this.containerIDSU = (ContainerIDSU) this.inventorySlots;
}
ContainerIDSU containerIDSU;
@Override
public void initGui()
{
super.initGui();
this.buttonList.clear();
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.buttonList.add(new GuiButton(0, k + 128, l + 5, 15, 15, "++"));
this.buttonList.add(new GuiButton(1, k + 128, l + 5 + 20, 15, 15, "+"));
this.buttonList.add(new GuiButton(2, k + 128, l + 5 + (20 * 2), 15, 15, "-"));
this.buttonList.add(new GuiButton(3, k + 128, l + 5 + (20 * 3), 15, 15, "--"));
this.buttonList.add(new GuiButton(4, k + 40, l + 10, 10, 10, "+"));
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
public GuiIDSU(EntityPlayer player, TileIDSU tileIDSU) {
super(new ContainerIDSU(tileIDSU, player));
this.xSize = 176;
this.ySize = 165;
idsu = tileIDSU;
this.containerIDSU = (ContainerIDSU) this.inventorySlots;
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
this.fontRendererObj.drawString(I18n.translateToLocal("tile.techreborn.idsu.name"), 40, 10,
Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerIDSU.euOut) + "/tick", 10, 20,
Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerIDSU.storedEu), 10, 30,
Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerIDSU.euChange) + " change", 10, 40,
Color.WHITE.getRGB());
}
@Override
public void initGui() {
super.initGui();
this.buttonList.clear();
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.buttonList.add(new GuiButton(0, k + 128, l + 5, 15, 15, "++"));
this.buttonList.add(new GuiButton(1, k + 128, l + 5 + 20, 15, 15, "+"));
this.buttonList.add(new GuiButton(2, k + 128, l + 5 + (20 * 2), 15, 15, "-"));
this.buttonList.add(new GuiButton(3, k + 128, l + 5 + (20 * 3), 15, 15, "--"));
this.buttonList.add(new GuiButton(4, k + 40, l + 10, 10, 10, "+"));
}
@Override
protected void actionPerformed(GuiButton button) throws IOException
{
super.actionPerformed(button);
PacketHandler.sendPacketToServer(new PacketIdsu(button.id, idsu));
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
int p_146979_2_) {
this.fontRendererObj.drawString(I18n.translateToLocal("tile.techreborn.idsu.name"), 40, 10, Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerIDSU.euOut) + "/tick", 10, 20, Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerIDSU.storedEu), 10, 30, Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerIDSU.euChange) + " change", 10, 40, Color.WHITE.getRGB());
}
public static boolean isInteger(String s)
{
return isInteger(s, 10);
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
super.actionPerformed(button);
PacketHandler.sendPacketToServer(new PacketIdsu(button.id, idsu));
}
public static boolean isInteger(String s) {
return isInteger(s, 10);
}
public static boolean isInteger(String s, int radix) {
if (s.isEmpty()) return false;
for (int i = 0; i < s.length(); i++) {
if (i == 0 && s.charAt(i) == '-') {
if (s.length() == 1) return false;
else continue;
}
if (Character.digit(s.charAt(i), radix) < 0) return false;
}
return true;
}
public static boolean isInteger(String s, int radix)
{
if (s.isEmpty())
return false;
for (int i = 0; i < s.length(); i++)
{
if (i == 0 && s.charAt(i) == '-')
{
if (s.length() == 1)
return false;
else
continue;
}
if (Character.digit(s.charAt(i), radix) < 0)
return false;
}
return true;
}
}

View file

@ -8,58 +8,70 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerImplosionCompressor;
import techreborn.tiles.TileImplosionCompressor;
public class GuiImplosionCompressor extends GuiContainer {
public class GuiImplosionCompressor extends GuiContainer
{
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/implosion_compressor.png");
public static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/implosion_compressor.png");
TileImplosionCompressor compresser;
ContainerImplosionCompressor containerImplosionCompressor;
TileImplosionCompressor compresser;
ContainerImplosionCompressor containerImplosionCompressor;
public GuiImplosionCompressor(EntityPlayer player, TileImplosionCompressor tilecompresser) {
super(new ContainerImplosionCompressor(tilecompresser, player));
containerImplosionCompressor = (ContainerImplosionCompressor) this.inventorySlots;
this.xSize = 176;
this.ySize = 167;
compresser = tilecompresser;
}
public GuiImplosionCompressor(EntityPlayer player, TileImplosionCompressor tilecompresser)
{
super(new ContainerImplosionCompressor(tilecompresser, player));
containerImplosionCompressor = (ContainerImplosionCompressor) this.inventorySlots;
this.xSize = 176;
this.ySize = 167;
compresser = tilecompresser;
}
@Override
public void initGui() {
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
public void initGui()
{
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
if (containerImplosionCompressor.multIBlockState == 0) {
// GuiDraw.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38, l + 52 + 12 - 0, -1);
}
int j = 0;
this.mc.getTextureManager().bindTexture(texture);
j = compresser.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 60, l + 37, 176, 14, j + 1, 16);
}
if (containerImplosionCompressor.multIBlockState == 0)
{
// GuiDraw.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38,
l + 52 + 12 - 0, -1);
}
j = compresser.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 14, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
int j = 0;
this.mc.getTextureManager().bindTexture(texture);
j = compresser.getProgressScaled(24);
if (j > 0)
{
this.drawTexturedModalRect(k + 60, l + 37, 176, 14, j + 1, 16);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.implosioncompressor.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
j = compresser.getEnergyScaled(12);
if (j > 0)
{
this.drawTexturedModalRect(k + 14, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.implosioncompressor.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
}
}

View file

@ -8,54 +8,63 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerIndustrialElectrolyzer;
import techreborn.tiles.TileIndustrialElectrolyzer;
public class GuiIndustrialElectrolyzer extends GuiContainer {
public class GuiIndustrialElectrolyzer extends GuiContainer
{
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/industrial_electrolyzer.png");
public static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/industrial_electrolyzer.png");
TileIndustrialElectrolyzer eletrolyzer;
TileIndustrialElectrolyzer eletrolyzer;
ContainerIndustrialElectrolyzer containerIndustrialElectrolyzer;
ContainerIndustrialElectrolyzer containerIndustrialElectrolyzer;
public GuiIndustrialElectrolyzer(EntityPlayer player, TileIndustrialElectrolyzer tileeletrolyzer) {
super(new ContainerIndustrialElectrolyzer(tileeletrolyzer, player));
this.xSize = 176;
this.ySize = 167;
eletrolyzer = tileeletrolyzer;
containerIndustrialElectrolyzer = (ContainerIndustrialElectrolyzer) this.inventorySlots;
}
public GuiIndustrialElectrolyzer(EntityPlayer player, TileIndustrialElectrolyzer tileeletrolyzer)
{
super(new ContainerIndustrialElectrolyzer(tileeletrolyzer, player));
this.xSize = 176;
this.ySize = 167;
eletrolyzer = tileeletrolyzer;
containerIndustrialElectrolyzer = (ContainerIndustrialElectrolyzer) this.inventorySlots;
}
@Override
public void initGui() {
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
public void initGui()
{
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
int j = 0;
j = eletrolyzer.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 72, l + 38, 176, 14, j + 1, 16);
}
j = eletrolyzer.getProgressScaled(24);
if (j > 0)
{
this.drawTexturedModalRect(k + 72, l + 38, 176, 14, j + 1, 16);
}
j = eletrolyzer.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 134, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
j = eletrolyzer.getEnergyScaled(12);
if (j > 0)
{
this.drawTexturedModalRect(k + 134, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.industrialelectrolyzer.name");
this.fontRendererObj.drawString(name, (this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2), 6, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.industrialelectrolyzer.name");
this.fontRendererObj.drawString(name, (this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2), 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
}
}

View file

@ -8,71 +8,82 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerIndustrialGrinder;
import techreborn.tiles.TileIndustrialGrinder;
public class GuiIndustrialGrinder extends GuiContainer {
public class GuiIndustrialGrinder extends GuiContainer
{
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/industrial_grinder.png");
public static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/industrial_grinder.png");
TileIndustrialGrinder grinder;
ContainerIndustrialGrinder containerGrinder;
TileIndustrialGrinder grinder;
ContainerIndustrialGrinder containerGrinder;
public GuiIndustrialGrinder(EntityPlayer player, TileIndustrialGrinder tilegrinder) {
super(new ContainerIndustrialGrinder(tilegrinder, player));
this.xSize = 176;
this.ySize = 167;
grinder = tilegrinder;
containerGrinder = (ContainerIndustrialGrinder) this.inventorySlots;
}
public GuiIndustrialGrinder(EntityPlayer player, TileIndustrialGrinder tilegrinder)
{
super(new ContainerIndustrialGrinder(tilegrinder, player));
this.xSize = 176;
this.ySize = 167;
grinder = tilegrinder;
containerGrinder = (ContainerIndustrialGrinder) this.inventorySlots;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
int j = 0;
j = grinder.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 50, l + 36, 176, 14, j + 1, 16);
}
j = grinder.getProgressScaled(24);
if (j > 0)
{
this.drawTexturedModalRect(k + 50, l + 36, 176, 14, j + 1, 16);
}
j = grinder.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 132, l + 63 + 12 - j, 176, 12 - j, 14, j + 2);
}
j = grinder.getEnergyScaled(12);
if (j > 0)
{
this.drawTexturedModalRect(k + 132, l + 63 + 12 - j, 176, 12 - j, 14, j + 2);
}
if (containerGrinder.connectionStatus != 1) {
// GuiDraw.drawTooltipBox(k + 30, l + 50 + 12 - j, 114, 10);
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38, l + 52 + 12 - j, -1);
}
if (containerGrinder.connectionStatus != 1)
{
// GuiDraw.drawTooltipBox(k + 30, l + 50 + 12 - j, 114, 10);
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38,
l + 52 + 12 - j, -1);
}
//TODO 1.8 nope
// if (grinder.tank.getFluidAmount() != 0) {
// IIcon fluidIcon = grinder.tank.getFluid().getFluid().getIcon();
// if (fluidIcon != null) {
// this.mc.renderEngine.bindTexture(texture);
// drawTexturedModalRect(k + 7, l + 15, 176, 31, 20, 55);
//
// this.mc.renderEngine
// .bindTexture(TextureMap.locationBlocksTexture);
// int liquidHeight = grinder.tank.getFluidAmount() * 47
// / grinder.tank.getCapacity();
// GuiUtil.drawRepeated(fluidIcon, k + 11, l + 19 + 47
// - liquidHeight, 12.0D, liquidHeight, this.zLevel);
//
// this.mc.renderEngine.bindTexture(texture);
//
// drawTexturedModalRect(k + 11, l + 19, 176, 86, 12, 47);
// }
// }
}
// TODO 1.8 nope
// if (grinder.tank.getFluidAmount() != 0) {
// IIcon fluidIcon = grinder.tank.getFluid().getFluid().getIcon();
// if (fluidIcon != null) {
// this.mc.renderEngine.bindTexture(texture);
// drawTexturedModalRect(k + 7, l + 15, 176, 31, 20, 55);
//
// this.mc.renderEngine
// .bindTexture(TextureMap.locationBlocksTexture);
// int liquidHeight = grinder.tank.getFluidAmount() * 47
// / grinder.tank.getCapacity();
// GuiUtil.drawRepeated(fluidIcon, k + 11, l + 19 + 47
// - liquidHeight, 12.0D, liquidHeight, this.zLevel);
//
// this.mc.renderEngine.bindTexture(texture);
//
// drawTexturedModalRect(k + 11, l + 19, 176, 86, 12, 47);
// }
// }
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.industrialgrinder.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.industrialgrinder.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
}
}

View file

@ -9,80 +9,86 @@ import reborncore.client.gui.GuiUtil;
import techreborn.client.container.ContainerIndustrialSawmill;
import techreborn.tiles.TileIndustrialSawmill;
public class GuiIndustrialSawmill extends GuiContainer {
public class GuiIndustrialSawmill extends GuiContainer
{
public static final ResourceLocation texture = new ResourceLocation(
"techreborn", "textures/gui/industrial_sawmill.png");
public static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/industrial_sawmill.png");
TileIndustrialSawmill sawmill;
TileIndustrialSawmill sawmill;
public GuiIndustrialSawmill(EntityPlayer player,
TileIndustrialSawmill tilesawmill) {
super(new ContainerIndustrialSawmill(tilesawmill, player));
this.xSize = 176;
this.ySize = 167;
sawmill = tilesawmill;
}
public GuiIndustrialSawmill(EntityPlayer player, TileIndustrialSawmill tilesawmill)
{
super(new ContainerIndustrialSawmill(tilesawmill, player));
this.xSize = 176;
this.ySize = 167;
sawmill = tilesawmill;
}
@Override
public void initGui() {
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
public void initGui()
{
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
int j = 0;
j = sawmill.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 56, l + 38, 176, 14, j - 1, 11);
}
j = sawmill.getProgressScaled(24);
if (j > 0)
{
this.drawTexturedModalRect(k + 56, l + 38, 176, 14, j - 1, 11);
}
j = sawmill.getEnergyScaled(12);
if (j > 0)
{
this.drawTexturedModalRect(k + 33, l + 65 + 12 - j, 176, 12 - j, 14, j + 2);
}
// TODO 1.8
// if (sawmill.tank.getFluidAmount() != 0) {
// IIcon fluidIcon = sawmill.tank.getFluid().getFluid().getIcon();
// if (fluidIcon != null) {
// this.mc.renderEngine.bindTexture(texture);
//
//
// this.mc.renderEngine
// .bindTexture(TextureMap.locationBlocksTexture);
// int liquidHeight = sawmill.tank.getFluidAmount() * 47
// / sawmill.tank.getCapacity();
// GuiUtil.drawRepeated(fluidIcon, k + 11, l + 19 + 47
// - liquidHeight, 12.0D, liquidHeight, this.zLevel);
//
// this.mc.renderEngine.bindTexture(texture);
// // drawTexturedModalRect(k + 7, l + 15, 176, 31, 20, 55);
// }
// }
drawTexturedModalRect(k + 11, l + 19, 176, 86, 12, 47);
if (sawmill.getMutliBlock() != true)
{
GuiUtil.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38,
l + 52 + 12 - 0, -1);
}
j = sawmill.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 33, l + 65 + 12 - j, 176, 12 - j, 14, j + 2);
}
//TODO 1.8
// if (sawmill.tank.getFluidAmount() != 0) {
// IIcon fluidIcon = sawmill.tank.getFluid().getFluid().getIcon();
// if (fluidIcon != null) {
// this.mc.renderEngine.bindTexture(texture);
//
//
// this.mc.renderEngine
// .bindTexture(TextureMap.locationBlocksTexture);
// int liquidHeight = sawmill.tank.getFluidAmount() * 47
// / sawmill.tank.getCapacity();
// GuiUtil.drawRepeated(fluidIcon, k + 11, l + 19 + 47
// - liquidHeight, 12.0D, liquidHeight, this.zLevel);
//
// this.mc.renderEngine.bindTexture(texture);
// // drawTexturedModalRect(k + 7, l + 15, 176, 31, 20, 55);
// }
// }
drawTexturedModalRect(k + 11, l + 19, 176, 86, 12, 47);
if (sawmill.getMutliBlock() != true) {
GuiUtil.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38, l + 52 + 12 - 0, -1);
}
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.industrialsawmill.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(
I18n.translateToLocalFormatted("container.inventory", new Object[0]), 58,
this.ySize - 96 + 2, 4210752);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.industrialsawmill.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 58,
this.ySize - 96 + 2, 4210752);
}
}

View file

@ -8,46 +8,55 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerIronFurnace;
import techreborn.tiles.TileIronFurnace;
public class GuiIronFurnace extends GuiContainer {
public class GuiIronFurnace extends GuiContainer
{
public static final ResourceLocation texture = new ResourceLocation("minecraft", "textures/gui/container/furnace.png");
public static final ResourceLocation texture = new ResourceLocation("minecraft",
"textures/gui/container/furnace.png");
TileIronFurnace furnace;
ContainerIronFurnace containerGrinder;
TileIronFurnace furnace;
ContainerIronFurnace containerGrinder;
public GuiIronFurnace(EntityPlayer player, TileIronFurnace tilegrinder) {
super(new ContainerIronFurnace(tilegrinder, player));
this.xSize = 176;
this.ySize = 167;
furnace = tilegrinder;
containerGrinder = (ContainerIronFurnace) this.inventorySlots;
}
public GuiIronFurnace(EntityPlayer player, TileIronFurnace tilegrinder)
{
super(new ContainerIronFurnace(tilegrinder, player));
this.xSize = 176;
this.ySize = 167;
furnace = tilegrinder;
containerGrinder = (ContainerIronFurnace) this.inventorySlots;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
int j = 0;
j = furnace.gaugeProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
}
j = furnace.gaugeProgressScaled(24);
if (j > 0)
{
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
}
j = furnace.gaugeFuelScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 57, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
j = furnace.gaugeFuelScaled(12);
if (j > 0)
{
this.drawTexturedModalRect(k + 57, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.ironfurnace.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.ironfurnace.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
}
}

View file

@ -1,5 +1,7 @@
package techreborn.client.gui;
import java.awt.*;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
@ -9,37 +11,47 @@ import reborncore.common.powerSystem.PowerSystem;
import techreborn.client.container.ContainerLesu;
import techreborn.tiles.lesu.TileLesu;
import java.awt.*;
public class GuiLesu extends GuiContainer
{
public class GuiLesu extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/aesu.png");
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/aesu.png");
TileLesu aesu;
ContainerLesu containerLesu;
TileLesu aesu;
public GuiLesu(EntityPlayer player, TileLesu tileaesu) {
super(new ContainerLesu(tileaesu, player));
this.xSize = 176;
this.ySize = 197;
aesu = tileaesu;
this.containerLesu = (ContainerLesu) this.inventorySlots;
}
ContainerLesu containerLesu;
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
public GuiLesu(EntityPlayer player, TileLesu tileaesu)
{
super(new ContainerLesu(tileaesu, player));
this.xSize = 176;
this.ySize = 165;
aesu = tileaesu;
this.containerLesu = (ContainerLesu) this.inventorySlots;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
this.fontRendererObj.drawString(I18n.translateToLocal("tile.techreborn.lesu.name"), 40, 10,
Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerLesu.euOut) + "/t", 10, 20,
Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerLesu.storedEu), 10, 30,
Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerLesu.euChange) + " change", 10, 40,
Color.WHITE.getRGB());
this.fontRendererObj.drawString(containerLesu.connectedBlocks + " blocks", 10, 50, Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerLesu.euStorage) + " max", 10, 60,
Color.WHITE.getRGB());
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
this.fontRendererObj.drawString(I18n.translateToLocal("tile.techreborn.lesu.name"), 40, 10, Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerLesu.euOut) + "/t", 10, 20, Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerLesu.storedEu), 10, 30, Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerLesu.euChange) + " change", 10, 40, Color.WHITE.getRGB());
this.fontRendererObj.drawString(containerLesu.connectedBlocks + " blocks", 10, 50, Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerLesu.euStorage) + " max", 10, 60, Color.WHITE.getRGB());
}
}

View file

@ -8,48 +8,51 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerMatterFabricator;
import techreborn.tiles.TileMatterFabricator;
public class GuiMatterFabricator extends GuiContainer {
public class GuiMatterFabricator extends GuiContainer
{
private static final ResourceLocation texture = new ResourceLocation(
"techreborn", "textures/gui/matterfabricator.png");
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/matterfabricator.png");
TileMatterFabricator matterfab;
TileMatterFabricator matterfab;
ContainerMatterFabricator containerMatterFabricator;
ContainerMatterFabricator containerMatterFabricator;
public GuiMatterFabricator(EntityPlayer player, TileMatterFabricator tilematterfab) {
super(new ContainerMatterFabricator(tilematterfab, player));
this.xSize = 176;
this.ySize = 167;
matterfab = tilematterfab;
containerMatterFabricator = (ContainerMatterFabricator) this.inventorySlots;
}
public GuiMatterFabricator(EntityPlayer player, TileMatterFabricator tilematterfab)
{
super(new ContainerMatterFabricator(tilematterfab, player));
this.xSize = 176;
this.ySize = 167;
matterfab = tilematterfab;
containerMatterFabricator = (ContainerMatterFabricator) this.inventorySlots;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = containerMatterFabricator.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, j + 1, 16);
}
}
int j = containerMatterFabricator.getProgressScaled(24);
if (j > 0)
{
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, j + 1, 16);
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
int p_146979_2_) {
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
String name = I18n.translateToLocal("tile.techreborn.matterfabricator.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(
I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString(containerMatterFabricator.getProgressScaled(100) + "%", 80, 50, 4210752);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
String name = I18n.translateToLocal("tile.techreborn.matterfabricator.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString(containerMatterFabricator.getProgressScaled(100) + "%", 80, 50, 4210752);
}
}

View file

@ -8,39 +8,40 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerQuantumTank;
import techreborn.tiles.TileQuantumTank;
public class GuiQuantumTank extends GuiContainer {
public class GuiQuantumTank extends GuiContainer
{
private static final ResourceLocation texture = new ResourceLocation(
"techreborn", "textures/gui/thermal_generator.png");
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/thermal_generator.png");
TileQuantumTank tile;
TileQuantumTank tile;
public GuiQuantumTank(EntityPlayer player, TileQuantumTank tile) {
super(new ContainerQuantumTank(tile, player));
this.xSize = 176;
this.ySize = 167;
this.tile = tile;
}
public GuiQuantumTank(EntityPlayer player, TileQuantumTank tile)
{
super(new ContainerQuantumTank(tile, player));
this.xSize = 176;
this.ySize = 167;
this.tile = tile;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.quantumTank.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(
I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);
this.fontRendererObj.drawString(tile.tank.getFluidAmount() + "", 10,
30, 16448255);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.quantumTank.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);
this.fontRendererObj.drawString(tile.tank.getFluidAmount() + "", 10, 30, 16448255);
}
}

View file

@ -8,45 +8,53 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerRecycler;
import techreborn.tiles.teir1.TileRecycler;
public class GuiRecycler extends GuiContainer {
public class GuiRecycler extends GuiContainer
{
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/compressor.png");
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/compressor.png");
TileRecycler compressor;
ContainerRecycler containerGrinder;
TileRecycler compressor;
ContainerRecycler containerGrinder;
public GuiRecycler(EntityPlayer player, TileRecycler tilegrinder) {
super(new ContainerRecycler(tilegrinder, player));
this.xSize = 176;
this.ySize = 167;
compressor = tilegrinder;
containerGrinder = (ContainerRecycler) this.inventorySlots;
}
public GuiRecycler(EntityPlayer player, TileRecycler tilegrinder)
{
super(new ContainerRecycler(tilegrinder, player));
this.xSize = 176;
this.ySize = 167;
compressor = tilegrinder;
containerGrinder = (ContainerRecycler) this.inventorySlots;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
j = compressor.gaugeProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
}
int j = 0;
j = compressor.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
j = compressor.gaugeProgressScaled(24);
if (j > 0)
{
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.recycler.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
j = compressor.getEnergyScaled(12);
if (j > 0)
{
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.recycler.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
}
}

View file

@ -9,54 +9,59 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerRollingMachine;
import techreborn.tiles.TileRollingMachine;
public class GuiRollingMachine extends GuiContainer {
public class GuiRollingMachine extends GuiContainer
{
public static final ResourceLocation texture = new ResourceLocation(
"techreborn", "textures/gui/rolling_machine.png");
TileRollingMachine rollingMachine;
ContainerRollingMachine containerRollingMachine;
public static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/rolling_machine.png");
TileRollingMachine rollingMachine;
ContainerRollingMachine containerRollingMachine;
public GuiRollingMachine(EntityPlayer player, TileRollingMachine tileRollingmachine) {
super(new ContainerRollingMachine(tileRollingmachine, player));
this.xSize = 176;
this.ySize = 167;
rollingMachine = tileRollingmachine;
containerRollingMachine = (ContainerRollingMachine) this.inventorySlots;
}
public GuiRollingMachine(EntityPlayer player, TileRollingMachine tileRollingmachine)
{
super(new ContainerRollingMachine(tileRollingmachine, player));
this.xSize = 176;
this.ySize = 167;
rollingMachine = tileRollingmachine;
containerRollingMachine = (ContainerRollingMachine) this.inventorySlots;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = this.containerRollingMachine.getBurnTimeRemainingScaled(24);
this.drawTexturedModalRect(k + 91, l + 34, 176, 14, j + 1, 19);
int j = this.containerRollingMachine.getBurnTimeRemainingScaled(24);
this.drawTexturedModalRect(k + 91, l + 34, 176, 14, j + 1, 19);
j = this.rollingMachine.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 7, l + 33 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
j = this.rollingMachine.getEnergyScaled(12);
if (j > 0)
{
this.drawTexturedModalRect(k + 7, l + 33 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.rollingmachine.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(
I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.rollingmachine.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
}
@Override
public void initGui() {
this.buttonList.clear();
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.buttonList.add(new GuiButton(0, k + 4, l + 4, 20, 20, "R"));
super.initGui();
}
@Override
public void initGui()
{
this.buttonList.clear();
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.buttonList.add(new GuiButton(0, k + 4, l + 4, 20, 20, "R"));
super.initGui();
}
}

View file

@ -8,46 +8,55 @@ import net.minecraft.util.ResourceLocation;
import techreborn.client.container.ContainerScrapboxinator;
import techreborn.tiles.TileScrapboxinator;
public class GuiScrapboxinator extends GuiContainer {
public class GuiScrapboxinator extends GuiContainer
{
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/scrapboxinator.png");
public static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/scrapboxinator.png");
TileScrapboxinator tile;
ContainerScrapboxinator containerScrapboxinator;
TileScrapboxinator tile;
ContainerScrapboxinator containerScrapboxinator;
public GuiScrapboxinator(EntityPlayer player, TileScrapboxinator tileScrapboxinator) {
super(new ContainerScrapboxinator(tileScrapboxinator, player));
this.xSize = 176;
this.ySize = 167;
tile = tileScrapboxinator;
containerScrapboxinator = (ContainerScrapboxinator) this.inventorySlots;
}
public GuiScrapboxinator(EntityPlayer player, TileScrapboxinator tileScrapboxinator)
{
super(new ContainerScrapboxinator(tileScrapboxinator, player));
this.xSize = 176;
this.ySize = 167;
tile = tileScrapboxinator;
containerScrapboxinator = (ContainerScrapboxinator) this.inventorySlots;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
j = tile.gaugeProgressScaled(24);
// System.out.println(compressor.gaugeProgressScaled(10));
if (j > 0) {
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
}
int j = 0;
j = tile.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
j = tile.gaugeProgressScaled(24);
// System.out.println(compressor.gaugeProgressScaled(10));
if (j > 0)
{
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = net.minecraft.util.text.translation.I18n.translateToLocal("tile.techreborn.scrapboxinator.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
j = tile.getEnergyScaled(12);
if (j > 0)
{
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = net.minecraft.util.text.translation.I18n.translateToLocal("tile.techreborn.scrapboxinator.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2,
4210752);
}
}

View file

@ -8,39 +8,41 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerSemifluidGenerator;
import techreborn.tiles.generator.TileSemifluidGenerator;
public class GuiSemifluidGenerator extends GuiContainer {
public class GuiSemifluidGenerator extends GuiContainer
{
//TODO: use semifluid generator texture
private static final ResourceLocation texture = new ResourceLocation(
"techreborn", "textures/gui/ThermalGenerator.png");
// TODO: use semifluid generator texture
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/ThermalGenerator.png");
TileSemifluidGenerator tile;
TileSemifluidGenerator tile;
public GuiSemifluidGenerator(EntityPlayer player, TileSemifluidGenerator tile) {
super(new ContainerSemifluidGenerator(tile, player));
this.xSize = 176;
this.ySize = 167;
this.tile = tile;
}
public GuiSemifluidGenerator(EntityPlayer player, TileSemifluidGenerator tile)
{
super(new ContainerSemifluidGenerator(tile, player));
this.xSize = 176;
this.ySize = 167;
this.tile = tile;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
int p_146979_2_) {
String name = "Semifluid Generator";
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(
I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);
this.fontRendererObj.drawString(tile.tank.getFluidAmount() + "", 10,
30, 16448255);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = "Semifluid Generator";
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);
this.fontRendererObj.drawString(tile.tank.getFluidAmount() + "", 10, 30, 16448255);
}
}

View file

@ -8,40 +8,42 @@ import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerThermalGenerator;
import techreborn.tiles.generator.TileThermalGenerator;
public class GuiThermalGenerator extends GuiContainer {
public class GuiThermalGenerator extends GuiContainer
{
private static final ResourceLocation texture = new ResourceLocation(
"techreborn", "textures/gui/thermal_generator.png");
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/thermal_generator.png");
TileThermalGenerator tile;
TileThermalGenerator tile;
public GuiThermalGenerator(EntityPlayer player, TileThermalGenerator tile) {
super(new ContainerThermalGenerator(tile, player));
this.xSize = 176;
this.ySize = 167;
this.tile = tile;
}
public GuiThermalGenerator(EntityPlayer player, TileThermalGenerator tile)
{
super(new ContainerThermalGenerator(tile, player));
this.xSize = 176;
this.ySize = 167;
this.tile = tile;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.thermalGenerator.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(
I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);
this.fontRendererObj.drawString(tile.tank.getFluidAmount() + "", 10, 30, 16448255);
this.fontRendererObj.drawString(tile.getEnergy() + "", 10, 40, 16448255);
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.thermalGenerator.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);
this.fontRendererObj.drawString(tile.tank.getFluidAmount() + "", 10, 30, 16448255);
this.fontRendererObj.drawString(tile.getEnergy() + "", 10, 40, 16448255);
}
}
}

View file

@ -1,5 +1,7 @@
package techreborn.client.gui;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
@ -15,87 +17,107 @@ import techreborn.client.container.ContainerVacuumFreezer;
import techreborn.proxies.ClientProxy;
import techreborn.tiles.TileVacuumFreezer;
import java.io.IOException;
public class GuiVacuumFreezer extends GuiContainer
{
public class GuiVacuumFreezer extends GuiContainer {
public static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/vacuum_freezer.png");
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/vacuum_freezer.png");
TileVacuumFreezer crafter;
ContainerVacuumFreezer containerVacuumFreezer;
TileVacuumFreezer crafter;
ContainerVacuumFreezer containerVacuumFreezer;
public GuiVacuumFreezer(EntityPlayer player, TileVacuumFreezer tilealloysmelter)
{
super(new ContainerVacuumFreezer(tilealloysmelter, player));
this.xSize = 176;
this.ySize = 167;
crafter = tilealloysmelter;
this.containerVacuumFreezer = (ContainerVacuumFreezer) this.inventorySlots;
}
public GuiVacuumFreezer(EntityPlayer player, TileVacuumFreezer tilealloysmelter) {
super(new ContainerVacuumFreezer(tilealloysmelter, player));
this.xSize = 176;
this.ySize = 167;
crafter = tilealloysmelter;
this.containerVacuumFreezer = (ContainerVacuumFreezer) this.inventorySlots;
}
@Override
public void initGui()
{
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
GuiButton button = new GuiButton(212, k + this.xSize - 24, l + 4, 20, 20, "");
buttonList.add(button);
super.initGui();
CoordTriplet coordinates = new CoordTriplet(crafter.getPos().getX(), crafter.getPos().getY() - 5,
crafter.getPos().getZ());
if (coordinates.equals(ClientProxy.multiblockRenderEvent.anchor))
{
ClientProxy.multiblockRenderEvent.setMultiblock(null);
button.displayString = "B";
} else
{
button.displayString = "A";
}
}
@Override
public void initGui() {
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
GuiButton button = new GuiButton(212, k + this.xSize - 24, l + 4, 20, 20, "");
buttonList.add(button);
super.initGui();
CoordTriplet coordinates = new CoordTriplet(crafter.getPos().getX(), crafter.getPos().getY() - 5, crafter.getPos().getZ());
if(coordinates.equals(ClientProxy.multiblockRenderEvent.anchor)){
ClientProxy.multiblockRenderEvent.setMultiblock(null);
button.displayString = "B";
} else {
button.displayString = "A";
}
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
int j = 0;
j = crafter.getProgressScaled(24);
if (j > 0)
{
this.drawTexturedModalRect(k + 79, l + 37, 176, 14, j + 1, 16);
}
j = crafter.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 79, l + 37, 176, 14, j + 1, 16);
}
j = crafter.getEnergyScaled(12);
if (j > 0)
{
this.drawTexturedModalRect(k + 26, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
j = crafter.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 26, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
if (containerVacuumFreezer.machineStatus == 0)
{
GuiUtil.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38,
l + 52 + 12 - 0, -1);
}
}
if (containerVacuumFreezer.machineStatus == 0) {
GuiUtil.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38, l + 52 + 12 - 0, -1);
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
{
String name = I18n.translateToLocal("tile.techreborn.vacuumfreezer.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.vacuumfreezer.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
@Override
public void actionPerformed(GuiButton button) throws IOException {
super.actionPerformed(button);
if(button.id == 212){
if(ClientProxy.multiblockRenderEvent.currentMultiblock == null){
{//This code here makes a basic multiblock and then sets to the selected one.
MultiblockSet set = new MultiblockSet(ClientMultiBlocks.frezzer);
ClientProxy.multiblockRenderEvent.setMultiblock(set);
ClientProxy.multiblockRenderEvent.partent = new Location(crafter.getPos().getX(), crafter.getPos().getY(), crafter.getPos().getZ(), crafter.getWorld());
ClientProxy.multiblockRenderEvent.anchor = new CoordTriplet(crafter.getPos().getX() , crafter.getPos().getY() -5 , crafter.getPos().getZ());
}
button.displayString = "A";
} else {
ClientProxy.multiblockRenderEvent.setMultiblock(null);
button.displayString = "B";
}
}
}
@Override
public void actionPerformed(GuiButton button) throws IOException
{
super.actionPerformed(button);
if (button.id == 212)
{
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null)
{
{// This code here makes a basic multiblock and then sets to the
// selected one.
MultiblockSet set = new MultiblockSet(ClientMultiBlocks.frezzer);
ClientProxy.multiblockRenderEvent.setMultiblock(set);
ClientProxy.multiblockRenderEvent.partent = new Location(crafter.getPos().getX(),
crafter.getPos().getY(), crafter.getPos().getZ(), crafter.getWorld());
ClientProxy.multiblockRenderEvent.anchor = new CoordTriplet(crafter.getPos().getX(),
crafter.getPos().getY() - 5, crafter.getPos().getZ());
}
button.displayString = "A";
} else
{
ClientProxy.multiblockRenderEvent.setMultiblock(null);
button.displayString = "B";
}
}
}
}

View file

@ -13,103 +13,119 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
import reborncore.api.power.IEnergyInterfaceItem;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.util.Color;
import techreborn.client.keybindings.KeyBindings;
import techreborn.config.ConfigTechReborn;
public class ChargeHud {
public static final ChargeHud instance = new ChargeHud();
private static Minecraft mc = Minecraft.getMinecraft();
public static KeyBindings key;
public static boolean showHud = true;
public class ChargeHud
{
public static final ChargeHud instance = new ChargeHud();
private static Minecraft mc = Minecraft.getMinecraft();
public static KeyBindings key;
public static boolean showHud = true;
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.LOW)
public void onRenderExperienceBar(RenderGameOverlayEvent event)
{
if (key.config.isPressed())
{
showHud = !showHud;
}
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.LOW)
public void onRenderExperienceBar(RenderGameOverlayEvent event) {
if (key.config.isPressed()) {
showHud = !showHud;
}
if (event.isCancelable() || event.type != ElementType.ALL)
return;
if (event.isCancelable() || event.type != ElementType.ALL)
return;
if (mc.inGameHasFocus || (mc.currentScreen != null && mc.gameSettings.showDebugInfo))
{
if (ConfigTechReborn.ShowChargeHud)
drawChargeHud(event.resolution);
}
}
if (mc.inGameHasFocus || (mc.currentScreen != null && mc.gameSettings.showDebugInfo)) {
if (ConfigTechReborn.ShowChargeHud)
drawChargeHud(event.resolution);
}
}
public void drawChargeHud(ScaledResolution res)
{
EntityPlayer player = mc.thePlayer;
ItemStack armorstack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
ItemStack stack = mc.thePlayer.inventory.getCurrentItem();
public void drawChargeHud(ScaledResolution res) {
EntityPlayer player = mc.thePlayer;
ItemStack armorstack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
ItemStack stack = mc.thePlayer.inventory.getCurrentItem();
int y = 5;
int y = 5;
if (armorstack != null && ConfigTechReborn.ShowChargeHud
&& armorstack.getItem() instanceof IEnergyInterfaceItem)
{
double MaxCharge = ((IEnergyInterfaceItem) armorstack.getItem()).getMaxPower(armorstack);
double CurrentCharge = ((IEnergyInterfaceItem) armorstack.getItem()).getEnergy(armorstack);
Color color = Color.GREEN;
double quarter = MaxCharge / 4;
double half = MaxCharge / 2;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(32826);
RenderHelper.enableStandardItemLighting();
RenderHelper.enableGUIStandardItemLighting();
// Render the stack
renderItemStack(armorstack, 0, y - 5);
// Get the color depending on current charge
if (CurrentCharge <= half)
{
color = Color.YELLOW;
}
if (CurrentCharge <= quarter)
{
color = Color.DARK_RED;
}
mc.fontRendererObj.drawString(color + PowerSystem.getLocaliszedPower(CurrentCharge) + "/"
+ PowerSystem.getLocaliszedPower(MaxCharge), 20, y, 0);
y += 20;
}
if (armorstack != null && ConfigTechReborn.ShowChargeHud && armorstack.getItem() instanceof IEnergyInterfaceItem) {
double MaxCharge = ((IEnergyInterfaceItem) armorstack.getItem()).getMaxPower(armorstack);
double CurrentCharge = ((IEnergyInterfaceItem) armorstack.getItem()).getEnergy(armorstack);
Color color = Color.GREEN;
double quarter = MaxCharge / 4;
double half = MaxCharge / 2;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(32826);
RenderHelper.enableStandardItemLighting();
RenderHelper.enableGUIStandardItemLighting();
//Render the stack
renderItemStack(armorstack, 0, y - 5);
//Get the color depending on current charge
if (CurrentCharge <= half) {
color = Color.YELLOW;
}
if (CurrentCharge <= quarter) {
color = Color.DARK_RED;
}
mc.fontRendererObj.drawString(color + PowerSystem.getLocaliszedPower(CurrentCharge) + "/" + PowerSystem.getLocaliszedPower(MaxCharge), 20, y, 0);
y += 20;
}
if (showHud)
{
if (stack != null && stack.getItem() instanceof IEnergyInterfaceItem)
{
double MaxCharge = ((IEnergyInterfaceItem) stack.getItem()).getMaxPower(stack);
double CurrentCharge = ((IEnergyInterfaceItem) stack.getItem()).getEnergy(stack);
Color color = Color.GREEN;
double quarter = MaxCharge / 4;
double half = MaxCharge / 2;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(32826);
RenderHelper.enableStandardItemLighting();
RenderHelper.enableGUIStandardItemLighting();
renderItemStack(stack, 0, y - 5);
if (CurrentCharge <= half)
{
color = Color.YELLOW;
}
if (CurrentCharge <= quarter)
{
color = Color.DARK_RED;
}
mc.fontRendererObj.drawString(color + PowerSystem.getLocaliszedPower(CurrentCharge) + "/"
+ PowerSystem.getLocaliszedPower(MaxCharge), 20, y, 0);
}
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
if (showHud) {
if (stack != null && stack.getItem() instanceof IEnergyInterfaceItem) {
double MaxCharge = ((IEnergyInterfaceItem) stack.getItem()).getMaxPower(stack);
double CurrentCharge = ((IEnergyInterfaceItem) stack.getItem()).getEnergy(stack);
Color color = Color.GREEN;
double quarter = MaxCharge / 4;
double half = MaxCharge / 2;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(32826);
RenderHelper.enableStandardItemLighting();
RenderHelper.enableGUIStandardItemLighting();
renderItemStack(stack, 0, y - 5);
if (CurrentCharge <= half) {
color = Color.YELLOW;
}
if (CurrentCharge <= quarter) {
color = Color.DARK_RED;
}
mc.fontRendererObj.drawString(color + PowerSystem.getLocaliszedPower(CurrentCharge) + "/" + PowerSystem.getLocaliszedPower(MaxCharge), 20, y, 0);
}
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
public void renderItemStack(ItemStack stack, int x, int y)
{
if (stack != null)
{
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderHelper.enableGUIStandardItemLighting();
public void renderItemStack(ItemStack stack, int x, int y)
{
if (stack != null)
{
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderHelper.enableGUIStandardItemLighting();
RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
itemRenderer.renderItemAndEffectIntoGUI(stack, x, y);
RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
itemRenderer.renderItemAndEffectIntoGUI(stack, x, y);
GL11.glDisable(GL11.GL_LIGHTING);
}
}
GL11.glDisable(GL11.GL_LIGHTING);
}
}
}

View file

@ -1,12 +1,14 @@
package techreborn.client.keybindings;
import net.minecraft.client.settings.KeyBinding;
import org.lwjgl.input.Keyboard;
import techreborn.lib.ModInfo;
public class KeyBindings {
public class KeyBindings
{
public static KeyBinding config = new KeyBinding(ModInfo.Keys.CONFIG,
Keyboard.KEY_P, ModInfo.Keys.CATEGORY);
public static KeyBinding config = new KeyBinding(ModInfo.Keys.CONFIG, Keyboard.KEY_P, ModInfo.Keys.CATEGORY);
}

View file

@ -5,18 +5,22 @@ import net.minecraftforge.fml.common.gameevent.InputEvent;
import techreborn.Core;
import techreborn.lib.Key;
public class KeyInputEventHandler {
private static Key getPressedKeybinding() {
if (KeyBindings.config.isPressed()) {
return Key.CONFIG;
}
public class KeyInputEventHandler
{
private static Key getPressedKeybinding()
{
if (KeyBindings.config.isPressed())
{
return Key.CONFIG;
}
return Key.UNKNOWN;
}
return Key.UNKNOWN;
}
@SubscribeEvent
public void handleKeyInputEvent(InputEvent.KeyInputEvent event) {
Core.logHelper.info(getPressedKeybinding());
}
@SubscribeEvent
public void handleKeyInputEvent(InputEvent.KeyInputEvent event)
{
Core.logHelper.info(getPressedKeybinding());
}
}

View file

@ -6,10 +6,8 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.init.Blocks;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import org.lwjgl.opengl.GL11;
import techreborn.blocks.BlockNuke;
import techreborn.entitys.EntityNukePrimed;
import techreborn.init.ModBlocks;
@ -17,51 +15,59 @@ import techreborn.init.ModBlocks;
/**
* Created by Mark on 13/03/2016.
*/
public class RenderNukePrimed extends Render<EntityNukePrimed> {
public class RenderNukePrimed extends Render<EntityNukePrimed>
{
public RenderNukePrimed(RenderManager renderManager) {
super(renderManager);
this.shadowSize = 0.5F;
}
public RenderNukePrimed(RenderManager renderManager)
{
super(renderManager);
this.shadowSize = 0.5F;
}
@Override
public void doRender(EntityNukePrimed entity, double x, double y, double z, float entityYaw, float partialTicks) {
BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
GlStateManager.pushMatrix();
GlStateManager.translate((float) x, (float) y + 0.5F, (float) z);
if ((float) entity.fuse - partialTicks + 1.0F < 10.0F) {
float f = 1.0F - ((float) entity.fuse - partialTicks + 1.0F) / 10.0F;
f = MathHelper.clamp_float(f, 0.0F, 1.0F);
f = f * f;
f = f * f;
float f1 = 1.0F + f * 0.3F;
GlStateManager.scale(f1, f1, f1);
}
float f2 = (1.0F - ((float) entity.fuse - partialTicks + 1.0F) / 100.0F) * 0.8F;
this.bindEntityTexture(entity);
GlStateManager.translate(-0.5F, -0.5F, 0.5F);
blockrendererdispatcher.renderBlockBrightness(ModBlocks.nuke.getDefaultState(), entity.getBrightness(partialTicks));
GlStateManager.translate(0.0F, 0.0F, 1.0F);
if (entity.fuse / 5 % 2 == 0) {
GlStateManager.disableLighting();
GlStateManager.enableBlend();
GlStateManager.blendFunc(770, 772);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1F);
GlStateManager.doPolygonOffset(-3.0F, -3.0F);
GlStateManager.enablePolygonOffset();
blockrendererdispatcher.renderBlockBrightness(ModBlocks.nuke.getDefaultState().withProperty(BlockNuke.OVERLAY, true), 1.0F);
GlStateManager.doPolygonOffset(0.0F, 0.0F);
GlStateManager.disablePolygonOffset();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableBlend();
GlStateManager.enableLighting();
}
GlStateManager.popMatrix();
super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
@Override
public void doRender(EntityNukePrimed entity, double x, double y, double z, float entityYaw, float partialTicks)
{
BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
GlStateManager.pushMatrix();
GlStateManager.translate((float) x, (float) y + 0.5F, (float) z);
if ((float) entity.fuse - partialTicks + 1.0F < 10.0F)
{
float f = 1.0F - ((float) entity.fuse - partialTicks + 1.0F) / 10.0F;
f = MathHelper.clamp_float(f, 0.0F, 1.0F);
f = f * f;
f = f * f;
float f1 = 1.0F + f * 0.3F;
GlStateManager.scale(f1, f1, f1);
}
float f2 = (1.0F - ((float) entity.fuse - partialTicks + 1.0F) / 100.0F) * 0.8F;
this.bindEntityTexture(entity);
GlStateManager.translate(-0.5F, -0.5F, 0.5F);
blockrendererdispatcher.renderBlockBrightness(ModBlocks.nuke.getDefaultState(),
entity.getBrightness(partialTicks));
GlStateManager.translate(0.0F, 0.0F, 1.0F);
if (entity.fuse / 5 % 2 == 0)
{
GlStateManager.disableLighting();
GlStateManager.enableBlend();
GlStateManager.blendFunc(770, 772);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1F);
GlStateManager.doPolygonOffset(-3.0F, -3.0F);
GlStateManager.enablePolygonOffset();
blockrendererdispatcher.renderBlockBrightness(
ModBlocks.nuke.getDefaultState().withProperty(BlockNuke.OVERLAY, true), 1.0F);
GlStateManager.doPolygonOffset(0.0F, 0.0F);
GlStateManager.disablePolygonOffset();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableBlend();
GlStateManager.enableLighting();
}
GlStateManager.popMatrix();
super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
@Override
protected ResourceLocation getEntityTexture(EntityNukePrimed entity) {
return TextureMap.locationBlocksTexture;
}
@Override
protected ResourceLocation getEntityTexture(EntityNukePrimed entity)
{
return TextureMap.locationBlocksTexture;
}
}

View file

@ -10,25 +10,30 @@ import techreborn.compat.ICompatModule;
/**
* Created by modmuss50 on 05/03/2016.
*/
public class ClientPartLoader implements ICompatModule {
public class ClientPartLoader implements ICompatModule
{
@Override
public void preInit(FMLPreInitializationEvent event) {
MinecraftForge.EVENT_BUS.register(new ClientPartModelBakery());
}
@Override
public void preInit(FMLPreInitializationEvent event)
{
MinecraftForge.EVENT_BUS.register(new ClientPartModelBakery());
}
@Override
public void init(FMLInitializationEvent event) {
@Override
public void init(FMLInitializationEvent event)
{
}
}
@Override
public void postInit(FMLPostInitializationEvent event) {
@Override
public void postInit(FMLPostInitializationEvent event)
{
}
}
@Override
public void serverStarting(FMLServerStartingEvent event) {
@Override
public void serverStarting(FMLServerStartingEvent event)
{
}
}
}

View file

@ -13,23 +13,28 @@ import techreborn.parts.EnumCableType;
/**
* Created by modmuss50 on 04/03/2016.
*/
public class ClientPartModelBakery {
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onModelBake(ModelBakeEvent event){
for(EnumCableType type : EnumCableType.values()){
event.getModelRegistry().putObject(new ModelResourceLocation("techreborn:cable#type=" + type.getName().toLowerCase()), new RenderCablePart(type));
}
}
@SubscribeEvent
public void textureStichEvent(TextureStitchEvent event){
for(EnumCableType type : EnumCableType.values()){
event.map.registerSprite(new ResourceLocation(type.textureName));
}
}
public class ClientPartModelBakery
{
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onModelBake(ModelBakeEvent event)
{
for (EnumCableType type : EnumCableType.values())
{
event.getModelRegistry().putObject(
new ModelResourceLocation("techreborn:cable#type=" + type.getName().toLowerCase()),
new RenderCablePart(type));
}
}
@SubscribeEvent
public void textureStichEvent(TextureStitchEvent event)
{
for (EnumCableType type : EnumCableType.values())
{
event.map.registerSprite(new ResourceLocation(type.textureName));
}
}
}

View file

@ -1,106 +1,152 @@
package techreborn.client.render.parts;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.*;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.property.IExtendedBlockState;
import org.lwjgl.util.vector.Vector3f;
import reborncore.common.misc.vecmath.Vecs3dCube;
import techreborn.parts.CableMultipart;
import techreborn.parts.EnumCableType;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class RenderCablePart implements IBakedModel {
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.property.IExtendedBlockState;
private FaceBakery faceBakery = new FaceBakery();
import org.lwjgl.util.vector.Vector3f;
private TextureAtlasSprite texture;
import reborncore.common.misc.vecmath.Vecs3dCube;
import techreborn.parts.CableMultipart;
import techreborn.parts.EnumCableType;
EnumCableType type;
public class RenderCablePart implements IBakedModel
{
public RenderCablePart(EnumCableType type) {
texture = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(type.textureName);
this.type = type;
}
private FaceBakery faceBakery = new FaceBakery();
public void addCubeToList(Vecs3dCube cube, ArrayList<BakedQuad> list, BlockPartFace face, ModelRotation modelRotation, TextureAtlasSprite cubeTexture) {
BlockFaceUV uv = new BlockFaceUV(new float[]{(float) cube.getMinX(), (float) cube.getMinY(), (float) cube.getMaxX(), (float) cube.getMaxY()}, 0);
face = new BlockPartFace(null, 0, "", uv);
list.add(faceBakery.makeBakedQuad(new Vector3f((float) cube.getMinX(), (float) cube.getMinY(), (float) cube.getMinZ()), new Vector3f((float) cube.getMaxX(), (float) cube.getMinY(), (float) cube.getMaxZ()), face, cubeTexture, EnumFacing.DOWN, modelRotation, null, true, true));//down
list.add(faceBakery.makeBakedQuad(new Vector3f((float) cube.getMinX(), (float) cube.getMaxY(), (float) cube.getMinZ()), new Vector3f((float) cube.getMaxX(), (float) cube.getMaxY(), (float) cube.getMaxZ()), face, cubeTexture, EnumFacing.UP, modelRotation, null, true, true));//up
list.add(faceBakery.makeBakedQuad(new Vector3f((float) cube.getMinX(), (float) cube.getMinY(), (float) cube.getMinZ()), new Vector3f((float) cube.getMaxX(), (float) cube.getMaxY(), (float) cube.getMaxZ()), face, cubeTexture, EnumFacing.NORTH, modelRotation, null, true, true));//north
list.add(faceBakery.makeBakedQuad(new Vector3f((float) cube.getMinX(), (float) cube.getMinY(), (float) cube.getMaxZ()), new Vector3f((float) cube.getMaxX(), (float) cube.getMaxY(), (float) cube.getMaxZ()), face, cubeTexture, EnumFacing.SOUTH, modelRotation, null, true, true));//south
list.add(faceBakery.makeBakedQuad(new Vector3f((float) cube.getMaxX(), (float) cube.getMinY(), (float) cube.getMinZ()), new Vector3f((float) cube.getMaxX(), (float) cube.getMaxY(), (float) cube.getMaxZ()), face, cubeTexture, EnumFacing.EAST, modelRotation, null, true, true));//east
list.add(faceBakery.makeBakedQuad(new Vector3f((float) cube.getMinX(), (float) cube.getMinY(), (float) cube.getMinZ()), new Vector3f((float) cube.getMinX(), (float) cube.getMaxY(), (float) cube.getMaxZ()), face, cubeTexture, EnumFacing.WEST, modelRotation, null, true, true));//west
}
private TextureAtlasSprite texture;
@Override
public List<BakedQuad> getQuads(IBlockState blockState, EnumFacing side, long rand) {
ArrayList<BakedQuad> list = new ArrayList<BakedQuad>();
BlockFaceUV uv = new BlockFaceUV(new float[]{0.0F, 0.0F, 16.0F, 16.0F}, 0);
BlockPartFace face = new BlockPartFace(null, 0, "", uv);
double thickness = type.cableThickness;
double lastThickness = 16 - thickness;
IExtendedBlockState state = (IExtendedBlockState) blockState;
if(side != null){
return Collections.emptyList();
}
addCubeToList(new Vecs3dCube(thickness, thickness, thickness, lastThickness, lastThickness, lastThickness), list, face, ModelRotation.X0_Y0, texture);
if (state != null) {
if (state.getValue(CableMultipart.UP)) {
addCubeToList(new Vecs3dCube(thickness, lastThickness, thickness, lastThickness, 16.0, lastThickness), list, face, ModelRotation.X0_Y0, texture);
}
if (state.getValue(CableMultipart.DOWN)) {
addCubeToList(new Vecs3dCube(thickness, 0.0, thickness, lastThickness, thickness, lastThickness), list, face, ModelRotation.X0_Y0, texture);
}
if (state.getValue(CableMultipart.NORTH)) {
addCubeToList(new Vecs3dCube(thickness, thickness, 0.0, lastThickness, lastThickness, thickness), list, face, ModelRotation.X0_Y0, texture);
}
if (state.getValue(CableMultipart.SOUTH)) {
addCubeToList(new Vecs3dCube(thickness, thickness, lastThickness, lastThickness, lastThickness, 16.0), list, face, ModelRotation.X0_Y0, texture);
}
if (state.getValue(CableMultipart.EAST)) {
addCubeToList(new Vecs3dCube(lastThickness, thickness, thickness, 16.0, lastThickness, lastThickness), list, face, ModelRotation.X0_Y0, texture);
}
if (state.getValue(CableMultipart.WEST)) {
addCubeToList(new Vecs3dCube(0.0, thickness, thickness, thickness, lastThickness, lastThickness), list, face, ModelRotation.X0_Y0, texture);
}
}
return list;
}
EnumCableType type;
@Override
public boolean isAmbientOcclusion() {
return false;
}
public RenderCablePart(EnumCableType type)
{
texture = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(type.textureName);
this.type = type;
}
@Override
public boolean isGui3d() {
return true;
}
public void addCubeToList(Vecs3dCube cube, ArrayList<BakedQuad> list, BlockPartFace face,
ModelRotation modelRotation, TextureAtlasSprite cubeTexture)
{
BlockFaceUV uv = new BlockFaceUV(new float[] { (float) cube.getMinX(), (float) cube.getMinY(),
(float) cube.getMaxX(), (float) cube.getMaxY() }, 0);
face = new BlockPartFace(null, 0, "", uv);
list.add(faceBakery.makeBakedQuad(
new Vector3f((float) cube.getMinX(), (float) cube.getMinY(), (float) cube.getMinZ()),
new Vector3f((float) cube.getMaxX(), (float) cube.getMinY(), (float) cube.getMaxZ()), face, cubeTexture,
EnumFacing.DOWN, modelRotation, null, true, true));// down
list.add(faceBakery.makeBakedQuad(
new Vector3f((float) cube.getMinX(), (float) cube.getMaxY(), (float) cube.getMinZ()),
new Vector3f((float) cube.getMaxX(), (float) cube.getMaxY(), (float) cube.getMaxZ()), face, cubeTexture,
EnumFacing.UP, modelRotation, null, true, true));// up
list.add(faceBakery.makeBakedQuad(
new Vector3f((float) cube.getMinX(), (float) cube.getMinY(), (float) cube.getMinZ()),
new Vector3f((float) cube.getMaxX(), (float) cube.getMaxY(), (float) cube.getMaxZ()), face, cubeTexture,
EnumFacing.NORTH, modelRotation, null, true, true));// north
list.add(faceBakery.makeBakedQuad(
new Vector3f((float) cube.getMinX(), (float) cube.getMinY(), (float) cube.getMaxZ()),
new Vector3f((float) cube.getMaxX(), (float) cube.getMaxY(), (float) cube.getMaxZ()), face, cubeTexture,
EnumFacing.SOUTH, modelRotation, null, true, true));// south
list.add(faceBakery.makeBakedQuad(
new Vector3f((float) cube.getMaxX(), (float) cube.getMinY(), (float) cube.getMinZ()),
new Vector3f((float) cube.getMaxX(), (float) cube.getMaxY(), (float) cube.getMaxZ()), face, cubeTexture,
EnumFacing.EAST, modelRotation, null, true, true));// east
list.add(faceBakery.makeBakedQuad(
new Vector3f((float) cube.getMinX(), (float) cube.getMinY(), (float) cube.getMinZ()),
new Vector3f((float) cube.getMinX(), (float) cube.getMaxY(), (float) cube.getMaxZ()), face, cubeTexture,
EnumFacing.WEST, modelRotation, null, true, true));// west
}
@Override
public boolean isBuiltInRenderer() {
return false;
}
@Override
public List<BakedQuad> getQuads(IBlockState blockState, EnumFacing side, long rand)
{
ArrayList<BakedQuad> list = new ArrayList<BakedQuad>();
BlockFaceUV uv = new BlockFaceUV(new float[] { 0.0F, 0.0F, 16.0F, 16.0F }, 0);
BlockPartFace face = new BlockPartFace(null, 0, "", uv);
double thickness = type.cableThickness;
double lastThickness = 16 - thickness;
IExtendedBlockState state = (IExtendedBlockState) blockState;
if (side != null)
{
return Collections.emptyList();
}
addCubeToList(new Vecs3dCube(thickness, thickness, thickness, lastThickness, lastThickness, lastThickness),
list, face, ModelRotation.X0_Y0, texture);
if (state != null)
{
if (state.getValue(CableMultipart.UP))
{
addCubeToList(new Vecs3dCube(thickness, lastThickness, thickness, lastThickness, 16.0, lastThickness),
list, face, ModelRotation.X0_Y0, texture);
}
if (state.getValue(CableMultipart.DOWN))
{
addCubeToList(new Vecs3dCube(thickness, 0.0, thickness, lastThickness, thickness, lastThickness), list,
face, ModelRotation.X0_Y0, texture);
}
if (state.getValue(CableMultipart.NORTH))
{
addCubeToList(new Vecs3dCube(thickness, thickness, 0.0, lastThickness, lastThickness, thickness), list,
face, ModelRotation.X0_Y0, texture);
}
if (state.getValue(CableMultipart.SOUTH))
{
addCubeToList(new Vecs3dCube(thickness, thickness, lastThickness, lastThickness, lastThickness, 16.0),
list, face, ModelRotation.X0_Y0, texture);
}
if (state.getValue(CableMultipart.EAST))
{
addCubeToList(new Vecs3dCube(lastThickness, thickness, thickness, 16.0, lastThickness, lastThickness),
list, face, ModelRotation.X0_Y0, texture);
}
if (state.getValue(CableMultipart.WEST))
{
addCubeToList(new Vecs3dCube(0.0, thickness, thickness, thickness, lastThickness, lastThickness), list,
face, ModelRotation.X0_Y0, texture);
}
}
return list;
}
@Override
public TextureAtlasSprite getParticleTexture() {
return texture;
}
@Override
public boolean isAmbientOcclusion()
{
return false;
}
@Override
public ItemCameraTransforms getItemCameraTransforms() {
return ItemCameraTransforms.DEFAULT;
}
@Override
public boolean isGui3d()
{
return true;
}
@Override
public ItemOverrideList getOverrides() {
return null;
}
@Override
public boolean isBuiltInRenderer()
{
return false;
}
@Override
public TextureAtlasSprite getParticleTexture()
{
return texture;
}
@Override
public ItemCameraTransforms getItemCameraTransforms()
{
return ItemCameraTransforms.DEFAULT;
}
@Override
public ItemOverrideList getOverrides()
{
return null;
}
}

View file

@ -1,5 +1,10 @@
package techreborn.client.texture;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.IResource;
@ -9,129 +14,150 @@ import net.minecraft.util.ResourceLocation;
import reborncore.client.texture.ConnectedTexture;
import techreborn.lib.ModInfo;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
//1.8 Nope
public class CasingConnectedTextureGenerator extends TextureAtlasSprite {
public class CasingConnectedTextureGenerator extends TextureAtlasSprite
{
public BufferedImage output_image = null;
String type;
ConnectedTexture connectedTexture;
public BufferedImage output_image = null;
String type;
ConnectedTexture connectedTexture;
public CasingConnectedTextureGenerator(String name, String type, ConnectedTexture connectedTexture) {
super(name);
this.type = type;
this.connectedTexture = connectedTexture;
}
public CasingConnectedTextureGenerator(String name, String type, ConnectedTexture connectedTexture)
{
super(name);
this.type = type;
this.connectedTexture = connectedTexture;
}
public static String getDerivedName(String s2) {
return ModInfo.MOD_ID + ":machine/casing/" + s2;
}
public static String getDerivedName(String s2)
{
return ModInfo.MOD_ID + ":machine/casing/" + s2;
}
public static ResourceLocation getTypeResource(String type) {
return new ResourceLocation("techreborn", "textures/blocks/machine/casing" + type + ".png");
}
public static ResourceLocation getTypeResource(String type)
{
return new ResourceLocation("techreborn", "textures/blocks/machine/casing" + type + ".png");
}
private static int[] createTexture(int w, int[] type_data, int[] edge_data, ConnectedTexture connectedTexture) {
int[] new_data = type_data;
for (int i = 0; i < type_data.length; i += 1) {
int x = (i % w);
int y = (i - x) / w;
if (getAlpha(edge_data[i]) != 0) {
if (y <= 1 && connectedTexture.isUp()) {
new_data[i] = edge_data[i];
}
if (y >= 14 && connectedTexture.isDown()) {
new_data[i] = edge_data[i];
}
if (x <= 1 && connectedTexture.isRight()) {
new_data[i] = edge_data[i];
}
if (x >= 14 && connectedTexture.isLeft()) {
new_data[i] = edge_data[i];
}
}
}
return new_data;
}
private static int[] createTexture(int w, int[] type_data, int[] edge_data, ConnectedTexture connectedTexture)
{
int[] new_data = type_data;
for (int i = 0; i < type_data.length; i += 1)
{
int x = (i % w);
int y = (i - x) / w;
if (getAlpha(edge_data[i]) != 0)
{
if (y <= 1 && connectedTexture.isUp())
{
new_data[i] = edge_data[i];
}
if (y >= 14 && connectedTexture.isDown())
{
new_data[i] = edge_data[i];
}
if (x <= 1 && connectedTexture.isRight())
{
new_data[i] = edge_data[i];
}
if (x >= 14 && connectedTexture.isLeft())
{
new_data[i] = edge_data[i];
}
}
}
return new_data;
}
public static int makeCol(int red, int green, int blue, int alpha) {
return (alpha << 24) | (red << 16) | (green << 8) | blue;
}
public static int makeCol(int red, int green, int blue, int alpha)
{
return (alpha << 24) | (red << 16) | (green << 8) | blue;
}
public static int getAlpha(int col) {
return (col & 0xff000000) >> 24;
}
public static int getAlpha(int col)
{
return (col & 0xff000000) >> 24;
}
public static int getRed(int col) {
return (col & 0x00ff0000) >> 16;
}
public static int getRed(int col)
{
return (col & 0x00ff0000) >> 16;
}
public static int getGreen(int col) {
return (col & 0x0000ff00) >> 8;
}
public static int getGreen(int col)
{
return (col & 0x0000ff00) >> 8;
}
public static int getBlue(int col) {
return col & 0x000000ff;
}
public static int getBlue(int col)
{
return col & 0x000000ff;
}
@Override
public boolean hasCustomLoader(IResourceManager manager, ResourceLocation location) {
return true;
}
@Override
public boolean hasCustomLoader(IResourceManager manager, ResourceLocation location)
{
return true;
}
@Override
public boolean load(IResourceManager manager, ResourceLocation location) {
int mp = Minecraft.getMinecraft().gameSettings.mipmapLevels;
BufferedImage[] type_image = new BufferedImage[1 + mp];
BufferedImage[] edge_image = new BufferedImage[1 + mp];
@Override
public boolean load(IResourceManager manager, ResourceLocation location)
{
int mp = Minecraft.getMinecraft().gameSettings.mipmapLevels;
BufferedImage[] type_image = new BufferedImage[1 + mp];
BufferedImage[] edge_image = new BufferedImage[1 + mp];
AnimationMetadataSection animation = null;
AnimationMetadataSection animation = null;
try {
IResource typeResource = manager.getResource(getTypeResource(type));
type_image[0] = ImageIO.read(typeResource.getInputStream());
animation = (AnimationMetadataSection) typeResource.getMetadata("animation");
try
{
IResource typeResource = manager.getResource(getTypeResource(type));
type_image[0] = ImageIO.read(typeResource.getInputStream());
animation = (AnimationMetadataSection) typeResource.getMetadata("animation");
IResource edgeResource = manager.getResource(getTypeResource(type + "_edge"));
edge_image[0] = ImageIO.read(edgeResource.getInputStream());
} catch (IOException e) {
e.printStackTrace();
}
int w = type_image[0].getWidth();
int h = type_image[0].getHeight();
IResource edgeResource = manager.getResource(getTypeResource(type + "_edge"));
edge_image[0] = ImageIO.read(edgeResource.getInputStream());
} catch (IOException e)
{
e.printStackTrace();
}
int w = type_image[0].getWidth();
int h = type_image[0].getHeight();
output_image = new BufferedImage(w, h, 2);
int[] type_data = new int[w * w];
int[] edge_data = new int[w * w];
output_image = new BufferedImage(w, h, 2);
int[] type_data = new int[w * w];
int[] edge_data = new int[w * w];
for (int y = 0; y < h; y += w) {
type_image[0].getRGB(0, y, w, w, type_data, 0, w);
edge_image[0].getRGB(0, y, w, w, edge_data, 0, w);
int[] new_data = createTexture(w, type_data, edge_data, connectedTexture);
output_image.setRGB(0, y, w, w, new_data, 0, w);
}
for (int y = 0; y < h; y += w)
{
type_image[0].getRGB(0, y, w, w, type_data, 0, w);
edge_image[0].getRGB(0, y, w, w, edge_data, 0, w);
int[] new_data = createTexture(w, type_data, edge_data, connectedTexture);
output_image.setRGB(0, y, w, w, new_data, 0, w);
}
type_image[0] = output_image;
// this.loadSprite(type_image, animation, (float) Minecraft.getMinecraft().gameSettings.anisotropicFiltering > 1.0F);
return false;
}
type_image[0] = output_image;
// this.loadSprite(type_image, animation, (float)
// Minecraft.getMinecraft().gameSettings.anisotropicFiltering > 1.0F);
return false;
}
// @SideOnly(Side.CLIENT)
// public static IIcon genIcon(ConnectedTexture connectedTexture, IIconRegister iconRegister, int texNum, int meta, String[] types) {
// if (iconRegister instanceof TextureMap) {
// TextureMap map = (TextureMap) iconRegister;
// String name = CasingConnectedTextureGenerator.getDerivedName(types[meta] + "." + texNum);
// TextureAtlasSprite texture = map.getTextureExtry(name);
// if (texture == null) {
// texture = new CasingConnectedTextureGenerator(name, types[meta], connectedTexture);
// map.setTextureEntry(name, texture);
// }
// return map.getTextureExtry(name);
// } else {
// return null;
// }
// }
// @SideOnly(Side.CLIENT)
// public static IIcon genIcon(ConnectedTexture connectedTexture,
// IIconRegister iconRegister, int texNum, int meta, String[] types) {
// if (iconRegister instanceof TextureMap) {
// TextureMap map = (TextureMap) iconRegister;
// String name = CasingConnectedTextureGenerator.getDerivedName(types[meta]
// + "." + texNum);
// TextureAtlasSprite texture = map.getTextureExtry(name);
// if (texture == null) {
// texture = new CasingConnectedTextureGenerator(name, types[meta],
// connectedTexture);
// map.setTextureEntry(name, texture);
// }
// return map.getTextureExtry(name);
// } else {
// return null;
// }
// }
}

View file

@ -1,5 +1,10 @@
package techreborn.client.texture;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.IResource;
@ -9,138 +14,160 @@ import net.minecraft.util.ResourceLocation;
import reborncore.client.texture.ConnectedTexture;
import techreborn.lib.ModInfo;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
//TODO 1.8 nope
public class LesuConnectedTextureGenerator extends TextureAtlasSprite {
public class LesuConnectedTextureGenerator extends TextureAtlasSprite
{
public BufferedImage output_image = null;
String type;
ConnectedTexture connectedTexture;
public BufferedImage output_image = null;
String type;
ConnectedTexture connectedTexture;
public LesuConnectedTextureGenerator(String name, String type, ConnectedTexture connectedTexture) {
super(name);
this.type = type;
this.connectedTexture = connectedTexture;
}
public LesuConnectedTextureGenerator(String name, String type, ConnectedTexture connectedTexture)
{
super(name);
this.type = type;
this.connectedTexture = connectedTexture;
}
public static String getDerivedName(String s2) {
return ModInfo.MOD_ID + ":machine/casing/" + s2;
}
public static String getDerivedName(String s2)
{
return ModInfo.MOD_ID + ":machine/casing/" + s2;
}
public static ResourceLocation getTypeResource(String type) {
return new ResourceLocation("techreborn", "textures/blocks/machine/" + type + ".png");
}
public static ResourceLocation getTypeResource(String type)
{
return new ResourceLocation("techreborn", "textures/blocks/machine/" + type + ".png");
}
public static ResourceLocation getLapisResource() {
return new ResourceLocation("minecraft", "textures/blocks/lapis_block.png");
}
public static ResourceLocation getLapisResource()
{
return new ResourceLocation("minecraft", "textures/blocks/lapis_block.png");
}
private static int[] createTexture(int w, int[] type_data, int[] edge_data, ConnectedTexture connectedTexture)
{
int[] new_data = type_data;
for (int i = 0; i < type_data.length; i += 1)
{
int x = (i % w);
int y = (i - x) / w;
if (getAlpha(edge_data[i]) != 0)
{
if (y <= 1 && connectedTexture.isUp())
{
new_data[i] = edge_data[i];
}
if (y >= 14 && connectedTexture.isDown())
{
new_data[i] = edge_data[i];
}
if (x <= 1 && connectedTexture.isRight())
{
new_data[i] = edge_data[i];
}
if (x >= 14 && connectedTexture.isLeft())
{
new_data[i] = edge_data[i];
}
}
}
return new_data;
}
private static int[] createTexture(int w, int[] type_data, int[] edge_data, ConnectedTexture connectedTexture) {
int[] new_data = type_data;
for (int i = 0; i < type_data.length; i += 1) {
int x = (i % w);
int y = (i - x) / w;
if (getAlpha(edge_data[i]) != 0) {
if (y <= 1 && connectedTexture.isUp()) {
new_data[i] = edge_data[i];
}
if (y >= 14 && connectedTexture.isDown()) {
new_data[i] = edge_data[i];
}
if (x <= 1 && connectedTexture.isRight()) {
new_data[i] = edge_data[i];
}
if (x >= 14 && connectedTexture.isLeft()) {
new_data[i] = edge_data[i];
}
}
}
return new_data;
}
public static int makeCol(int red, int green, int blue, int alpha)
{
return (alpha << 24) | (red << 16) | (green << 8) | blue;
}
public static int makeCol(int red, int green, int blue, int alpha) {
return (alpha << 24) | (red << 16) | (green << 8) | blue;
}
public static int getAlpha(int col)
{
return (col & 0xff000000) >> 24;
}
public static int getAlpha(int col) {
return (col & 0xff000000) >> 24;
}
public static int getRed(int col)
{
return (col & 0x00ff0000) >> 16;
}
public static int getRed(int col) {
return (col & 0x00ff0000) >> 16;
}
public static int getGreen(int col)
{
return (col & 0x0000ff00) >> 8;
}
public static int getGreen(int col) {
return (col & 0x0000ff00) >> 8;
}
public static int getBlue(int col)
{
return col & 0x000000ff;
}
public static int getBlue(int col) {
return col & 0x000000ff;
}
@Override
public boolean hasCustomLoader(IResourceManager manager, ResourceLocation location)
{
return true;
}
@Override
public boolean hasCustomLoader(IResourceManager manager, ResourceLocation location) {
return true;
}
@Override
public boolean load(IResourceManager manager, ResourceLocation location)
{
int mp = Minecraft.getMinecraft().gameSettings.mipmapLevels;
BufferedImage[] type_image = new BufferedImage[1 + mp];
BufferedImage[] edge_image = new BufferedImage[1 + mp];
@Override
public boolean load(IResourceManager manager, ResourceLocation location) {
int mp = Minecraft.getMinecraft().gameSettings.mipmapLevels;
BufferedImage[] type_image = new BufferedImage[1 + mp];
BufferedImage[] edge_image = new BufferedImage[1 + mp];
AnimationMetadataSection animation = null;
AnimationMetadataSection animation = null;
try
{
IResource typeResource = manager.getResource(getLapisResource());
type_image[0] = ImageIO.read(typeResource.getInputStream());
animation = (AnimationMetadataSection) typeResource.getMetadata("animation");
try {
IResource typeResource = manager.getResource(getLapisResource());
type_image[0] = ImageIO.read(typeResource.getInputStream());
animation = (AnimationMetadataSection) typeResource.getMetadata("animation");
IResource edgeResource = manager.getResource(getTypeResource("lesu_block"));
edge_image[0] = ImageIO.read(edgeResource.getInputStream());
} catch (IOException e)
{
e.printStackTrace();
}
int w = type_image[0].getWidth();
int h = type_image[0].getHeight();
IResource edgeResource = manager.getResource(getTypeResource("lesu_block"));
edge_image[0] = ImageIO.read(edgeResource.getInputStream());
} catch (IOException e) {
e.printStackTrace();
}
int w = type_image[0].getWidth();
int h = type_image[0].getHeight();
output_image = new BufferedImage(w, h, 2);
int[] type_data = new int[w * w];
int[] edge_data = new int[w * w];
output_image = new BufferedImage(w, h, 2);
int[] type_data = new int[w * w];
int[] edge_data = new int[w * w];
for (int y = 0; y < h; y += w)
{
try
{
type_image[0].getRGB(0, y, w, w, type_data, 0, w);
edge_image[0].getRGB(0, y, w, w, edge_data, 0, w);
} catch (Exception e)
{
e.fillInStackTrace();
}
int[] new_data = createTexture(w, type_data, edge_data, connectedTexture);
output_image.setRGB(0, y, w, w, new_data, 0, w);
}
for (int y = 0; y < h; y += w) {
try {
type_image[0].getRGB(0, y, w, w, type_data, 0, w);
edge_image[0].getRGB(0, y, w, w, edge_data, 0, w);
} catch (Exception e) {
e.fillInStackTrace();
}
int[] new_data = createTexture(w, type_data, edge_data, connectedTexture);
output_image.setRGB(0, y, w, w, new_data, 0, w);
}
type_image[0] = output_image;
// this.loadSprite(type_image, animation, (float)
// Minecraft.getMinecraft().gameSettings.anisotropicFiltering > 1.0F);
return false;
}
type_image[0] = output_image;
// this.loadSprite(type_image, animation, (float) Minecraft.getMinecraft().gameSettings.anisotropicFiltering > 1.0F);
return false;
}
// public static IIcon genIcon(ConnectedTexture connectedTexture, IIconRegister iconRegister, int texNum, int meta) {
// if (iconRegister instanceof TextureMap) {
// TextureMap map = (TextureMap) iconRegister;
// String name = LesuConnectedTextureGenerator.getDerivedName("lesu." + texNum);
// TextureAtlasSprite texture = map.getTextureExtry(name);
// if (texture == null) {
// texture = new LesuConnectedTextureGenerator(name, "lesu", connectedTexture);
// map.setTextureEntry(name, texture);
// }
// return map.getTextureExtry(name);
// } else {
// return null;
// }
// }
// public static IIcon genIcon(ConnectedTexture connectedTexture,
// IIconRegister iconRegister, int texNum, int meta) {
// if (iconRegister instanceof TextureMap) {
// TextureMap map = (TextureMap) iconRegister;
// String name = LesuConnectedTextureGenerator.getDerivedName("lesu." +
// texNum);
// TextureAtlasSprite texture = map.getTextureExtry(name);
// if (texture == null) {
// texture = new LesuConnectedTextureGenerator(name, "lesu",
// connectedTexture);
// map.setTextureEntry(name, texture);
// }
// return map.getTextureExtry(name);
// } else {
// return null;
// }
// }
}