Added GUI progress bar to the Industrial Centrifuge

This commit is contained in:
Tntrololol 2015-05-20 16:43:46 -05:00
parent 1f93e6a90e
commit 4bd43b861c
2 changed files with 25 additions and 12 deletions

View file

@ -11,8 +11,7 @@ import techreborn.tiles.TileCentrifuge;
public class GuiCentrifuge extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation(
"techreborn", "textures/gui/industrial_centrifuge.png");
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/industrial_centrifuge.png");
TileCentrifuge centrifuge;
@ -23,12 +22,36 @@ public class GuiCentrifuge extends GuiContainer {
centrifuge = tileCentrifuge;
}
@Override
public void initGui() {
this.buttonList.clear();
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.buttonList.add(new GuiButton(0, k + 4, l + 4, 20, 20, "R"));
super.initGui();
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
if(centrifuge.crafter.currentRecipe != null) {
j = this.centrifuge.crafter.currentTickTime * 11 / this.centrifuge.crafter.currentRecipe.tickTime();
}
this.drawTexturedModalRect(k + 83, l + 23 + 10 - j, 177, 15 + 10 - j, 10, j);
this.drawTexturedModalRect(k + 98, l + 38, 177, 51, j, 10);
this.drawTexturedModalRect(k + 83, l + 53, 177, 39, 10, j);
this.drawTexturedModalRect(k + 68 + 10 - j, l + 38, 177 + 10 - j, 27, j, 10);
j = (int)this.centrifuge.energy.getEnergyStored() * 12 / this.centrifuge.energy.getCapacity();
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_) {
@ -38,14 +61,4 @@ public class GuiCentrifuge extends GuiContainer {
this.fontRendererObj.drawString(namePt2, 98, 14, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
@Override
public void initGui() {
this.buttonList.clear();
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.buttonList.add(new GuiButton(0, k + 4, l + 4, 20, 20, "R"));
super.initGui();
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB