Merge branch 'feature/containers-builder' of https://github.com/TechReborn/TechReborn into feature/containers-builder

# Conflicts:
#	src/main/java/techreborn/client/gui/GuiBatbox.java
#	src/main/java/techreborn/client/gui/GuiQuantumChest.java
This commit is contained in:
ProfessorProspector 2017-01-07 20:22:34 -08:00
commit 0cccb0a91b
47 changed files with 915 additions and 1452 deletions

View file

@ -5,59 +5,61 @@ 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 reborncore.common.container.RebornContainer;
import techreborn.client.container.ContainerAssemblingMachine;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileAssemblingMachine;
public class GuiAssemblingMachine extends GuiContainer {
public static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/assembling_machine.png");
"textures/gui/assembling_machine.png");
TileAssemblingMachine assemblingmachine;
ContainerAssemblingMachine containerAssemblingMachine;
public GuiAssemblingMachine(EntityPlayer player, TileAssemblingMachine tileassemblinmachine) {
super(RebornContainer.createContainer(ContainerAssemblingMachine.class, tileassemblinmachine, player));
containerAssemblingMachine = (ContainerAssemblingMachine) this.inventorySlots;
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());
this.xSize = 176;
this.ySize = 167;
assemblingmachine = tileassemblinmachine;
this.assemblingmachine = assemblingMachine;
}
@Override
public void initGui() {
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
final int k = (this.width - this.xSize) / 2;
final 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_) {
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(GuiAssemblingMachine.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;
j = assemblingmachine.getProgressScaled(20);
j = this.assemblingmachine.getProgressScaled(20);
if (j > 0) {
this.drawTexturedModalRect(k + 86, l + 34, 176, 14, j + 1, 16);
}
j = assemblingmachine.getEnergyScaled(12);
j = this.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");
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final String name = I18n.translateToLocal("tile.techreborn.assemblinmachine.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);
}
}

View file

@ -12,17 +12,10 @@ public class GuiBatbox extends GuiBase {
TileBatBox tile;
public GuiBatbox(final EntityPlayer player, final TileBatBox tile) {
super(player, tile, new ContainerBuilder().player(player.inventory).inventory().hotbar().addInventory().tile(tile).energySlot(0, 62, 45).energySlot(1, 98, 45).syncEnergyValue().addInventory().create());
super(player, tile, new ContainerBuilder("batbox").player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory().tile(tile).energySlot(0, 62, 45).energySlot(1, 98, 45).syncEnergyValue().addInventory().create());
this.tile = tile;
}
@Override
public void initGui() {
final int k = (this.width - this.xSize) / 2;
final int l = (this.height - this.ySize) / 2;
super.initGui();
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
@ -33,6 +26,7 @@ public class GuiBatbox extends GuiBase {
this.buttonList.add(new GuiButtonPowerBar(0, guiLeft + 82, guiTop + 29));
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
builder.drawMultiEnergyBar(this, 81, 28, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX - guiLeft, mouseY - guiTop);

View file

@ -5,42 +5,46 @@ 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 reborncore.common.container.RebornContainer;
import techreborn.client.container.ContainerCentrifuge;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileCentrifuge;
public class GuiCentrifuge extends GuiContainer {
public static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/industrial_centrifuge.png");
"textures/gui/industrial_centrifuge.png");
TileCentrifuge centrifuge;
public GuiCentrifuge(EntityPlayer player, TileCentrifuge tileCentrifuge) {
super(RebornContainer.createContainer(ContainerCentrifuge.class, tileCentrifuge, player));
public GuiCentrifuge(final EntityPlayer player, final TileCentrifuge tileCentrifuge) {
super(new ContainerBuilder("centrifuge").player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory()
.tile(tileCentrifuge).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());
this.xSize = 176;
this.ySize = 167;
centrifuge = tileCentrifuge;
this.centrifuge = tileCentrifuge;
}
@Override
public void initGui() {
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
final int k = (this.width - this.xSize) / 2;
final 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_) {
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(GuiCentrifuge.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;
j = centrifuge.getProgressScaled(11);
j = this.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);
@ -48,20 +52,21 @@ public class GuiCentrifuge extends GuiContainer {
this.drawTexturedModalRect(k + 68 + 10 - j, l + 38, 177 + 10 - j, 27, j, 10);
}
j = centrifuge.getEnergyScaled(12);
j = this.centrifuge.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 namePt1 = I18n.translateToLocal("tile.techreborn.industrialBlock.name");
String namePt2 = I18n.translateToLocal("tile.techreborn.centrifuge.name").replace(namePt1 + " ", "");
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final String namePt1 = I18n.translateToLocal("tile.techreborn.industrialBlock.name");
final 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);
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString(this.centrifuge.getProgressScaled(100) + "%", 98, this.ySize - 96 + 2, 4210752);
}
}

View file

@ -16,9 +16,9 @@ public class GuiChargeBench extends GuiContainer {
TileChargeBench chargebench;
public GuiChargeBench(final EntityPlayer player, final TileChargeBench tile) {
super(new ContainerBuilder().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());
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());
this.xSize = 176;
this.ySize = 167;
this.chargebench = tile;

View file

@ -5,59 +5,62 @@ 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.ContainerChemicalReactor;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileChemicalReactor;
public class GuiChemicalReactor extends GuiContainer {
public static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/chemical_reactor.png");
"textures/gui/chemical_reactor.png");
TileChemicalReactor chemicalReactor;
ContainerChemicalReactor containerChemicalReactor;
public GuiChemicalReactor(EntityPlayer player, TileChemicalReactor tilechemicalReactor) {
super(new ContainerChemicalReactor(tilechemicalReactor, player));
containerChemicalReactor = (ContainerChemicalReactor) this.inventorySlots;
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());
this.xSize = 176;
this.ySize = 167;
chemicalReactor = tilechemicalReactor;
this.chemicalReactor = tilechemicalReactor;
}
@Override
public void initGui() {
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
final int k = (this.width - this.xSize) / 2;
final 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_) {
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(GuiChemicalReactor.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;
j = chemicalReactor.getProgressScaled(11);
j = this.chemicalReactor.getProgressScaled(11);
if (j > 0) {
this.drawTexturedModalRect(k + 73, l + 39, 177, 15, 30, j);
}
j = chemicalReactor.getEnergyScaled(12);
j = this.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");
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final String name = I18n.translateToLocal("tile.techreborn.chemicalreactor.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);
}
}

View file

@ -13,7 +13,7 @@ import techreborn.tiles.TileChunkLoader;
public class GuiChunkLoader extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/industrial_chunkloader.png");
"textures/gui/industrial_chunkloader.png");
TileChunkLoader chunkloader;
private GuiButton plusOneButton;
private GuiButton plusTenButton;
@ -21,10 +21,11 @@ public class GuiChunkLoader extends GuiContainer {
private GuiButton minusTenButton;
public GuiChunkLoader(final EntityPlayer player, final TileChunkLoader tilechunkloader) {
super(new ContainerBuilder().player(player.inventory).inventory().hotbar().addInventory().create());
super(new ContainerBuilder("chunkloader").player(player.inventory).inventory().hotbar().addInventory()
.create());
this.xSize = 176;
this.ySize = 167;
chunkloader = tilechunkloader;
this.chunkloader = tilechunkloader;
}
@Override
@ -32,33 +33,34 @@ public class GuiChunkLoader extends GuiContainer {
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");
this.plusOneButton = new GuiButton(0, this.guiLeft + 5, this.guiTop + 37, 40, 20, "+1");
this.plusTenButton = new GuiButton(0, this.guiLeft + 45, this.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");
this.minusOneButton = new GuiButton(0, this.guiLeft + 90, this.guiTop + 37, 40, 20, "-1");
this.minusTenButton = new GuiButton(0, this.guiLeft + 130, this.guiTop + 37, 40, 20, "-10");
buttonList.add(plusOneButton);
buttonList.add(plusTenButton);
buttonList.add(minusOneButton);
buttonList.add(minusTenButton);
this.buttonList.add(this.plusOneButton);
this.buttonList.add(this.plusTenButton);
this.buttonList.add(this.minusOneButton);
this.buttonList.add(this.minusTenButton);
}
@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(GuiChunkLoader.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.chunkloader.name");
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final String name = I18n.translateToLocal("tile.techreborn.chunkloader.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);
}
}

View file

@ -5,7 +5,8 @@ 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.ContainerCompressor;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.teir1.TileCompressor;
public class GuiCompressor extends GuiContainer {
@ -13,42 +14,45 @@ public class GuiCompressor extends GuiContainer {
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/compressor.png");
TileCompressor compressor;
ContainerCompressor containerGrinder;
public GuiCompressor(EntityPlayer player, TileCompressor tilegrinder) {
super(new ContainerCompressor(tilegrinder, player));
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());
this.xSize = 176;
this.ySize = 167;
compressor = tilegrinder;
containerGrinder = (ContainerCompressor) this.inventorySlots;
this.compressor = compressor;
}
@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(GuiCompressor.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;
j = compressor.getProgressScaled(24);
j = this.compressor.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
}
j = compressor.getEnergyScaled(12);
j = this.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");
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final String name = I18n.translateToLocal("tile.techreborn.compressor.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);
}
}

View file

@ -5,47 +5,49 @@ 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 reborncore.common.powerSystem.PowerSystem;
import techreborn.client.container.ContainerDieselGenerator;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.generator.TileDieselGenerator;
public class GuiDieselGenerator extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/diesel_generator.png");
"textures/gui/diesel_generator.png");
TileDieselGenerator tile;
ContainerDieselGenerator containerDieselGenerator;
public GuiDieselGenerator(EntityPlayer player, TileDieselGenerator tile) {
super(new ContainerDieselGenerator(tile, player));
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());
this.xSize = 176;
this.ySize = 167;
this.tile = tile;
containerDieselGenerator = (ContainerDieselGenerator) this.inventorySlots;
}
@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(GuiDieselGenerator.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.dieselgenerator.name");
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final String name = I18n.translateToLocal("tile.techreborn.dieselgenerator.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(containerDieselGenerator.fluid + "", 10, 30, 16448255);
this.fontRendererObj.drawString(this.tile.tank.getFluidAmount() + "", 10, 30, 16448255);
this.fontRendererObj.drawString("Power Amount", 10, 40, 16448255);
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerDieselGenerator.energy) + "", 10, 50,
16448255);
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(this.tile.getEnergy()) + "", 10, 50,
16448255);
}
}

View file

@ -10,25 +10,26 @@ public class GuiDigitalChest extends GuiBase {
TileDigitalChest tile;
public GuiDigitalChest(final EntityPlayer player, final TileDigitalChest tile) {
super(player, tile, new ContainerBuilder().player(player.inventory).inventory().hotbar().addInventory().tile(tile).slot(0, 80, 24).outputSlot(1, 80, 64).addInventory().create());
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;
}
@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);
drawSlotBackground(80, 24);
drawSlotBackground(80, 64);
this.drawSlotBackground(80, 24);
this.drawSlotBackground(80, 64);
}
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
@Override
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
if (tile.storedItem != ItemStack.EMPTY && tile.getStackInSlot(1) != null) {
builder.drawBigBlueBar(this, 31, 43, tile.storedItem.getCount() + tile.getStackInSlot(1).getCount(), tile.maxCapacity, mouseX - guiLeft, mouseY - guiTop, "Stored");
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");
}
if (tile.storedItem == ItemStack.EMPTY && tile.getStackInSlot(1) != null) {
builder.drawBigBlueBar(this, 31, 43, tile.getStackInSlot(1).getCount(), tile.maxCapacity, mouseX - guiLeft, mouseY - guiTop, "Stored");
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");
}
}
}

View file

@ -5,7 +5,8 @@ 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.ContainerElectricFurnace;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.teir1.TileElectricFurnace;
public class GuiElectricFurnace extends GuiContainer {
@ -13,43 +14,44 @@ public class GuiElectricFurnace extends GuiContainer {
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/compressor.png");
TileElectricFurnace furnace;
ContainerElectricFurnace containerGrinder;
public GuiElectricFurnace(EntityPlayer player, TileElectricFurnace tilegrinder) {
super(new ContainerElectricFurnace(tilegrinder, player));
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());
this.xSize = 176;
this.ySize = 167;
furnace = tilegrinder;
containerGrinder = (ContainerElectricFurnace) this.inventorySlots;
this.furnace = furnace;
}
@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(GuiElectricFurnace.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;
j = furnace.gaugeProgressScaled(24);
j = this.furnace.gaugeProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 78, l + 34, 176, 14, j + 1, 16);
}
j = furnace.getEnergyScaled(12);
j = this.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");
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final String name = I18n.translateToLocal("tile.techreborn.electricfurnace.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);
}
}

View file

@ -5,8 +5,8 @@ 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 reborncore.common.container.RebornContainer;
import techreborn.client.container.ContainerExtractor;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.teir1.TileExtractor;
public class GuiExtractor extends GuiContainer {
@ -14,42 +14,44 @@ public class GuiExtractor extends GuiContainer {
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/compressor.png");
TileExtractor extractor;
ContainerExtractor containerExtractor;
public GuiExtractor(EntityPlayer player, TileExtractor tileExtractor) {
super(RebornContainer.createContainer(ContainerExtractor.class, tileExtractor, player));
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());
this.xSize = 176;
this.ySize = 167;
this.extractor = tileExtractor;
containerExtractor = (ContainerExtractor) this.inventorySlots;
this.extractor = extractor;
}
@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(GuiExtractor.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;
j = extractor.getProgressScaled(24);
j = this.extractor.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
}
j = extractor.getEnergyScaled(12);
j = this.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");
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final String name = I18n.translateToLocal("tile.techreborn.extractor.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);
}
}

View file

@ -5,40 +5,45 @@ 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.ContainerGasTurbine;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.generator.TileGasTurbine;
public class GuiGasTurbine extends GuiContainer {
// TODO: use semifluid generator texture
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/thermal_generator.png");
"textures/gui/thermal_generator.png");
TileGasTurbine tile;
public GuiGasTurbine(EntityPlayer player, TileGasTurbine tile) {
super(new ContainerGasTurbine(tile, player));
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());
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_) {
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(GuiGasTurbine.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 = "Gas Turbine";
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final String name = "Gas Turbine";
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.tile.tank.getFluidAmount() + "", 10, 30, 16448255);
}
}

View file

@ -4,8 +4,10 @@ import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import reborncore.common.powerSystem.PowerSystem;
import techreborn.client.container.ContainerGenerator;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.generator.TileGenerator;
public class GuiGenerator extends GuiContainer {
@ -14,51 +16,52 @@ public class GuiGenerator extends GuiContainer {
TileGenerator generator;
ContainerGenerator containerGenerator;
public GuiGenerator(EntityPlayer player, TileGenerator generator) {
super(new ContainerGenerator(generator, player));
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());
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;
final int k = (this.width - this.xSize) / 2;
final 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;
protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
this.mc.getTextureManager().bindTexture(GuiGenerator.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;
j = generator.getEnergyScaled(24);
j = this.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);
if (this.generator.burnTime != 0) {
j = this.generator.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");
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final String name = I18n.translateToLocal("tile.techreborn.generator.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(PowerSystem.getLocaliszedPower(containerGenerator.energy), 25, this.ySize - 150,
4210752);
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(this.generator.getEnergy()), 25,
this.ySize - 150, 4210752);
}
}

View file

@ -5,8 +5,8 @@ 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 reborncore.common.container.RebornContainer;
import techreborn.client.container.ContainerGrinder;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.teir1.TileGrinder;
public class GuiGrinder extends GuiContainer {
@ -14,43 +14,44 @@ public class GuiGrinder extends GuiContainer {
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/grinder.png");
TileGrinder grinder;
ContainerGrinder containerGrinder;
public GuiGrinder(EntityPlayer player, TileGrinder tilegrinder) {
super(RebornContainer.createContainer(ContainerGrinder.class, tilegrinder, player));
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());
this.xSize = 176;
this.ySize = 167;
this.grinder = tilegrinder;
containerGrinder = (ContainerGrinder) this.inventorySlots;
this.grinder = grinder;
}
@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(GuiGrinder.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;
j = grinder.getProgressScaled(24);
j = this.grinder.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 80, l + 36, 176, 14, j + 1, 16);
}
j = grinder.getEnergyScaled(12);
j = this.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");
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final String name = I18n.translateToLocal("tile.techreborn.grinder.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);
}
}

View file

@ -5,52 +5,56 @@ 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.ContainerIronFurnace;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileIronFurnace;
public class GuiIronFurnace extends GuiContainer {
public static final ResourceLocation texture = new ResourceLocation("minecraft",
"textures/gui/container/furnace.png");
"textures/gui/container/furnace.png");
TileIronFurnace furnace;
ContainerIronFurnace containerGrinder;
public GuiIronFurnace(EntityPlayer player, TileIronFurnace tilegrinder) {
super(new ContainerIronFurnace(tilegrinder, player));
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());
this.xSize = 176;
this.ySize = 167;
furnace = tilegrinder;
containerGrinder = (ContainerIronFurnace) this.inventorySlots;
this.furnace = furnace;
}
@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(GuiIronFurnace.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;
j = furnace.gaugeProgressScaled(24);
j = this.furnace.gaugeProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
}
j = furnace.gaugeFuelScaled(12);
j = this.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");
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final String name = I18n.translateToLocal("tile.techreborn.ironfurnace.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);
}
}

View file

@ -21,9 +21,9 @@ public class GuiMFE extends GuiContainer {
public GuiMFE(final EntityPlayer player, final TileMFE generator) {
super(new ContainerBuilder().player(player.inventory).inventory(8, 84).hotbar(8, 142).armor().complete(44, 6)
.addArmor().addInventory().tile(generator).energySlot(0, 80, 17).energySlot(1, 80, 53).syncEnergyValue()
.addInventory().create());
super(new ContainerBuilder("mfe").player(player.inventory).inventory(8, 84).hotbar(8, 142).armor()
.complete(44, 6).addArmor().addInventory().tile(generator).energySlot(0, 80, 17).energySlot(1, 80, 53)
.syncEnergyValue().addInventory().create());
this.xSize = 176;
this.ySize = 167;
this.generator = generator;

View file

@ -20,9 +20,9 @@ public class GuiMFSU extends GuiContainer {
TileMFSU generator;
public GuiMFSU(final EntityPlayer player, final TileMFSU generator) {
super(new ContainerBuilder().player(player.inventory).inventory(8, 84).hotbar(8, 142).armor().complete(44, 6)
.addArmor().addInventory().tile(generator).energySlot(0, 80, 17).energySlot(1, 80, 53).syncEnergyValue()
.addInventory().create());
super(new ContainerBuilder("mfsu").player(player.inventory).inventory(8, 84).hotbar(8, 142).armor()
.complete(44, 6).addArmor().addInventory().tile(generator).energySlot(0, 80, 17).energySlot(1, 80, 53)
.syncEnergyValue().addInventory().create());
this.xSize = 176;
this.ySize = 167;
this.generator = generator;

View file

@ -10,7 +10,7 @@ public class GuiQuantumChest extends GuiBase {
TileQuantumChest tile;
public GuiQuantumChest(final EntityPlayer player, final TileQuantumChest tile) {
super(player, tile, new ContainerBuilder().player(player.inventory).inventory().hotbar().addInventory().tile(tile).slot(0, 80, 24).outputSlot(1, 80, 64).addInventory().create());
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;
}

View file

@ -5,50 +5,54 @@ 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.ContainerRecycler;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.teir1.TileRecycler;
public class GuiRecycler extends GuiContainer {
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/compressor.png");
TileRecycler compressor;
ContainerRecycler containerGrinder;
TileRecycler recycler;
public GuiRecycler(EntityPlayer player, TileRecycler tilegrinder) {
super(new ContainerRecycler(tilegrinder, player));
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());
this.xSize = 176;
this.ySize = 167;
compressor = tilegrinder;
containerGrinder = (ContainerRecycler) this.inventorySlots;
this.recycler = recycler;
}
@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(GuiRecycler.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;
j = compressor.gaugeProgressScaled(24);
j = this.recycler.gaugeProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
}
j = compressor.getEnergyScaled(12);
j = this.recycler.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");
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final String name = I18n.translateToLocal("tile.techreborn.recycler.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);
}
}

View file

@ -5,42 +5,47 @@ 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 reborncore.client.RenderUtil;
import techreborn.client.container.ContainerSemifluidGenerator;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.generator.TileSemifluidGenerator;
public class GuiSemifluidGenerator extends GuiContainer {
// TODO: use semifluid generator texture
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/semifluid_generator.png");
"textures/gui/semifluid_generator.png");
TileSemifluidGenerator tile;
public GuiSemifluidGenerator(EntityPlayer player, TileSemifluidGenerator tile) {
super(new ContainerSemifluidGenerator(tile, player));
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());
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_) {
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(GuiSemifluidGenerator.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);
RenderUtil.renderGuiTank(tile.tank.getFluid(), 16, 16, k + 59, l + 42, this.zLevel, 16, 16);
RenderUtil.renderGuiTank(this.tile.tank.getFluid(), 16, 16, k + 59, l + 42, this.zLevel, 16, 16);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = "Semifluid Generator";
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final String name = "Semifluid Generator";
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.tile.tank.getFluidAmount() + "", 10, 30, 16448255);
}
}

View file

@ -5,43 +5,48 @@ 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 reborncore.client.RenderUtil;
import techreborn.client.container.ContainerThermalGenerator;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.generator.TileThermalGenerator;
public class GuiThermalGenerator extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/thermal_generator.png");
"textures/gui/thermal_generator.png");
TileThermalGenerator tile;
public GuiThermalGenerator(EntityPlayer player, TileThermalGenerator tile) {
super(new ContainerThermalGenerator(tile, player));
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());
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_) {
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(GuiThermalGenerator.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);
RenderUtil.renderGuiTank(tile.tank.getFluid(), 16, 16, k + 59, l + 42, this.zLevel, 16, 16);
RenderUtil.renderGuiTank(this.tile.tank.getFluid(), 16, 16, k + 59, l + 42, this.zLevel, 16, 16);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.thermalGenerator.name");
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final String name = I18n.translateToLocal("tile.techreborn.thermalGenerator.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(tile.getEnergy() + "", 10, 40, 16448255);
this.fontRendererObj.drawString(this.tile.tank.getFluidAmount() + "", 10, 30, 16448255);
this.fontRendererObj.drawString(this.tile.getEnergy() + "", 10, 40, 16448255);
}
}