Moving the handling of progress to GuiProgressBar

Adds an interface providing data for GuiProgressBar
Changed all containers simulating progress to implement the interface
This commit is contained in:
yueh
2014-09-28 20:36:58 +02:00
parent 640d888d13
commit 21a7d815ae
10 changed files with 142 additions and 44 deletions
@@ -26,7 +26,8 @@ public class GuiCondenser extends AEBaseGui
GuiProgressBar pb;
GuiImgButton mode;
public GuiCondenser(InventoryPlayer inventoryPlayer, TileCondenser te) {
public GuiCondenser(InventoryPlayer inventoryPlayer, TileCondenser te)
{
super( new ContainerCondenser( inventoryPlayer, te ) );
cvc = (ContainerCondenser) inventorySlots;
this.ySize = 197;
@@ -57,8 +58,7 @@ public class GuiCondenser extends AEBaseGui
{
super.initGui();
pb = new GuiProgressBar( "guis/condenser.png", 120 + guiLeft, 25 + guiTop, 178, 25, 6, 18, Direction.VERTICAL );
pb.TitleName = GuiText.StoredEnergy.getLocal();
pb = new GuiProgressBar( cvc, "guis/condenser.png", 120 + guiLeft, 25 + guiTop, 178, 25, 6, 18, Direction.VERTICAL, GuiText.StoredEnergy.getLocal() );
mode = new GuiImgButton( 128 + guiLeft, 52 + guiTop, Settings.CONDENSER_OUTPUT, cvc.output );
@@ -83,8 +83,6 @@ public class GuiCondenser extends AEBaseGui
mode.set( cvc.output );
mode.FillVar = "" + cvc.output.requiredPower;
pb.max = (int) cvc.requiredEnergy;
pb.current = (int) cvc.storedPower;
}
}
@@ -15,7 +15,8 @@ public class GuiInscriber extends AEBaseGui
ContainerInscriber cvc;
GuiProgressBar pb;
public GuiInscriber(InventoryPlayer inventoryPlayer, TileInscriber te) {
public GuiInscriber(InventoryPlayer inventoryPlayer, TileInscriber te)
{
super( new ContainerInscriber( inventoryPlayer, te ) );
cvc = (ContainerInscriber) inventorySlots;
this.ySize = 176;
@@ -27,7 +28,7 @@ public class GuiInscriber extends AEBaseGui
{
super.initGui();
pb = new GuiProgressBar( "guis/inscriber.png", 135, 39, 135, 177, 6, 18, Direction.VERTICAL );
pb = new GuiProgressBar( cvc, "guis/inscriber.png", 135, 39, 135, 177, 6, 18, Direction.VERTICAL );
this.buttonList.add( pb );
}
@@ -49,9 +50,7 @@ public class GuiInscriber extends AEBaseGui
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
pb.max = cvc.maxProcessingTime;
pb.current = cvc.processingTime;
pb.FullMsg = (pb.current * 100 / pb.max) + "%";
pb.setFullMsg( cvc.getCurrentProgress() * 100 / cvc.getMaxProgress() + "%" );
fontRendererObj.drawString( getGuiDisplayName( GuiText.Inscriber.getLocal() ), 8, 6, 4210752 );
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
@@ -21,7 +21,7 @@ public class GuiMAC extends GuiUpgradeable
{
super.initGui();
pb = new GuiProgressBar( "guis/mac.png", 139, 36, 148, 201, 6, 18, Direction.VERTICAL );
pb = new GuiProgressBar( container, "guis/mac.png", 139, 36, 148, 201, 6, 18, Direction.VERTICAL );
this.buttonList.add( pb );
}
@@ -36,10 +36,7 @@ public class GuiMAC extends GuiUpgradeable
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
pb.max = 100;
pb.current = container.craftProgress;
pb.FullMsg = pb.current + "%";
pb.setFullMsg( container.getCurrentProgress() + "%" );
super.drawFG( offsetX, offsetY, mouseX, mouseY );
}
@@ -56,7 +53,8 @@ public class GuiMAC extends GuiUpgradeable
return "guis/mac.png";
}
public GuiMAC(InventoryPlayer inventoryPlayer, TileMolecularAssembler te) {
public GuiMAC(InventoryPlayer inventoryPlayer, TileMolecularAssembler te)
{
super( new ContainerMAC( inventoryPlayer, te ) );
this.ySize = 197;
this.container = (ContainerMAC) this.inventorySlots;
@@ -17,7 +17,8 @@ public class GuiVibrationChamber extends AEBaseGui
ContainerVibrationChamber cvc;
GuiProgressBar pb;
public GuiVibrationChamber(InventoryPlayer inventoryPlayer, TileVibrationChamber te) {
public GuiVibrationChamber(InventoryPlayer inventoryPlayer, TileVibrationChamber te)
{
super( new ContainerVibrationChamber( inventoryPlayer, te ) );
cvc = (ContainerVibrationChamber) inventorySlots;
this.ySize = 166;
@@ -28,7 +29,7 @@ public class GuiVibrationChamber extends AEBaseGui
{
super.initGui();
pb = new GuiProgressBar( "guis/vibchamber.png", 99, 36, 176, 14, 6, 18, Direction.VERTICAL );
pb = new GuiProgressBar( cvc, "guis/vibchamber.png", 99, 36, 176, 14, 6, 18, Direction.VERTICAL );
this.buttonList.add( pb );
}
@@ -50,13 +51,11 @@ public class GuiVibrationChamber extends AEBaseGui
int k = 25;
int l = -15;
pb.max = 200;
pb.current = cvc.burnProgress > 0 ? cvc.burnSpeed : 0;
pb.FullMsg = (cvc.aePerTick * pb.current / 100) + " ae/t";
pb.setFullMsg( cvc.aePerTick * cvc.getCurrentProgress() / 100 + " ae/t" );
if ( cvc.burnProgress > 0 )
if ( cvc.getCurrentProgress() > 0 )
{
int i1 = cvc.burnProgress;
int i1 = cvc.getCurrentProgress();
bindTexture( "guis/vibchamber.png" );
GL11.glColor3f( 1, 1, 1 );
this.drawTexturedModalRect( k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2 );