Merge pull request #190 from yueh/feature-progress-provider
Moving the handling of progress to GuiProgressBar
This commit is contained in:
commit
2688548479
10 changed files with 142 additions and 44 deletions
|
@ -26,7 +26,8 @@ public class GuiCondenser extends AEBaseGui
|
||||||
GuiProgressBar pb;
|
GuiProgressBar pb;
|
||||||
GuiImgButton mode;
|
GuiImgButton mode;
|
||||||
|
|
||||||
public GuiCondenser(InventoryPlayer inventoryPlayer, TileCondenser te) {
|
public GuiCondenser(InventoryPlayer inventoryPlayer, TileCondenser te)
|
||||||
|
{
|
||||||
super( new ContainerCondenser( inventoryPlayer, te ) );
|
super( new ContainerCondenser( inventoryPlayer, te ) );
|
||||||
cvc = (ContainerCondenser) inventorySlots;
|
cvc = (ContainerCondenser) inventorySlots;
|
||||||
this.ySize = 197;
|
this.ySize = 197;
|
||||||
|
@ -57,8 +58,7 @@ public class GuiCondenser extends AEBaseGui
|
||||||
{
|
{
|
||||||
super.initGui();
|
super.initGui();
|
||||||
|
|
||||||
pb = new GuiProgressBar( "guis/condenser.png", 120 + guiLeft, 25 + guiTop, 178, 25, 6, 18, Direction.VERTICAL );
|
pb = new GuiProgressBar( cvc, "guis/condenser.png", 120 + guiLeft, 25 + guiTop, 178, 25, 6, 18, Direction.VERTICAL, GuiText.StoredEnergy.getLocal() );
|
||||||
pb.TitleName = GuiText.StoredEnergy.getLocal();
|
|
||||||
|
|
||||||
mode = new GuiImgButton( 128 + guiLeft, 52 + guiTop, Settings.CONDENSER_OUTPUT, cvc.output );
|
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.set( cvc.output );
|
||||||
mode.FillVar = "" + cvc.output.requiredPower;
|
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;
|
ContainerInscriber cvc;
|
||||||
GuiProgressBar pb;
|
GuiProgressBar pb;
|
||||||
|
|
||||||
public GuiInscriber(InventoryPlayer inventoryPlayer, TileInscriber te) {
|
public GuiInscriber(InventoryPlayer inventoryPlayer, TileInscriber te)
|
||||||
|
{
|
||||||
super( new ContainerInscriber( inventoryPlayer, te ) );
|
super( new ContainerInscriber( inventoryPlayer, te ) );
|
||||||
cvc = (ContainerInscriber) inventorySlots;
|
cvc = (ContainerInscriber) inventorySlots;
|
||||||
this.ySize = 176;
|
this.ySize = 176;
|
||||||
|
@ -27,7 +28,7 @@ public class GuiInscriber extends AEBaseGui
|
||||||
{
|
{
|
||||||
super.initGui();
|
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 );
|
this.buttonList.add( pb );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,9 +50,7 @@ public class GuiInscriber extends AEBaseGui
|
||||||
@Override
|
@Override
|
||||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||||
{
|
{
|
||||||
pb.max = cvc.maxProcessingTime;
|
pb.setFullMsg( cvc.getCurrentProgress() * 100 / cvc.getMaxProgress() + "%" );
|
||||||
pb.current = cvc.processingTime;
|
|
||||||
pb.FullMsg = (pb.current * 100 / pb.max) + "%";
|
|
||||||
|
|
||||||
fontRendererObj.drawString( getGuiDisplayName( GuiText.Inscriber.getLocal() ), 8, 6, 4210752 );
|
fontRendererObj.drawString( getGuiDisplayName( GuiText.Inscriber.getLocal() ), 8, 6, 4210752 );
|
||||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class GuiMAC extends GuiUpgradeable
|
||||||
{
|
{
|
||||||
super.initGui();
|
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 );
|
this.buttonList.add( pb );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,10 +36,7 @@ public class GuiMAC extends GuiUpgradeable
|
||||||
@Override
|
@Override
|
||||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||||
{
|
{
|
||||||
pb.max = 100;
|
pb.setFullMsg( container.getCurrentProgress() + "%" );
|
||||||
pb.current = container.craftProgress;
|
|
||||||
pb.FullMsg = pb.current + "%";
|
|
||||||
|
|
||||||
super.drawFG( offsetX, offsetY, mouseX, mouseY );
|
super.drawFG( offsetX, offsetY, mouseX, mouseY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +53,8 @@ public class GuiMAC extends GuiUpgradeable
|
||||||
return "guis/mac.png";
|
return "guis/mac.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
public GuiMAC(InventoryPlayer inventoryPlayer, TileMolecularAssembler te) {
|
public GuiMAC(InventoryPlayer inventoryPlayer, TileMolecularAssembler te)
|
||||||
|
{
|
||||||
super( new ContainerMAC( inventoryPlayer, te ) );
|
super( new ContainerMAC( inventoryPlayer, te ) );
|
||||||
this.ySize = 197;
|
this.ySize = 197;
|
||||||
this.container = (ContainerMAC) this.inventorySlots;
|
this.container = (ContainerMAC) this.inventorySlots;
|
||||||
|
|
|
@ -17,7 +17,8 @@ public class GuiVibrationChamber extends AEBaseGui
|
||||||
ContainerVibrationChamber cvc;
|
ContainerVibrationChamber cvc;
|
||||||
GuiProgressBar pb;
|
GuiProgressBar pb;
|
||||||
|
|
||||||
public GuiVibrationChamber(InventoryPlayer inventoryPlayer, TileVibrationChamber te) {
|
public GuiVibrationChamber(InventoryPlayer inventoryPlayer, TileVibrationChamber te)
|
||||||
|
{
|
||||||
super( new ContainerVibrationChamber( inventoryPlayer, te ) );
|
super( new ContainerVibrationChamber( inventoryPlayer, te ) );
|
||||||
cvc = (ContainerVibrationChamber) inventorySlots;
|
cvc = (ContainerVibrationChamber) inventorySlots;
|
||||||
this.ySize = 166;
|
this.ySize = 166;
|
||||||
|
@ -28,7 +29,7 @@ public class GuiVibrationChamber extends AEBaseGui
|
||||||
{
|
{
|
||||||
super.initGui();
|
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 );
|
this.buttonList.add( pb );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,13 +51,11 @@ public class GuiVibrationChamber extends AEBaseGui
|
||||||
int k = 25;
|
int k = 25;
|
||||||
int l = -15;
|
int l = -15;
|
||||||
|
|
||||||
pb.max = 200;
|
pb.setFullMsg( cvc.aePerTick * cvc.getCurrentProgress() / 100 + " ae/t" );
|
||||||
pb.current = cvc.burnProgress > 0 ? cvc.burnSpeed : 0;
|
|
||||||
pb.FullMsg = (cvc.aePerTick * pb.current / 100) + " ae/t";
|
|
||||||
|
|
||||||
if ( cvc.burnProgress > 0 )
|
if ( cvc.getCurrentProgress() > 0 )
|
||||||
{
|
{
|
||||||
int i1 = cvc.burnProgress;
|
int i1 = cvc.getCurrentProgress();
|
||||||
bindTexture( "guis/vibchamber.png" );
|
bindTexture( "guis/vibchamber.png" );
|
||||||
GL11.glColor3f( 1, 1, 1 );
|
GL11.glColor3f( 1, 1, 1 );
|
||||||
this.drawTexturedModalRect( k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2 );
|
this.drawTexturedModalRect( k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2 );
|
||||||
|
|
|
@ -3,6 +3,7 @@ package appeng.client.gui.widgets;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import appeng.container.interfaces.IProgressProvider;
|
||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.GuiText;
|
||||||
|
|
||||||
public class GuiProgressBar extends GuiButton implements ITooltip
|
public class GuiProgressBar extends GuiButton implements ITooltip
|
||||||
|
@ -13,29 +14,33 @@ public class GuiProgressBar extends GuiButton implements ITooltip
|
||||||
HORIZONTAL, VERTICAL
|
HORIZONTAL, VERTICAL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IProgressProvider source;
|
||||||
private ResourceLocation texture;
|
private ResourceLocation texture;
|
||||||
private int fill_u;
|
private int fill_u;
|
||||||
private int fill_v;
|
private int fill_v;
|
||||||
private Direction layout;
|
private Direction layout;
|
||||||
|
|
||||||
public String FullMsg;
|
private String fullMsg;
|
||||||
|
private final String titleName;
|
||||||
|
|
||||||
public String TitleName;
|
public GuiProgressBar(IProgressProvider source, String texture, int posX, int posY, int u, int y, int _width, int _height, Direction dir)
|
||||||
public int current;
|
{
|
||||||
public int max;
|
this( source, texture, posX, posY, u, y, _width, _height, dir, null );
|
||||||
|
}
|
||||||
|
|
||||||
public GuiProgressBar(String string, int posX, int posY, int u, int y, int _width, int _height, Direction dir) {
|
public GuiProgressBar(IProgressProvider source, String texture, int posX, int posY, int u, int y, int _width, int _height, Direction dir, String title)
|
||||||
|
{
|
||||||
super( posX, posY, _width, "" );
|
super( posX, posY, _width, "" );
|
||||||
|
this.source = source;
|
||||||
this.xPosition = posX;
|
this.xPosition = posX;
|
||||||
this.yPosition = posY;
|
this.yPosition = posY;
|
||||||
texture = new ResourceLocation( "appliedenergistics2", "textures/" + string );
|
this.texture = new ResourceLocation( "appliedenergistics2", "textures/" + texture );
|
||||||
width = _width;
|
width = _width;
|
||||||
height = _height;
|
height = _height;
|
||||||
fill_u = u;
|
fill_u = u;
|
||||||
fill_v = y;
|
fill_v = y;
|
||||||
current = 0;
|
|
||||||
max = 100;
|
|
||||||
layout = dir;
|
layout = dir;
|
||||||
|
titleName = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -44,6 +49,8 @@ public class GuiProgressBar extends GuiButton implements ITooltip
|
||||||
if ( this.visible )
|
if ( this.visible )
|
||||||
{
|
{
|
||||||
par1Minecraft.getTextureManager().bindTexture( texture );
|
par1Minecraft.getTextureManager().bindTexture( texture );
|
||||||
|
int max = source.getMaxProgress();
|
||||||
|
int current = source.getCurrentProgress();
|
||||||
|
|
||||||
if ( layout == Direction.VERTICAL )
|
if ( layout == Direction.VERTICAL )
|
||||||
{
|
{
|
||||||
|
@ -60,13 +67,18 @@ public class GuiProgressBar extends GuiButton implements ITooltip
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFullMsg(String msg)
|
||||||
|
{
|
||||||
|
this.fullMsg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMsg()
|
public String getMsg()
|
||||||
{
|
{
|
||||||
if ( FullMsg != null )
|
if ( fullMsg != null )
|
||||||
return FullMsg;
|
return fullMsg;
|
||||||
|
|
||||||
return (TitleName != null ? TitleName : "") + "\n" + current + " " + GuiText.Of.getLocal() + " " + max;
|
return (titleName != null ? titleName : "") + "\n" + source.getCurrentProgress() + " " + GuiText.Of.getLocal() + " " + source.getMaxProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,12 +5,13 @@ import appeng.api.config.CondenserOutput;
|
||||||
import appeng.api.config.Settings;
|
import appeng.api.config.Settings;
|
||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
import appeng.container.guisync.GuiSync;
|
import appeng.container.guisync.GuiSync;
|
||||||
|
import appeng.container.interfaces.IProgressProvider;
|
||||||
import appeng.container.slot.SlotOutput;
|
import appeng.container.slot.SlotOutput;
|
||||||
import appeng.container.slot.SlotRestrictedInput;
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
import appeng.tile.misc.TileCondenser;
|
import appeng.tile.misc.TileCondenser;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
public class ContainerCondenser extends AEBaseContainer
|
public class ContainerCondenser extends AEBaseContainer implements IProgressProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
TileCondenser condenser;
|
TileCondenser condenser;
|
||||||
|
@ -52,4 +53,16 @@ public class ContainerCondenser extends AEBaseContainer
|
||||||
@GuiSync(2)
|
@GuiSync(2)
|
||||||
public CondenserOutput output = CondenserOutput.TRASH;
|
public CondenserOutput output = CondenserOutput.TRASH;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCurrentProgress()
|
||||||
|
{
|
||||||
|
return (int) storedPower;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxProgress()
|
||||||
|
{
|
||||||
|
return (int) requiredEnergy;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.container.guisync.GuiSync;
|
import appeng.container.guisync.GuiSync;
|
||||||
|
import appeng.container.interfaces.IProgressProvider;
|
||||||
import appeng.container.slot.SlotOutput;
|
import appeng.container.slot.SlotOutput;
|
||||||
import appeng.container.slot.SlotRestrictedInput;
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
import appeng.recipes.handlers.Inscribe;
|
import appeng.recipes.handlers.Inscribe;
|
||||||
|
@ -12,7 +13,7 @@ import appeng.recipes.handlers.Inscribe.InscriberRecipe;
|
||||||
import appeng.tile.misc.TileInscriber;
|
import appeng.tile.misc.TileInscriber;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
public class ContainerInscriber extends ContainerUpgradeable
|
public class ContainerInscriber extends ContainerUpgradeable implements IProgressProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
TileInscriber ti;
|
TileInscriber ti;
|
||||||
|
@ -157,4 +158,16 @@ public class ContainerInscriber extends ContainerUpgradeable
|
||||||
this.processingTime = ti.processingTime;
|
this.processingTime = ti.processingTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCurrentProgress()
|
||||||
|
{
|
||||||
|
return processingTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxProgress()
|
||||||
|
{
|
||||||
|
return maxProcessingTime;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import appeng.api.config.SecurityPermissions;
|
||||||
import appeng.api.config.Settings;
|
import appeng.api.config.Settings;
|
||||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||||
import appeng.container.guisync.GuiSync;
|
import appeng.container.guisync.GuiSync;
|
||||||
|
import appeng.container.interfaces.IProgressProvider;
|
||||||
import appeng.container.slot.SlotMACPattern;
|
import appeng.container.slot.SlotMACPattern;
|
||||||
import appeng.container.slot.SlotOutput;
|
import appeng.container.slot.SlotOutput;
|
||||||
import appeng.container.slot.SlotRestrictedInput;
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
|
@ -16,12 +17,14 @@ import appeng.items.misc.ItemEncodedPattern;
|
||||||
import appeng.tile.crafting.TileMolecularAssembler;
|
import appeng.tile.crafting.TileMolecularAssembler;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
public class ContainerMAC extends ContainerUpgradeable
|
public class ContainerMAC extends ContainerUpgradeable implements IProgressProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
TileMolecularAssembler tma;
|
TileMolecularAssembler tma;
|
||||||
|
private static final int MAX_CRAFT_PROGRESS = 100;
|
||||||
|
|
||||||
public ContainerMAC(InventoryPlayer ip, TileMolecularAssembler te) {
|
public ContainerMAC(InventoryPlayer ip, TileMolecularAssembler te)
|
||||||
|
{
|
||||||
super( ip, te );
|
super( ip, te );
|
||||||
tma = te;
|
tma = te;
|
||||||
}
|
}
|
||||||
|
@ -92,11 +95,16 @@ public class ContainerMAC extends ContainerUpgradeable
|
||||||
offY = 17;
|
offY = 17;
|
||||||
|
|
||||||
IInventory upgrades = upgradeable.getInventoryByName( "upgrades" );
|
IInventory upgrades = upgradeable.getInventoryByName( "upgrades" );
|
||||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8 + 18 * 0, invPlayer )).setNotDraggable() );
|
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8 + 18 * 0, invPlayer ))
|
||||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18 * 1, invPlayer )).setNotDraggable() );
|
.setNotDraggable() );
|
||||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, invPlayer )).setNotDraggable() );
|
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18 * 1, invPlayer ))
|
||||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, invPlayer )).setNotDraggable() );
|
.setNotDraggable() );
|
||||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, invPlayer )).setNotDraggable() );
|
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, invPlayer ))
|
||||||
|
.setNotDraggable() );
|
||||||
|
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, invPlayer ))
|
||||||
|
.setNotDraggable() );
|
||||||
|
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, invPlayer ))
|
||||||
|
.setNotDraggable() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -114,4 +122,16 @@ public class ContainerMAC extends ContainerUpgradeable
|
||||||
standardDetectAndSendChanges();
|
standardDetectAndSendChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCurrentProgress()
|
||||||
|
{
|
||||||
|
return craftProgress;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxProgress()
|
||||||
|
{
|
||||||
|
return MAX_CRAFT_PROGRESS;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,14 +3,16 @@ package appeng.container.implementations;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
import appeng.container.guisync.GuiSync;
|
import appeng.container.guisync.GuiSync;
|
||||||
|
import appeng.container.interfaces.IProgressProvider;
|
||||||
import appeng.container.slot.SlotRestrictedInput;
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
import appeng.tile.misc.TileVibrationChamber;
|
import appeng.tile.misc.TileVibrationChamber;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
public class ContainerVibrationChamber extends AEBaseContainer
|
public class ContainerVibrationChamber extends AEBaseContainer implements IProgressProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
TileVibrationChamber vibrationChamber;
|
TileVibrationChamber vibrationChamber;
|
||||||
|
private static final int MAX_BURN_TIME = 200;
|
||||||
|
|
||||||
public ContainerVibrationChamber(InventoryPlayer ip, TileVibrationChamber vibrationChamber) {
|
public ContainerVibrationChamber(InventoryPlayer ip, TileVibrationChamber vibrationChamber) {
|
||||||
super( ip, vibrationChamber, null );
|
super( ip, vibrationChamber, null );
|
||||||
|
@ -41,4 +43,16 @@ public class ContainerVibrationChamber extends AEBaseContainer
|
||||||
super.detectAndSendChanges();
|
super.detectAndSendChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCurrentProgress()
|
||||||
|
{
|
||||||
|
return burnProgress > 0 ? burnSpeed : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxProgress()
|
||||||
|
{
|
||||||
|
return MAX_BURN_TIME;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
package appeng.container.interfaces;
|
||||||
|
|
||||||
|
import appeng.client.gui.widgets.GuiProgressBar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface provides the data for anything simulating a progress.
|
||||||
|
*
|
||||||
|
* Its main use is in combination with the {@link GuiProgressBar}, which ensures to scale it to a percentage of 0 to
|
||||||
|
* 100.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IProgressProvider
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current value of the progress. It should cover a range from 0 to the max progress
|
||||||
|
*
|
||||||
|
* @return An int representing the current progress
|
||||||
|
*/
|
||||||
|
int getCurrentProgress();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The max value the progress.
|
||||||
|
*
|
||||||
|
* It is not limited to a value of 100 and can be scaled to fit the current needs. For example scaled down to
|
||||||
|
* decrease or scaled up to increase the precision.
|
||||||
|
*
|
||||||
|
* @return An int representing the max progress
|
||||||
|
*/
|
||||||
|
int getMaxProgress();
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue