Change all containers init to IContainerProvider + Add Enum for gui ids handling

This commit is contained in:
Ourten 2017-01-08 20:34:46 +01:00
parent b93fe6c5ad
commit eb220643fc
114 changed files with 2155 additions and 2025 deletions

View file

@ -0,0 +1,55 @@
package techreborn.client;
public enum EGui {
THERMAL_GENERATOR(true),
QUANTUM_TANK(true),
QUANTUM_CHEST(true),
CENTRIFUGE(true),
ROLLING_MACHINE(true),
BLAST_FURNACE(true),
ALLOY_SMELTER(true),
INDUSTRIAL_GRINDER(true),
IMPLOSION_COMPRESSOR(true),
MATTER_FABRICATOR(true),
MANUAL(false),
CHUNK_LOADER(true),
ASSEMBLING_MACHINE(true),
DIESEL_GENERATOR(true),
INDUSTRIAL_ELECTROLYZER(true),
AESU(false),
ALLOY_FURNACE(true),
SAWMILL(true),
CHEMICAL_REACTOR(true),
SEMIFLUID_GENERATOR(true),
GAS_TURBINE(true),
DIGITAL_CHEST(true),
DESTRUCTOPACK(false),
LESU(false),
IDSU(false),
CHARGEBENCH(true),
FUSION_CONTROLLER(true),
VACUUM_FREEZER(true),
GRINDER(true),
GENERATOR(true),
EXTRACTOR(true),
COMPRESSOR(true),
ELECTRIC_FURNACE(true),
IRON_FURNACE(true),
RECYCLER(true),
SCRAPBOXINATOR(true),
BATBOX(true),
MFSU(true),
MFE(true);
private final boolean containerBuilder;
private EGui(final boolean containerBuilder)
{
this.containerBuilder = containerBuilder;
}
public boolean useContainerBuilder() {
return this.containerBuilder;
}
}

View file

@ -1,22 +1,13 @@
package techreborn.client;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;
import reborncore.api.recipe.RecipeHandler;
import reborncore.api.tile.IContainerLayout;
import reborncore.common.container.RebornContainer;
import reborncore.common.util.ItemUtils;
import techreborn.api.RollingMachineRecipe;
import techreborn.api.recipe.machines.AlloySmelterRecipe;
import techreborn.client.container.*;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.client.gui.*;
import techreborn.init.ModItems;
import techreborn.manual.GuiManual;
import techreborn.tiles.*;
import techreborn.tiles.fusionReactor.TileEntityFusionController;
@ -31,281 +22,27 @@ import techreborn.tiles.teir1.*;
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 mfsuID = 40;
public static final int mfeID = 41;
@Override
public Object getServerGuiElement(final int ID, final EntityPlayer player, final World world, final int x,
final int y, final int z) {
final RebornContainer container = null;
if (ID == GuiHandler.gasTurbineID || ID == GuiHandler.semifluidGeneratorID
|| ID == GuiHandler.thermalGeneratorID || ID == GuiHandler.dieselGeneratorID) {
return new ContainerBuilder("fluidgenerator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 80, 17)
.outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue().addInventory().create();
} else if (ID == GuiHandler.quantumTankID) {
return new ContainerQuantumTank((TileQuantumTank) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == GuiHandler.digitalChestID || ID == GuiHandler.quantumChestID) {
return new ContainerBuilder("digitalchest").player(player.inventory).inventory().hotbar().addInventory()
.tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 80, 17).outputSlot(1, 80, 53)
.fakeSlot(2, 59, 42).addInventory().create();
} else if (ID == GuiHandler.centrifugeID) {
return new ContainerBuilder("centrifuge").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 80, 35)
.slot(1, 50, 5).outputSlot(2, 80, 5).outputSlot(3, 110, 35).outputSlot(4, 80, 65)
.outputSlot(5, 50, 35).energySlot(6, 8, 51).upgradeSlot(7, 152, 8).upgradeSlot(8, 152, 26)
.upgradeSlot(9, 152, 44).upgradeSlot(10, 152, 62).syncEnergyValue().syncCrafterValue()
.addInventory().create();
} else if (ID == GuiHandler.rollingMachineID) {
return new ContainerBuilder("rollingmachine").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(((TileRollingMachine) world.getTileEntity(new BlockPos(x, y, z))).craftMatrix)
.slot(0, 30, 17).slot(1, 48, 17).slot(2, 66, 17).slot(3, 30, 35).slot(4, 48, 35).slot(5, 66, 35)
.slot(6, 30, 53).slot(7, 48, 53).slot(8, 66, 53)
.onCraft(inv -> ((TileRollingMachine) world.getTileEntity(new BlockPos(x, y, z))).inventory
.setInventorySlotContents(1, RollingMachineRecipe.instance.findMatchingRecipe(inv, world)))
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).outputSlot(0, 124, 35)
.energySlot(2, 8, 51).syncEnergyValue()
.syncIntegerValue(((TileRollingMachine) world.getTileEntity(new BlockPos(x, y, z)))::getBurnTime,
((TileRollingMachine) world.getTileEntity(new BlockPos(x, y, z)))::setBurnTime)
.addInventory().create();
} else if (ID == GuiHandler.blastFurnaceID) {
return new ContainerBuilder("blastfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 40, 25)
.slot(1, 40, 43).outputSlot(2, 100, 35).outputSlot(3, 118, 35).syncEnergyValue().syncCrafterValue()
.syncIntegerValue(((TileBlastFurnace) world.getTileEntity(new BlockPos(x, y, z)))::getHeat,
((TileBlastFurnace) world.getTileEntity(new BlockPos(x, y, z)))::setHeat)
.addInventory().create();
} else if (ID == GuiHandler.alloySmelterID) {
return new ContainerBuilder("alloysmelter").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z)))
.filterSlot(0, 47, 17, stack -> RecipeHandler.recipeList.stream()
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
&& ItemUtils.isItemEqual(recipe.getInputs().get(0), stack, true, true, true)))
.filterSlot(1, 65, 17, stack -> RecipeHandler.recipeList.stream()
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
&& ItemUtils.isItemEqual(recipe.getInputs().get(1), stack, true, true, true)))
.outputSlot(2, 116, 35).energySlot(3, 56, 53).upgradeSlot(4, 152, 8).upgradeSlot(5, 152, 26)
.upgradeSlot(6, 152, 44).upgradeSlot(7, 152, 62).syncEnergyValue().syncCrafterValue().addInventory()
.create();
} else if (ID == GuiHandler.industrialGrinderID) {
return new ContainerBuilder("industrialgrinder").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 32, 26)
.slot(1, 32, 44).outputSlot(2, 77, 35).outputSlot(3, 95, 35).outputSlot(4, 113, 35)
.outputSlot(5, 131, 35).syncEnergyValue().syncCrafterValue().addInventory().create();
} else if (ID == GuiHandler.implosionCompresserID) {
return new ContainerBuilder("implosioncompressor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 37, 26)
.slot(1, 37, 44).outputSlot(2, 93, 35).outputSlot(3, 111, 35).syncEnergyValue().syncCrafterValue()
.addInventory().create();
} else if (ID == GuiHandler.matterfabID) {
return new ContainerBuilder("matterfabricator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 33, 17)
.slot(1, 33, 35).slot(2, 33, 53).slot(3, 51, 17).slot(4, 51, 35).slot(5, 51, 53)
.outputSlot(6, 116, 35).syncEnergyValue()
.syncIntegerValue(((TileMatterFabricator) world.getTileEntity(new BlockPos(x, y, z)))::getProgress,
((TileMatterFabricator) world.getTileEntity(new BlockPos(x, y, z)))::setProgress)
.addInventory().create();
} else if (ID == GuiHandler.assemblingmachineID) {
return new ContainerBuilder("assemblingmachine").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 47, 17)
.slot(1, 65, 17).outputSlot(2, 116, 35).energySlot(3, 56, 53).upgradeSlot(4, 152, 8)
.upgradeSlot(5, 152, 26).upgradeSlot(6, 152, 44).upgradeSlot(7, 152, 62).syncEnergyValue()
.syncCrafterValue().addInventory().create();
} else if (ID == GuiHandler.chunkloaderID) {
return new ContainerBuilder("chunkloader").player(player.inventory).inventory().hotbar().addInventory()
.create();
} else if (ID == GuiHandler.industrialElectrolyzerID) {
return new ContainerBuilder("industrialelectrolyzer").player(player.inventory).inventory(8, 84)
.hotbar(8, 142).addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z)))
.slot(0, 80, 51).slot(1, 50, 51).outputSlot(2, 50, 19).outputSlot(3, 70, 19).outputSlot(4, 90, 19)
.outputSlot(5, 110, 19).energySlot(6, 18, 51).syncEnergyValue().syncCrafterValue().addInventory()
.create();
} else if (ID == GuiHandler.aesuID) {
return new ContainerAESU((TileAesu) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == GuiHandler.alloyFurnaceID) {
return new ContainerBuilder("alloyfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z)))
.filterSlot(0, 47, 17, stack -> RecipeHandler.recipeList.stream()
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
&& ItemUtils.isItemEqual(recipe.getInputs().get(0), stack, true, true, true)))
.filterSlot(1, 65, 17, stack -> RecipeHandler.recipeList.stream()
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
&& ItemUtils.isItemEqual(recipe.getInputs().get(1), stack, true, true, true)))
.outputSlot(2, 116, 35).fuelSlot(3, 56, 53)
.syncIntegerValue(((TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)))::getBurnTime,
((TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)))::setBurnTime)
.syncIntegerValue(((TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)))::getCookTime,
((TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)))::setCookTime)
.syncIntegerValue(
((TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)))::getCurrentItemBurnTime,
((TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)))::setCurrentItemBurnTime)
.addInventory().create();
} else if (ID == GuiHandler.sawMillID) {
return new ContainerBuilder("industrialsawmill").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 32, 26)
.slot(1, 32, 44).outputSlot(2, 84, 35).outputSlot(3, 102, 35).outputSlot(4, 120, 35)
.syncEnergyValue().addInventory().create();
} else if (ID == GuiHandler.chemicalReactorID) {
return new ContainerBuilder("chemicalreactor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 70, 21)
.slot(1, 90, 21).outputSlot(2, 80, 51).energySlot(3, 8, 51).upgradeSlot(4, 152, 8)
.upgradeSlot(5, 152, 26).upgradeSlot(6, 152, 44).upgradeSlot(7, 152, 62).syncEnergyValue()
.syncCrafterValue().addInventory().create();
} else if (ID == GuiHandler.manuelID) {
return null;
} else if (ID == GuiHandler.destructoPackID) {
return new ContainerDestructoPack(player);
} else if (ID == GuiHandler.lesuID) {
return new ContainerLESU((TileLesu) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == GuiHandler.idsuID) {
return new ContainerIDSU((TileIDSU) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == GuiHandler.fusionID) {
return new ContainerBuilder("fusionreactor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 88, 17)
.slot(1, 88, 53).outputSlot(2, 148, 35).syncEnergyValue()
.syncIntegerValue(
((TileEntityFusionController) world.getTileEntity(new BlockPos(x, y, z)))::getCoilStatus,
((TileEntityFusionController) world.getTileEntity(new BlockPos(x, y, z)))::setCoilStatus)
.syncIntegerValue(
((TileEntityFusionController) world
.getTileEntity(new BlockPos(x, y, z)))::getCrafingTickTime,
((TileEntityFusionController) world
.getTileEntity(new BlockPos(x, y, z)))::setCrafingTickTime)
.syncIntegerValue(
((TileEntityFusionController) world.getTileEntity(new BlockPos(x, y, z)))::getFinalTickTime,
((TileEntityFusionController) world.getTileEntity(new BlockPos(x, y, z)))::setFinalTickTime)
.syncIntegerValue(
((TileEntityFusionController) world.getTileEntity(new BlockPos(x, y, z)))::getNeededPower,
((TileEntityFusionController) world.getTileEntity(new BlockPos(x, y, z)))::setNeededPower)
.addInventory().create();
} else if (ID == GuiHandler.chargeBench) {
return new ContainerBuilder("chargebench").player(player.inventory).inventory().hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).energySlot(0, 62, 21)
.energySlot(1, 80, 21).energySlot(2, 98, 21).energySlot(3, 62, 39).energySlot(4, 80, 39)
.energySlot(5, 98, 39).syncEnergyValue().addInventory().create();
} else if (ID == GuiHandler.vacuumFreezerID) {
return new ContainerBuilder("vacuumfreezer").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 56, 34)
.outputSlot(1, 116, 35).syncEnergyValue().syncCrafterValue().addInventory().create();
} else if (ID == GuiHandler.generatorID) {
return new ContainerBuilder("generator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).fuelSlot(0, 80, 53)
.energySlot(1, 80, 17).syncEnergyValue()
.syncIntegerValue(((TileGenerator) world.getTileEntity(new BlockPos(x, y, z)))::getBurnTime,
((TileGenerator) world.getTileEntity(new BlockPos(x, y, z)))::setBurnTime)
.syncIntegerValue(((TileGenerator) world.getTileEntity(new BlockPos(x, y, z)))::getTotalBurnTime,
((TileGenerator) world.getTileEntity(new BlockPos(x, y, z)))::setTotalBurnTime)
.addInventory().create();
} else if (ID == GuiHandler.compressorID) {
return new ContainerBuilder("compressor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 56, 34)
.outputSlot(1, 116, 34).upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44)
.upgradeSlot(5, 152, 62).syncEnergyValue().syncCrafterValue().addInventory().create();
} else if (ID == GuiHandler.extractorID) {
return new ContainerBuilder("extractor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 56, 34)
.outputSlot(1, 116, 34).upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44)
.upgradeSlot(5, 152, 62).syncEnergyValue().syncCrafterValue().addInventory().create();
} else if (ID == GuiHandler.grinderID) {
return new ContainerBuilder("grinder").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 56, 34)
.outputSlot(1, 116, 34).upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44)
.upgradeSlot(5, 152, 62).syncEnergyValue().syncCrafterValue().addInventory().create();
} else if (ID == GuiHandler.electricFurnaceID) {
return new ContainerBuilder("electricfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 56, 34)
.outputSlot(1, 116, 34).upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44)
.upgradeSlot(5, 152, 62).syncEnergyValue()
.syncIntegerValue(((TileElectricFurnace) world.getTileEntity(new BlockPos(x, y, z)))::getBurnTime,
((TileElectricFurnace) world.getTileEntity(new BlockPos(x, y, z)))::setBurnTime)
.addInventory().create();
} else if (ID == GuiHandler.ironFurnace) {
return new ContainerBuilder("ironfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 56, 17)
.outputSlot(1, 116, 34).fuelSlot(2, 56, 53)
.syncIntegerValue(((TileIronFurnace) world.getTileEntity(new BlockPos(x, y, z)))::getBurnTime,
((TileIronFurnace) world.getTileEntity(new BlockPos(x, y, z)))::setBurnTime)
.syncIntegerValue(((TileIronFurnace) world.getTileEntity(new BlockPos(x, y, z)))::getTotalBurnTime,
((TileIronFurnace) world.getTileEntity(new BlockPos(x, y, z)))::setTotalBurnTime)
.addInventory().create();
} else if (ID == GuiHandler.recyclerID) {
return new ContainerBuilder("recycler").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 56, 34)
.slot(1, 116, 34).upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44)
.upgradeSlot(5, 152, 62).syncEnergyValue()
.syncIntegerValue(((TileRecycler) world.getTileEntity(new BlockPos(x, y, z)))::getProgress,
((TileRecycler) world.getTileEntity(new BlockPos(x, y, z)))::setProgress)
.addInventory().create();
} else if (ID == GuiHandler.scrapboxinatorID) {
return new ContainerBuilder("scrapboxinator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z)))
.filterSlot(0, 56, 34, stack -> stack.getItem() == ModItems.SCRAP_BOX).outputSlot(1, 116, 34)
.upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44).upgradeSlot(5, 152, 62)
.syncEnergyValue()
.syncIntegerValue(((TileScrapboxinator) world.getTileEntity(new BlockPos(x, y, z)))::getProgress,
((TileScrapboxinator) world.getTileEntity(new BlockPos(x, y, z)))::setProgress)
.addInventory().create();
} else if (ID == GuiHandler.batboxID) {
return new ContainerBuilder("batbox").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).energySlot(0, 80, 17)
.energySlot(1, 80, 53).syncEnergyValue().addInventory().create();
} else if (ID == GuiHandler.mfeID) {
return new ContainerBuilder("mfe").player(player.inventory).inventory(8, 84).hotbar(8, 142).armor()
.complete(44, 6).addArmor().addInventory()
.tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).energySlot(0, 80, 17)
.energySlot(1, 80, 53).syncEnergyValue().addInventory().create();
} else if (ID == GuiHandler.mfsuID) {
return new ContainerBuilder("mfsu").player(player.inventory).inventory(8, 84).hotbar(8, 142).armor()
.complete(44, 6).addArmor().addInventory()
.tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).energySlot(0, 80, 17)
.energySlot(1, 80, 53).syncEnergyValue().addInventory().create();
}
if (container != null) {
if (container instanceof IContainerLayout) {
final IContainerLayout layout = (IContainerLayout) container;
layout.setTile(world.getTileEntity(new BlockPos(x, y, z)));
layout.setPlayer(player);
layout.addInventorySlots();
layout.addPlayerSlots();
}
return container;
final EGui gui = EGui.values()[ID];
final TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
if (gui.useContainerBuilder() && tile != null)
return ((IContainerProvider) tile).createContainer(player);
switch (gui) {
case AESU:
return new ContainerAESU((TileAesu) tile, player);
case DESTRUCTOPACK:
return new ContainerDestructoPack(player);
case LESU:
return new ContainerLESU((TileLesu) tile, player);
case IDSU:
return new ContainerIDSU((TileIDSU) tile, player);
default:
break;
}
return null;
}
@ -313,88 +50,91 @@ public class GuiHandler implements IGuiHandler {
@Override
public Object getClientGuiElement(final int ID, final EntityPlayer player, final World world, final int x,
final int y, final int z) {
if (ID == GuiHandler.thermalGeneratorID) {
return new GuiThermalGenerator(player, (TileThermalGenerator) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.semifluidGeneratorID) {
return new GuiSemifluidGenerator(player,
(TileSemifluidGenerator) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.gasTurbineID) {
return new GuiGasTurbine(player, (TileGasTurbine) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.quantumTankID) {
return new GuiQuantumTank(player, (TileQuantumTank) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.digitalChestID) {
return new GuiDigitalChest(player, (TileDigitalChest) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.quantumChestID) {
return new GuiQuantumChest(player, (TileQuantumChest) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.centrifugeID) {
return new GuiCentrifuge(player, (TileCentrifuge) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.rollingMachineID) {
return new GuiRollingMachine(player, (TileRollingMachine) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.blastFurnaceID) {
return new GuiBlastFurnace(player, (TileBlastFurnace) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.alloySmelterID) {
return new GuiAlloySmelter(player, (TileAlloySmelter) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.industrialGrinderID) {
return new GuiIndustrialGrinder(player, (TileIndustrialGrinder) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.implosionCompresserID) {
return new GuiImplosionCompressor(player,
(TileImplosionCompressor) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.matterfabID) {
return new GuiMatterFabricator(player, (TileMatterFabricator) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.chunkloaderID) {
return new GuiChunkLoader(player, (TileChunkLoader) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.assemblingmachineID) {
return new GuiAssemblingMachine(player, (TileAssemblingMachine) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.dieselGeneratorID) {
return new GuiDieselGenerator(player, (TileDieselGenerator) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.industrialElectrolyzerID) {
return new GuiIndustrialElectrolyzer(player,
(TileIndustrialElectrolyzer) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.aesuID) {
return new GuiAESU(player, (TileAesu) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.alloyFurnaceID) {
return new GuiAlloyFurnace(player, (TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.sawMillID) {
return new GuiIndustrialSawmill(player, (TileIndustrialSawmill) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.chemicalReactorID) {
return new GuiChemicalReactor(player, (TileChemicalReactor) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.manuelID) {
return new GuiManual();
} else if (ID == GuiHandler.destructoPackID) {
return new GuiDestructoPack(new ContainerDestructoPack(player));
} else if (ID == GuiHandler.lesuID) {
return new GuiLESU(player, (TileLesu) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.idsuID) {
return new GuiIDSU(player, (TileIDSU) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.chargeBench) {
return new GuiChargeBench(player, (TileChargeBench) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.fusionID) {
return new GuiFusionReactor(player,
(TileEntityFusionController) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.vacuumFreezerID) {
return new GuiVacuumFreezer(player, (TileVacuumFreezer) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.grinderID) {
return new GuiGrinder(player, (TileGrinder) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.generatorID) {
return new GuiGenerator(player, (TileGenerator) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.extractorID) {
return new GuiExtractor(player, (TileExtractor) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.compressorID) {
return new GuiCompressor(player, (TileCompressor) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.electricFurnaceID) {
return new GuiElectricFurnace(player, (TileElectricFurnace) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.ironFurnace) {
return new GuiIronFurnace(player, (TileIronFurnace) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.recyclerID) {
return new GuiRecycler(player, (TileRecycler) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.scrapboxinatorID) {
return new GuiScrapboxinator(player, (TileScrapboxinator) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.batboxID) {
return new GuiBatbox(player, (TileBatBox) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.mfsuID) {
return new GuiMFSU(player, (TileMFSU) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.mfeID) {
return new GuiMFE(player, (TileMFE) world.getTileEntity(new BlockPos(x, y, z)));
final EGui gui = EGui.values()[ID];
final TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
switch (gui) {
case AESU:
return new GuiAESU(player, (TileAesu) tile);
case ALLOY_FURNACE:
return new GuiAlloyFurnace(player, (TileAlloyFurnace) tile);
case ALLOY_SMELTER:
return new GuiAlloySmelter(player, (TileAlloySmelter) tile);
case ASSEMBLING_MACHINE:
return new GuiAssemblingMachine(player, (TileAssemblingMachine) tile);
case BATBOX:
return new GuiBatbox(player, (TileBatBox) tile);
case BLAST_FURNACE:
return new GuiBlastFurnace(player, (TileBlastFurnace) tile);
case CENTRIFUGE:
return new GuiCentrifuge(player, (TileCentrifuge) tile);
case CHARGEBENCH:
return new GuiChargeBench(player, (TileChargeBench) tile);
case CHEMICAL_REACTOR:
return new GuiChemicalReactor(player, (TileChemicalReactor) tile);
case CHUNK_LOADER:
return new GuiChunkLoader(player, (TileChunkLoader) tile);
case COMPRESSOR:
return new GuiCompressor(player, (TileCompressor) tile);
case DESTRUCTOPACK:
return new GuiDestructoPack(new ContainerDestructoPack(player));
case DIESEL_GENERATOR:
return new GuiDieselGenerator(player, (TileDieselGenerator) tile);
case DIGITAL_CHEST:
return new GuiDigitalChest(player, (TileDigitalChest) tile);
case ELECTRIC_FURNACE:
return new GuiElectricFurnace(player, (TileElectricFurnace) tile);
case EXTRACTOR:
return new GuiExtractor(player, (TileExtractor) tile);
case FUSION_CONTROLLER:
return new GuiFusionReactor(player, (TileEntityFusionController) tile);
case GAS_TURBINE:
return new GuiGasTurbine(player, (TileGasTurbine) tile);
case GENERATOR:
return new GuiGenerator(player, (TileGenerator) tile);
case GRINDER:
return new GuiGrinder(player, (TileGrinder) tile);
case IDSU:
return new GuiIDSU(player, (TileIDSU) tile);
case IMPLOSION_COMPRESSOR:
return new GuiImplosionCompressor(player, (TileImplosionCompressor) tile);
case INDUSTRIAL_ELECTROLYZER:
return new GuiIndustrialElectrolyzer(player, (TileIndustrialElectrolyzer) tile);
case INDUSTRIAL_GRINDER:
return new GuiIndustrialGrinder(player, (TileIndustrialGrinder) tile);
case IRON_FURNACE:
return new GuiIronFurnace(player, (TileIronFurnace) tile);
case LESU:
return new GuiLESU(player, (TileLesu) tile);
case MANUAL:
return new GuiManual();
case MATTER_FABRICATOR:
return new GuiMatterFabricator(player, (TileMatterFabricator) tile);
case MFE:
return new GuiMFE(player, (TileMFE) tile);
case MFSU:
return new GuiMFSU(player, (TileMFSU) tile);
case QUANTUM_CHEST:
return new GuiQuantumChest(player, (TileQuantumChest) tile);
case QUANTUM_TANK:
return new GuiQuantumTank(player, (TileQuantumTank) tile);
case RECYCLER:
return new GuiRecycler(player, (TileRecycler) tile);
case ROLLING_MACHINE:
return new GuiRollingMachine(player, (TileRollingMachine) tile);
case SAWMILL:
return new GuiIndustrialSawmill(player, (TileIndustrialSawmill) tile);
case SCRAPBOXINATOR:
return new GuiScrapboxinator(player, (TileScrapboxinator) tile);
case SEMIFLUID_GENERATOR:
return new GuiSemifluidGenerator(player, (TileSemifluidGenerator) tile);
case THERMAL_GENERATOR:
return new GuiThermalGenerator(player, (TileThermalGenerator) tile);
case VACUUM_FREEZER:
return new GuiVacuumFreezer(player, (TileVacuumFreezer) tile);
default:
break;
}
return null;
}

View file

@ -1,41 +0,0 @@
package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import reborncore.client.gui.slots.BaseSlot;
import reborncore.client.gui.slots.SlotFake;
import reborncore.client.gui.slots.SlotFluid;
import reborncore.client.gui.slots.SlotOutput;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.TileQuantumTank;
public class ContainerQuantumTank extends RebornContainer {
public TileQuantumTank tileQuantumTank;
public EntityPlayer 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));
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new BaseSlot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new BaseSlot(player.inventory, i, 8 + i * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
}

View file

@ -0,0 +1,9 @@
package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import techreborn.client.container.builder.BuiltContainer;
public interface IContainerProvider {
BuiltContainer createContainer(EntityPlayer player);
}

View file

@ -2,24 +2,26 @@ package techreborn.client.container.builder.slot;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.ResourceLocation;
import techreborn.lib.ModInfo;
public class SpriteSlot extends FilteredSlot {
int stacksize;
public SpriteSlot(final IInventory inventory, final int index, final int xPosition, final int yPosition, String sprite, int stacksize) {
public SpriteSlot(final IInventory inventory, final int index, final int xPosition, final int yPosition, final String sprite, final int stacksize) {
super(inventory, index, xPosition, yPosition);
this.setBackgroundLocation(new ResourceLocation(ModInfo.MOD_ID.toLowerCase() + ":textures/gui/slot_sprites/" + sprite + ".png"));
this.setBackgroundLocation(
new ResourceLocation(ModInfo.MOD_ID + ":textures/gui/slot_sprites/" + sprite + ".png"));
this.stacksize = stacksize;
}
public SpriteSlot(final IInventory inventory, final int index, final int xPosition, final int yPosition, String sprite) {
public SpriteSlot(final IInventory inventory, final int index, final int xPosition, final int yPosition, final String sprite) {
this(inventory, index, xPosition, yPosition, sprite, 64);
}
@Override
public int getSlotStackLimit() {
return stacksize;
return this.stacksize;
}
}

View file

@ -6,11 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import reborncore.api.recipe.RecipeHandler;
import reborncore.common.util.ItemUtils;
import techreborn.api.recipe.machines.AlloySmelterRecipe;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileAlloyFurnace;
public class GuiAlloyFurnace extends GuiContainer {
@ -20,25 +15,11 @@ public class GuiAlloyFurnace extends GuiContainer {
TileAlloyFurnace alloyfurnace;
public GuiAlloyFurnace(final EntityPlayer player, final TileAlloyFurnace tileAlloyFurnace) {
super(new ContainerBuilder("alloyfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tileAlloyFurnace)
.filterSlot(0, 47, 17,
stack -> RecipeHandler.recipeList.stream()
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
&& ItemUtils.isItemEqual(recipe.getInputs().get(0), stack, true, true, true)))
.filterSlot(1, 65, 17,
stack -> RecipeHandler.recipeList.stream()
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
&& ItemUtils.isItemEqual(recipe.getInputs().get(1), stack, true, true, true)))
.outputSlot(2, 116, 35).fuelSlot(3, 56, 53)
.syncIntegerValue(tileAlloyFurnace::getBurnTime, tileAlloyFurnace::setBurnTime)
.syncIntegerValue(tileAlloyFurnace::getCookTime, tileAlloyFurnace::setCookTime)
.syncIntegerValue(tileAlloyFurnace::getCurrentItemBurnTime, tileAlloyFurnace::setCurrentItemBurnTime)
.addInventory().create());
public GuiAlloyFurnace(final EntityPlayer player, final TileAlloyFurnace alloyFurnace) {
super(alloyFurnace.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.alloyfurnace = tileAlloyFurnace;
this.alloyfurnace = alloyFurnace;
}
@Override

View file

@ -6,11 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import reborncore.api.recipe.RecipeHandler;
import reborncore.common.util.ItemUtils;
import techreborn.api.recipe.machines.AlloySmelterRecipe;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileAlloySmelter;
public class GuiAlloySmelter extends GuiContainer {
@ -20,23 +15,11 @@ public class GuiAlloySmelter extends GuiContainer {
TileAlloySmelter alloysmelter;
public GuiAlloySmelter(final EntityPlayer player, final TileAlloySmelter tilealloysmelter) {
super(new ContainerBuilder("alloysmelter").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tilealloysmelter)
.filterSlot(0, 47, 17,
stack -> RecipeHandler.recipeList.stream()
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
&& ItemUtils.isItemEqual(recipe.getInputs().get(0), stack, true, true, true)))
.filterSlot(1, 65, 17,
stack -> RecipeHandler.recipeList.stream()
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
&& ItemUtils.isItemEqual(recipe.getInputs().get(1), stack, true, true, true)))
.outputSlot(2, 116, 35).energySlot(3, 56, 53).upgradeSlot(4, 152, 8).upgradeSlot(5, 152, 26)
.upgradeSlot(6, 152, 44).upgradeSlot(7, 152, 62).syncEnergyValue().syncCrafterValue().addInventory()
.create());
public GuiAlloySmelter(final EntityPlayer player, final TileAlloySmelter alloySmelter) {
super(alloySmelter.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.alloysmelter = tilealloysmelter;
this.alloysmelter = alloySmelter;
}
@Override

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileAssemblingMachine;
public class GuiAssemblingMachine extends GuiContainer {
@ -17,10 +16,7 @@ public class GuiAssemblingMachine extends GuiContainer {
TileAssemblingMachine assemblingmachine;
public GuiAssemblingMachine(final EntityPlayer player, final TileAssemblingMachine assemblingMachine) {
super(new ContainerBuilder("assemblingmachine").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(assemblingMachine).slot(0, 47, 17).slot(1, 65, 17).outputSlot(2, 116, 35)
.energySlot(3, 56, 53).upgradeSlot(4, 152, 8).upgradeSlot(5, 152, 26).upgradeSlot(6, 152, 44)
.upgradeSlot(7, 152, 62).syncEnergyValue().syncCrafterValue().addInventory().create());
super(assemblingMachine.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.assemblingmachine = assemblingMachine;

View file

@ -2,8 +2,9 @@ package techreborn.client.gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import reborncore.common.powerSystem.PowerSystem;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.storage.TileBatBox;
public class GuiBatbox extends GuiBase {
@ -11,27 +12,27 @@ public class GuiBatbox extends GuiBase {
TileBatBox tile;
public GuiBatbox(final EntityPlayer player, final TileBatBox tile) {
super(player, tile, new ContainerBuilder("batbox").player(player.inventory).inventory().hotbar().addInventory().tile(tile).energySlot(0, 62, 45).energySlot(1, 98, 45).syncEnergyValue().addInventory().create());
super(player, tile, tile.createContainer(player));
this.tile = tile;
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
Layer layer = Layer.BACKGROUND;
final Layer layer = Layer.BACKGROUND;
drawSlot(62, 45, layer);
drawSlot(98, 45, layer);
this.drawSlot(62, 45, layer);
this.drawSlot(98, 45, layer);
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
Layer layer = Layer.FOREGROUND;
final Layer layer = Layer.FOREGROUND;
builder.drawMultiEnergyBar(this, 81, 28, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
this.builder.drawMultiEnergyBar(this, 81, 28, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
GlStateManager.scale(0.6, 0.6, 5);
drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) (tile.getEnergy())) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) (tile.getMaxPower())) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);
this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);
GlStateManager.scale(1, 1, 1);
}
}

View file

@ -17,7 +17,6 @@ import reborncore.client.multiblock.MultiblockSet;
import reborncore.common.misc.Location;
import reborncore.common.multiblock.CoordTriplet;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks;
import techreborn.proxies.ClientProxy;
import techreborn.tiles.multiblock.TileBlastFurnace;
@ -33,14 +32,11 @@ public class GuiBlastFurnace extends GuiContainer {
boolean hasMultiBlock;
public GuiBlastFurnace(final EntityPlayer player, final TileBlastFurnace tileblastfurnace) {
super(new ContainerBuilder("blastfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tileblastfurnace).slot(0, 40, 25).slot(1, 40, 43).outputSlot(2, 100, 35)
.outputSlot(3, 118, 35).syncEnergyValue().syncCrafterValue()
.syncIntegerValue(tileblastfurnace::getHeat, tileblastfurnace::setHeat).addInventory().create());
public GuiBlastFurnace(final EntityPlayer player, final TileBlastFurnace blastFurnace) {
super(blastFurnace.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.blastfurnace = tileblastfurnace;
this.blastfurnace = blastFurnace;
}
@Override

View file

@ -1,19 +1,16 @@
package techreborn.client.gui;
import net.minecraft.entity.player.EntityPlayer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileCentrifuge;
public class GuiCentrifuge extends GuiBase {
TileCentrifuge tile;
TileCentrifuge centrifuge;
public GuiCentrifuge(final EntityPlayer player, final TileCentrifuge tile) {
super(player, tile, new ContainerBuilder("centrifuge").player(player.inventory).inventory().hotbar().addInventory()
.tile(tile).slot(0, 40, 34).slot(1, 40, 54).outputSlot(2, 82, 44).outputSlot(3, 101, 25)
.outputSlot(4, 120, 44).outputSlot(5, 101, 63).energySlot(6, 8, 72).syncEnergyValue()
.syncCrafterValue().addInventory().create());
this.tile = tile;
public GuiCentrifuge(final EntityPlayer player, final TileCentrifuge centrifuge) {
super(player, centrifuge, centrifuge.createContainer(player));
this.centrifuge = centrifuge;
}
@Override
@ -24,29 +21,29 @@ public class GuiCentrifuge extends GuiBase {
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
Layer layer = Layer.BACKGROUND;
final Layer layer = Layer.BACKGROUND;
drawSlot(8, 72, layer);
this.drawSlot(8, 72, layer);
drawSlot(40, 34, layer);
drawSlot(40, 54, layer);
this.drawSlot(40, 34, layer);
this.drawSlot(40, 54, layer);
drawSlot(82, 44, layer);
drawSlot(101, 25, layer);
drawSlot(120, 44, layer);
drawSlot(101, 63, layer);
this.drawSlot(82, 44, layer);
this.drawSlot(101, 25, layer);
this.drawSlot(120, 44, layer);
this.drawSlot(101, 63, layer);
builder.drawJEIButton(this, 150, 4, mouseX, mouseY, layer);
this.builder.drawJEIButton(this, 150, 4, mouseX, mouseY, layer);
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
Layer layer = Layer.FOREGROUND;
final Layer layer = Layer.FOREGROUND;
builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 61, 47, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(this, 9, 18, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
this.builder.drawProgressBar(this, this.centrifuge.getProgressScaled(100), 100, 61, 47, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer);
this.builder.drawMultiEnergyBar(this, 9, 18, (int) this.centrifuge.getEnergy(), (int) this.centrifuge.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileChargeBench;
public class GuiChargeBench extends GuiContainer {
@ -15,13 +14,11 @@ public class GuiChargeBench extends GuiContainer {
TileChargeBench chargebench;
public GuiChargeBench(final EntityPlayer player, final TileChargeBench tile) {
super(new ContainerBuilder("charbench").player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory()
.tile(tile).energySlot(0, 62, 21).energySlot(1, 80, 21).energySlot(2, 98, 21).energySlot(3, 62, 39)
.energySlot(4, 80, 39).energySlot(5, 98, 39).syncEnergyValue().addInventory().create());
public GuiChargeBench(final EntityPlayer player, final TileChargeBench chargeBench) {
super(chargeBench.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.chargebench = tile;
this.chargebench = chargeBench;
}
@Override

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileChemicalReactor;
public class GuiChemicalReactor extends GuiContainer {
@ -16,14 +15,11 @@ public class GuiChemicalReactor extends GuiContainer {
TileChemicalReactor chemicalReactor;
public GuiChemicalReactor(final EntityPlayer player, final TileChemicalReactor tilechemicalReactor) {
super(new ContainerBuilder("chemicalreactor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tilechemicalReactor).slot(0, 70, 21).slot(1, 90, 21).outputSlot(2, 80, 51)
.energySlot(3, 8, 51).upgradeSlot(4, 152, 8).upgradeSlot(5, 152, 26).upgradeSlot(6, 152, 44)
.upgradeSlot(7, 152, 62).syncEnergyValue().syncCrafterValue().addInventory().create());
public GuiChemicalReactor(final EntityPlayer player, final TileChemicalReactor chemicalReactor) {
super(chemicalReactor.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.chemicalReactor = tilechemicalReactor;
this.chemicalReactor = chemicalReactor;
}
@Override

View file

@ -7,7 +7,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileChunkLoader;
public class GuiChunkLoader extends GuiContainer {
@ -20,12 +19,11 @@ public class GuiChunkLoader extends GuiContainer {
private GuiButton minusOneButton;
private GuiButton minusTenButton;
public GuiChunkLoader(final EntityPlayer player, final TileChunkLoader tilechunkloader) {
super(new ContainerBuilder("chunkloader").player(player.inventory).inventory().hotbar().addInventory()
.create());
public GuiChunkLoader(final EntityPlayer player, final TileChunkLoader chunkLoader) {
super(chunkLoader.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.chunkloader = tilechunkloader;
this.chunkloader = chunkLoader;
}
@Override

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.teir1.TileCompressor;
public class GuiCompressor extends GuiContainer {
@ -16,10 +15,7 @@ public class GuiCompressor extends GuiContainer {
TileCompressor compressor;
public GuiCompressor(final EntityPlayer player, final TileCompressor compressor) {
super(new ContainerBuilder("compressor").player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory()
.tile(compressor).slot(0, 56, 34).outputSlot(1, 116, 34).upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26)
.upgradeSlot(4, 152, 44).upgradeSlot(5, 152, 62).syncEnergyValue().syncCrafterValue().addInventory()
.create());
super(compressor.createContainer(player));
this.xSize = 176;
this.ySize = 167;

View file

@ -8,7 +8,6 @@ import net.minecraft.util.text.translation.I18n;
import reborncore.common.powerSystem.PowerSystem;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.generator.TileDieselGenerator;
public class GuiDieselGenerator extends GuiContainer {
@ -16,15 +15,13 @@ public class GuiDieselGenerator extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/diesel_generator.png");
TileDieselGenerator tile;
TileDieselGenerator dieselGenerator;
public GuiDieselGenerator(final EntityPlayer player, final TileDieselGenerator tile) {
super(new ContainerBuilder("fluidgenerator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tile).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue()
.addInventory().create());
public GuiDieselGenerator(final EntityPlayer player, final TileDieselGenerator dieselGenerator) {
super(dieselGenerator.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.tile = tile;
this.dieselGenerator = dieselGenerator;
}
@Override
@ -44,10 +41,10 @@ public class GuiDieselGenerator extends GuiContainer {
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(this.tile.tank.getFluidAmount() + "", 10, 30, 16448255);
this.fontRendererObj.drawString(this.dieselGenerator.tank.getFluidAmount() + "", 10, 30, 16448255);
this.fontRendererObj.drawString("Power Amount", 10, 40, 16448255);
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(this.tile.getEnergy()) + "", 10, 50,
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(this.dieselGenerator.getEnergy()) + "", 10, 50,
16448255);
}
}

View file

@ -2,22 +2,22 @@ package techreborn.client.gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileDigitalChest;
public class GuiDigitalChest extends GuiBase {
TileDigitalChest tile;
TileDigitalChest digitalChest;
public GuiDigitalChest(final EntityPlayer player, final TileDigitalChest tile) {
super(player, tile, new ContainerBuilder("digitalchest").player(player.inventory).inventory().hotbar().addInventory().tile(tile).slot(0, 80, 24).outputSlot(1, 80, 64).addInventory().create());
this.tile = tile;
public GuiDigitalChest(final EntityPlayer player, final TileDigitalChest digitalChest) {
super(player, digitalChest, digitalChest.createContainer(player));
this.digitalChest = digitalChest;
}
@Override
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
Layer layer = Layer.BACKGROUND;
final Layer layer = Layer.BACKGROUND;
this.drawSlot(80, 24, layer);
this.drawSlot(80, 64, layer);
@ -26,13 +26,16 @@ public class GuiDigitalChest extends GuiBase {
@Override
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
Layer layer = Layer.FOREGROUND;
final Layer layer = Layer.FOREGROUND;
if (this.tile.storedItem != ItemStack.EMPTY && this.tile.getStackInSlot(1) != null) {
this.builder.drawBigBlueBar(this, 31, 43, this.tile.storedItem.getCount() + this.tile.getStackInSlot(1).getCount(), this.tile.maxCapacity, mouseX - this.guiLeft, mouseY - this.guiTop, "Stored", layer);
if (this.digitalChest.storedItem != ItemStack.EMPTY && this.digitalChest.getStackInSlot(1) != null) {
this.builder.drawBigBlueBar(this, 31, 43,
this.digitalChest.storedItem.getCount() + this.digitalChest.getStackInSlot(1).getCount(),
this.digitalChest.maxCapacity, mouseX - this.guiLeft, mouseY - this.guiTop, "Stored", layer);
}
if (this.tile.storedItem == ItemStack.EMPTY && this.tile.getStackInSlot(1) != null) {
this.builder.drawBigBlueBar(this, 31, 43, this.tile.getStackInSlot(1).getCount(), this.tile.maxCapacity, mouseX - this.guiLeft, mouseY - this.guiTop, "Stored", layer);
if (this.digitalChest.storedItem == ItemStack.EMPTY && this.digitalChest.getStackInSlot(1) != null) {
this.builder.drawBigBlueBar(this, 31, 43, this.digitalChest.getStackInSlot(1).getCount(),
this.digitalChest.maxCapacity, mouseX - this.guiLeft, mouseY - this.guiTop, "Stored", layer);
}
}
}

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.teir1.TileElectricFurnace;
public class GuiElectricFurnace extends GuiContainer {
@ -16,10 +15,7 @@ public class GuiElectricFurnace extends GuiContainer {
TileElectricFurnace furnace;
public GuiElectricFurnace(final EntityPlayer player, final TileElectricFurnace furnace) {
super(new ContainerBuilder("electricfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(furnace).slot(0, 56, 34).outputSlot(1, 116, 34).upgradeSlot(2, 152, 8)
.upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44).upgradeSlot(5, 152, 62).syncEnergyValue()
.syncIntegerValue(furnace::getBurnTime, furnace::setBurnTime).addInventory().create());
super(furnace.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.furnace = furnace;

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.teir1.TileExtractor;
public class GuiExtractor extends GuiContainer {
@ -16,10 +15,7 @@ public class GuiExtractor extends GuiContainer {
TileExtractor extractor;
public GuiExtractor(final EntityPlayer player, final TileExtractor extractor) {
super(new ContainerBuilder("extractor").player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory()
.tile(extractor).slot(0, 56, 34).outputSlot(1, 116, 34).upgradeSlot(2, 152, 8)
.upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44).upgradeSlot(5, 152, 62).syncEnergyValue()
.syncCrafterValue().addInventory().create());
super(extractor.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.extractor = extractor;

View file

@ -15,7 +15,6 @@ import reborncore.common.misc.Location;
import reborncore.common.powerSystem.PowerSystem;
import techreborn.client.ClientMultiBlocks;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.proxies.ClientProxy;
import techreborn.tiles.fusionReactor.TileEntityFusionController;
@ -29,12 +28,7 @@ public class GuiFusionReactor extends GuiContainer {
TileEntityFusionController fusionController;
public GuiFusionReactor(final EntityPlayer player, final TileEntityFusionController fusion) {
super(new ContainerBuilder("fusionreactor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(fusion).slot(0, 88, 17).slot(1, 88, 53).outputSlot(2, 148, 35).syncEnergyValue()
.syncIntegerValue(fusion::getCoilStatus, fusion::setCoilStatus)
.syncIntegerValue(fusion::getCrafingTickTime, fusion::setCrafingTickTime)
.syncIntegerValue(fusion::getFinalTickTime, fusion::setFinalTickTime)
.syncIntegerValue(fusion::getNeededPower, fusion::setNeededPower).addInventory().create());
super(fusion.createContainer(player));
this.fusionController = fusion;
}

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.generator.TileGasTurbine;
public class GuiGasTurbine extends GuiContainer {
@ -15,16 +14,13 @@ public class GuiGasTurbine extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/thermal_generator.png");
TileGasTurbine tile;
TileGasTurbine gasTurbine;
public GuiGasTurbine(final EntityPlayer player, final TileGasTurbine tile) {
super(new ContainerBuilder("fluidgenerator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory()
.tile(tile).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue().addInventory()
.create());
public GuiGasTurbine(final EntityPlayer player, final TileGasTurbine gasTurbine) {
super(gasTurbine.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.tile = tile;
this.gasTurbine = gasTurbine;
}
@Override
@ -44,6 +40,6 @@ public class GuiGasTurbine extends GuiContainer {
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(this.tile.tank.getFluidAmount() + "", 10, 30, 16448255);
this.fontRendererObj.drawString(this.gasTurbine.tank.getFluidAmount() + "", 10, 30, 16448255);
}
}

View file

@ -7,7 +7,6 @@ import net.minecraft.util.text.translation.I18n;
import reborncore.common.powerSystem.PowerSystem;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.generator.TileGenerator;
public class GuiGenerator extends GuiContainer {
@ -17,10 +16,7 @@ public class GuiGenerator extends GuiContainer {
TileGenerator generator;
public GuiGenerator(final EntityPlayer player, final TileGenerator generator) {
super(new ContainerBuilder("generator").player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory()
.tile(generator).fuelSlot(0, 80, 53).energySlot(1, 80, 17).syncEnergyValue()
.syncIntegerValue(generator::getBurnTime, generator::setBurnTime)
.syncIntegerValue(generator::getTotalBurnTime, generator::setTotalBurnTime).addInventory().create());
super(generator.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.generator = generator;

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.teir1.TileGrinder;
public class GuiGrinder extends GuiContainer {
@ -16,10 +15,7 @@ public class GuiGrinder extends GuiContainer {
TileGrinder grinder;
public GuiGrinder(final EntityPlayer player, final TileGrinder grinder) {
super(new ContainerBuilder("grinder").player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory()
.tile(grinder).slot(0, 56, 34).outputSlot(1, 116, 34).upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26)
.upgradeSlot(4, 152, 44).upgradeSlot(5, 152, 62).syncEnergyValue().syncCrafterValue().addInventory()
.create());
super(grinder.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.grinder = grinder;

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.multiblock.TileImplosionCompressor;
public class GuiImplosionCompressor extends GuiContainer {
@ -14,15 +13,13 @@ public class GuiImplosionCompressor extends GuiContainer {
public static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/implosion_compressor.png");
TileImplosionCompressor compresser;
TileImplosionCompressor compressor;
public GuiImplosionCompressor(final EntityPlayer player, final TileImplosionCompressor tilecompressor) {
super(new ContainerBuilder("implosioncompressor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tilecompressor).slot(0, 37, 26).slot(1, 37, 44).outputSlot(2, 93, 35)
.outputSlot(3, 111, 35).syncEnergyValue().syncCrafterValue().addInventory().create());
public GuiImplosionCompressor(final EntityPlayer player, final TileImplosionCompressor compressor) {
super(compressor.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.compresser = tilecompressor;
this.compressor = compressor;
}
@Override
@ -40,18 +37,18 @@ public class GuiImplosionCompressor extends GuiContainer {
final int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
if (!this.compresser.getMutliBlock()) {
if (!this.compressor.getMutliBlock()) {
// GuiDraw.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38, l + 52 + 12, -1);
}
this.mc.getTextureManager().bindTexture(GuiImplosionCompressor.texture);
int j = this.compresser.getProgressScaled(24);
int j = this.compressor.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 61, l + 37, 176, 14, j + 1, 16);
}
j = this.compresser.getEnergyScaled(12);
j = this.compressor.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 14, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileIndustrialElectrolyzer;
public class GuiIndustrialElectrolyzer extends GuiContainer {
@ -18,10 +17,7 @@ public class GuiIndustrialElectrolyzer extends GuiContainer {
public GuiIndustrialElectrolyzer(final EntityPlayer player, final TileIndustrialElectrolyzer tileeletrolyzer) {
super(new ContainerBuilder("industrialelectrolyzer").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tileeletrolyzer).slot(0, 80, 51).slot(1, 50, 51).outputSlot(2, 50, 19)
.outputSlot(3, 70, 19).outputSlot(4, 90, 19).outputSlot(5, 110, 19).energySlot(6, 18, 51)
.syncEnergyValue().syncCrafterValue().addInventory().create());
super(tileeletrolyzer.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.eletrolyzer = tileeletrolyzer;

View file

@ -9,7 +9,6 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.fluids.FluidStack;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.multiblock.TileIndustrialGrinder;
public class GuiIndustrialGrinder extends GuiContainer {
@ -19,14 +18,11 @@ public class GuiIndustrialGrinder extends GuiContainer {
TileIndustrialGrinder grinder;
public GuiIndustrialGrinder(final EntityPlayer player, final TileIndustrialGrinder tilegrinder) {
super(new ContainerBuilder("industrialgrinder").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tilegrinder).slot(0, 32, 26).slot(1, 32, 44).outputSlot(2, 77, 35)
.outputSlot(3, 95, 35).outputSlot(4, 113, 35).outputSlot(5, 131, 35).syncEnergyValue()
.syncCrafterValue().addInventory().create());
public GuiIndustrialGrinder(final EntityPlayer player, final TileIndustrialGrinder grinder) {
super(grinder.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.grinder = tilegrinder;
this.grinder = grinder;
}
@Override

View file

@ -9,7 +9,6 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.fluids.FluidStack;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.multiblock.TileIndustrialSawmill;
public class GuiIndustrialSawmill extends GuiContainer {
@ -19,14 +18,11 @@ public class GuiIndustrialSawmill extends GuiContainer {
TileIndustrialSawmill sawmill;
public GuiIndustrialSawmill(final EntityPlayer player, final TileIndustrialSawmill tilesawmill) {
super(new ContainerBuilder("chemicalreactor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tilesawmill).slot(0, 70, 21).slot(1, 90, 21).outputSlot(2, 80, 51)
.energySlot(3, 8, 51).upgradeSlot(4, 152, 8).upgradeSlot(5, 152, 26).upgradeSlot(6, 152, 44)
.upgradeSlot(7, 152, 62).syncEnergyValue().syncCrafterValue().addInventory().create());
public GuiIndustrialSawmill(final EntityPlayer player, final TileIndustrialSawmill sawmill) {
super(sawmill.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.sawmill = tilesawmill;
this.sawmill = sawmill;
}
@Override

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileIronFurnace;
public class GuiIronFurnace extends GuiContainer {
@ -17,11 +16,7 @@ public class GuiIronFurnace extends GuiContainer {
TileIronFurnace furnace;
public GuiIronFurnace(final EntityPlayer player, final TileIronFurnace furnace) {
super(new ContainerBuilder("ironfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(furnace).slot(0, 56, 17).outputSlot(1, 116, 34).fuelSlot(2, 56, 53)
.syncIntegerValue(furnace::getBurnTime, furnace::setBurnTime)
.syncIntegerValue(furnace::getTotalBurnTime, furnace::setTotalBurnTime).addInventory()
.create());
super(furnace.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.furnace = furnace;

View file

@ -2,37 +2,38 @@ package techreborn.client.gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import reborncore.common.powerSystem.PowerSystem;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.storage.TileMFE;
public class GuiMFE extends GuiBase {
TileMFE tile;
TileMFE mfe;
public GuiMFE(final EntityPlayer player, final TileMFE tile) {
super(player, tile, new ContainerBuilder("mfe").player(player.inventory).inventory().hotbar().armor().complete(8, 18).addArmor().addInventory().tile(tile).energySlot(0, 62, 45).energySlot(1, 98, 45).syncEnergyValue().addInventory().create());
this.tile = tile;
public GuiMFE(final EntityPlayer player, final TileMFE mfe) {
super(player, mfe, mfe.createContainer(player));
this.mfe = mfe;
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
Layer layer = Layer.BACKGROUND;
final Layer layer = Layer.BACKGROUND;
drawSlot(62, 45, layer);
drawSlot(98, 45, layer);
drawArmourSlots(8, 18, layer);
this.drawSlot(62, 45, layer);
this.drawSlot(98, 45, layer);
this.drawArmourSlots(8, 18, layer);
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
Layer layer = Layer.FOREGROUND;
final Layer layer = Layer.FOREGROUND;
builder.drawMultiEnergyBar(this, 81, 28, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
this.builder.drawMultiEnergyBar(this, 81, 28, (int) this.mfe.getEnergy(), (int) this.mfe.getMaxPower(), mouseX, mouseY, 0, layer);
GlStateManager.scale(0.6, 0.6, 5);
drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) (tile.getEnergy())) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) (tile.getMaxPower())) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);
this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfe.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfe.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);
GlStateManager.scale(1, 1, 1);
}
}

View file

@ -2,37 +2,38 @@ package techreborn.client.gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import reborncore.common.powerSystem.PowerSystem;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.storage.TileMFSU;
public class GuiMFSU extends GuiBase {
TileMFSU tile;
TileMFSU mfsu;
public GuiMFSU(final EntityPlayer player, final TileMFSU tile) {
super(player, tile, new ContainerBuilder("mfsu").player(player.inventory).inventory().hotbar().armor().complete(8, 18).addArmor().addInventory().tile(tile).energySlot(0, 62, 45).energySlot(1, 98, 45).syncEnergyValue().addInventory().create());
this.tile = tile;
public GuiMFSU(final EntityPlayer player, final TileMFSU mfsu) {
super(player, mfsu, mfsu.createContainer(player));
this.mfsu = mfsu;
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
Layer layer = Layer.BACKGROUND;
final Layer layer = Layer.BACKGROUND;
drawSlot(62, 45, layer);
drawSlot(98, 45, layer);
drawArmourSlots(8, 18, layer);
this.drawSlot(62, 45, layer);
this.drawSlot(98, 45, layer);
this.drawArmourSlots(8, 18, layer);
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
Layer layer = Layer.FOREGROUND;
final Layer layer = Layer.FOREGROUND;
builder.drawMultiEnergyBar(this, 81, 28, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
this.builder.drawMultiEnergyBar(this, 81, 28, (int) this.mfsu.getEnergy(), (int) this.mfsu.getMaxPower(), mouseX, mouseY, 0, layer);
GlStateManager.scale(0.6, 0.6, 5);
drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) (tile.getEnergy())) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) (tile.getMaxPower())) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);
this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfsu.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfsu.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);
GlStateManager.scale(1, 1, 1);
}
}

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileMatterFabricator;
public class GuiMatterFabricator extends GuiContainer {
@ -17,10 +16,7 @@ public class GuiMatterFabricator extends GuiContainer {
TileMatterFabricator matterfab;
public GuiMatterFabricator(final EntityPlayer player, final TileMatterFabricator tilematterfab) {
super(new ContainerBuilder("matterfabricator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tilematterfab).slot(0, 33, 17).slot(1, 33, 35).slot(2, 33, 53).slot(3, 51, 17)
.slot(4, 51, 35).slot(5, 51, 53).outputSlot(6, 116, 35).syncEnergyValue()
.syncIntegerValue(tilematterfab::getProgress, tilematterfab::setProgress).addInventory().create());
super(tilematterfab.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.matterfab = tilematterfab;

View file

@ -2,22 +2,22 @@ package techreborn.client.gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileQuantumChest;
public class GuiQuantumChest extends GuiBase {
TileQuantumChest tile;
TileQuantumChest quantumChest;
public GuiQuantumChest(final EntityPlayer player, final TileQuantumChest tile) {
super(player, tile, new ContainerBuilder("quantumchest").player(player.inventory).inventory().hotbar().addInventory().tile(tile).slot(0, 80, 24).outputSlot(1, 80, 64).addInventory().create());
this.tile = tile;
public GuiQuantumChest(final EntityPlayer player, final TileQuantumChest quantumChest) {
super(player, quantumChest, quantumChest.createContainer(player));
this.quantumChest = quantumChest;
}
@Override
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
Layer layer = Layer.BACKGROUND;
final Layer layer = Layer.BACKGROUND;
this.drawSlot(80, 24, layer);
this.drawSlot(80, 64, layer);
@ -26,13 +26,13 @@ public class GuiQuantumChest extends GuiBase {
@Override
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
Layer layer = Layer.FOREGROUND;
final Layer layer = Layer.FOREGROUND;
if (this.tile.storedItem != ItemStack.EMPTY && this.tile.getStackInSlot(1) != null) {
this.builder.drawBigBlueBar(this, 31, 43, this.tile.storedItem.getCount() + this.tile.getStackInSlot(1).getCount(), this.tile.maxCapacity, mouseX - this.guiLeft, mouseY - this.guiTop, "Stored", layer);
if (this.quantumChest.storedItem != ItemStack.EMPTY && this.quantumChest.getStackInSlot(1) != null) {
this.builder.drawBigBlueBar(this, 31, 43, this.quantumChest.storedItem.getCount() + this.quantumChest.getStackInSlot(1).getCount(), this.quantumChest.maxCapacity, mouseX - this.guiLeft, mouseY - this.guiTop, "Stored", layer);
}
if (this.tile.storedItem == ItemStack.EMPTY && this.tile.getStackInSlot(1) != null) {
this.builder.drawBigBlueBar(this, 31, 43, this.tile.getStackInSlot(1).getCount(), this.tile.maxCapacity, mouseX - this.guiLeft, mouseY - this.guiTop, "Stored", layer);
if (this.quantumChest.storedItem == ItemStack.EMPTY && this.quantumChest.getStackInSlot(1) != null) {
this.builder.drawBigBlueBar(this, 31, 43, this.quantumChest.getStackInSlot(1).getCount(), this.quantumChest.maxCapacity, mouseX - this.guiLeft, mouseY - this.guiTop, "Stored", layer);
}
}
}

View file

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

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.teir1.TileRecycler;
public class GuiRecycler extends GuiContainer {
@ -16,10 +15,7 @@ public class GuiRecycler extends GuiContainer {
TileRecycler recycler;
public GuiRecycler(final EntityPlayer player, final TileRecycler recycler) {
super(new ContainerBuilder("recycler").player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory()
.tile(recycler).slot(0, 56, 34).slot(1, 116, 34).upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26)
.upgradeSlot(4, 152, 44).upgradeSlot(5, 152, 62).syncEnergyValue()
.syncIntegerValue(recycler::getProgress, recycler::setProgress).addInventory().create());
super(recycler.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.recycler = recycler;

View file

@ -7,8 +7,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.api.RollingMachineRecipe;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileRollingMachine;
public class GuiRollingMachine extends GuiContainer {
@ -18,14 +16,7 @@ public class GuiRollingMachine extends GuiContainer {
TileRollingMachine rollingMachine;
public GuiRollingMachine(final EntityPlayer player, final TileRollingMachine tileRollingmachine) {
super(new ContainerBuilder("rollingmachine").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tileRollingmachine.craftMatrix).slot(0, 30, 17).slot(1, 48, 17).slot(2, 66, 17)
.slot(3, 30, 35).slot(4, 48, 35).slot(5, 66, 35).slot(6, 30, 53).slot(7, 48, 53).slot(8, 66, 53)
.onCraft(inv -> tileRollingmachine.inventory.setInventorySlotContents(1,
RollingMachineRecipe.instance.findMatchingRecipe(inv, tileRollingmachine.getWorld())))
.addInventory().tile(tileRollingmachine).outputSlot(0, 124, 35).energySlot(2, 8, 51).syncEnergyValue()
.syncIntegerValue(tileRollingmachine::getBurnTime, tileRollingmachine::setBurnTime).addInventory()
.create());
super(tileRollingmachine.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.rollingMachine = tileRollingmachine;

View file

@ -6,57 +6,50 @@ import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModItems;
import techreborn.tiles.TileScrapboxinator;
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;
TileScrapboxinator scrapboxinator;
public GuiScrapboxinator(final EntityPlayer player, final TileScrapboxinator scrapboxinator) {
super(new ContainerBuilder("scrapboxinator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(scrapboxinator)
.filterSlot(0, 56, 34, stack -> stack.getItem() == ModItems.SCRAP_BOX).outputSlot(1, 116, 34)
.upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44).upgradeSlot(5, 152, 62)
.syncEnergyValue().syncIntegerValue(scrapboxinator::getProgress, scrapboxinator::setProgress)
.addInventory().create());
this.xSize = 176;
this.ySize = 167;
this.tile = scrapboxinator;
}
public GuiScrapboxinator(final EntityPlayer player, final TileScrapboxinator scrapboxinator) {
super(scrapboxinator.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.scrapboxinator = scrapboxinator;
}
@Override
protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(GuiScrapboxinator.texture);
final int k = (this.width - this.xSize) / 2;
final int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(GuiScrapboxinator.texture);
final int k = (this.width - this.xSize) / 2;
final int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
int j = 0;
j = this.tile.gaugeProgressScaled(24);
// System.out.println(compressor.gaugeProgressScaled(10));
if (j > 0) {
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
}
j = this.scrapboxinator.gaugeProgressScaled(24);
// System.out.println(compressor.gaugeProgressScaled(10));
if (j > 0) {
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
}
j = this.tile.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
j = this.scrapboxinator.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final 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);
}
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final 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,7 +8,6 @@ import net.minecraft.util.text.translation.I18n;
import reborncore.client.RenderUtil;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.generator.TileSemifluidGenerator;
public class GuiSemifluidGenerator extends GuiContainer {
@ -17,15 +16,13 @@ public class GuiSemifluidGenerator extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/semifluid_generator.png");
TileSemifluidGenerator tile;
TileSemifluidGenerator semifluidGenerator;
public GuiSemifluidGenerator(final EntityPlayer player, final TileSemifluidGenerator tile) {
super(new ContainerBuilder("fluidgenerator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tile).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue()
.addInventory().create());
public GuiSemifluidGenerator(final EntityPlayer player, final TileSemifluidGenerator semifluidGenerator) {
super(semifluidGenerator.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.tile = tile;
this.semifluidGenerator = semifluidGenerator;
}
@Override
@ -35,7 +32,7 @@ public class GuiSemifluidGenerator extends GuiContainer {
final int k = (this.width - this.xSize) / 2;
final int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
RenderUtil.renderGuiTank(this.tile.tank.getFluid(), 16, 16, k + 59, l + 42, this.zLevel, 16, 16);
RenderUtil.renderGuiTank(this.semifluidGenerator.tank.getFluid(), 16, 16, k + 59, l + 42, this.zLevel, 16, 16);
}
@Override
@ -46,6 +43,6 @@ public class GuiSemifluidGenerator extends GuiContainer {
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(this.tile.tank.getFluidAmount() + "", 10, 30, 16448255);
this.fontRendererObj.drawString(this.semifluidGenerator.tank.getFluidAmount() + "", 10, 30, 16448255);
}
}

View file

@ -8,7 +8,6 @@ import net.minecraft.util.text.translation.I18n;
import reborncore.client.RenderUtil;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.generator.TileThermalGenerator;
public class GuiThermalGenerator extends GuiContainer {
@ -16,15 +15,13 @@ public class GuiThermalGenerator extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/thermal_generator.png");
TileThermalGenerator tile;
TileThermalGenerator thermalGenerator;
public GuiThermalGenerator(final EntityPlayer player, final TileThermalGenerator tile) {
super(new ContainerBuilder("fluidgenerator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tile).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue()
.addInventory().create());
public GuiThermalGenerator(final EntityPlayer player, final TileThermalGenerator thermalGenerator) {
super(thermalGenerator.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.tile = tile;
this.thermalGenerator = thermalGenerator;
}
@Override
@ -34,7 +31,7 @@ public class GuiThermalGenerator extends GuiContainer {
final int k = (this.width - this.xSize) / 2;
final int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
RenderUtil.renderGuiTank(this.tile.tank.getFluid(), 16, 16, k + 59, l + 42, this.zLevel, 16, 16);
RenderUtil.renderGuiTank(this.thermalGenerator.tank.getFluid(), 16, 16, k + 59, l + 42, this.zLevel, 16, 16);
}
@Override
@ -45,8 +42,8 @@ public class GuiThermalGenerator extends GuiContainer {
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(this.tile.tank.getFluidAmount() + "", 10, 30, 16448255);
this.fontRendererObj.drawString(this.tile.getEnergy() + "", 10, 40, 16448255);
this.fontRendererObj.drawString(this.thermalGenerator.tank.getFluidAmount() + "", 10, 30, 16448255);
this.fontRendererObj.drawString(this.thermalGenerator.getEnergy() + "", 10, 40, 16448255);
}
}

View file

@ -6,22 +6,19 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.multiblock.TileVacuumFreezer;
public class GuiVacuumFreezer extends GuiContainer {
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/vacuum_freezer.png");
TileVacuumFreezer crafter;
TileVacuumFreezer freezer;
public GuiVacuumFreezer(final EntityPlayer player, final TileVacuumFreezer freezer) {
super(new ContainerBuilder("vacuumfreezer").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(freezer).slot(0, 56, 34).outputSlot(1, 116, 35).syncEnergyValue()
.syncCrafterValue().addInventory().create());
super(freezer.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.crafter = freezer;
this.freezer = freezer;
}
@Override
@ -32,21 +29,21 @@ public class GuiVacuumFreezer extends GuiContainer {
final int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = this.crafter.getProgressScaled(24);
int j = this.freezer.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 80, l + 37, 176, 14, j + 1, 16);
}
j = (int) (this.crafter.getEnergy() * 12f / this.crafter.getMaxPower());
j = (int) (this.freezer.getEnergy() * 12f / this.freezer.getMaxPower());
if (j > 0) {
this.drawTexturedModalRect(k + 26, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
if (!this.crafter.getMultiBlock()) {
if (!this.freezer.getMultiBlock()) {
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38, l + 52 + 12, -1);
}
j = this.crafter.getEnergyScaled(12);
j = this.freezer.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 26, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}