Applied-Energistics-2-tiler.../client/gui/implementations/GuiCondenser.java
2013-12-27 16:59:59 -06:00

82 lines
2.2 KiB
Java

package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.config.Settings;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiProgressBar;
import appeng.client.gui.widgets.GuiProgressBar.Direction;
import appeng.container.implementations.ContainerCondenser;
import appeng.core.localization.GuiText;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.tile.misc.TileCondenser;
import cpw.mods.fml.common.network.PacketDispatcher;
public class GuiCondenser extends AEBaseGui
{
ContainerCondenser cvc;
GuiProgressBar pb;
GuiImgButton mode;
public GuiCondenser(InventoryPlayer inventoryPlayer, TileCondenser te) {
super( new ContainerCondenser( inventoryPlayer, te ) );
cvc = (ContainerCondenser) inventorySlots;
this.ySize = 197;
}
@Override
protected void actionPerformed(GuiButton btn)
{
super.actionPerformed( btn );
if ( mode == btn )
{
try
{
PacketDispatcher.sendPacketToServer( (new PacketConfigButton( Settings.CONDENSER_OUTPUT )).getPacket() );
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
@Override
public void initGui()
{
super.initGui();
pb = new GuiProgressBar( "guis/condenser.png", 120 + guiLeft, 25 + guiTop, 178, 25, 6, 18, Direction.VERTICAL );
pb.TitleName = GuiText.StoredEnergy.getLocal();
mode = new GuiImgButton( 128 + guiLeft, 52 + guiTop, Settings.CONDENSER_OUTPUT, cvc.output );
this.buttonList.add( pb );
this.buttonList.add( mode );
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
bindTexture( "guis/condenser.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
fontRenderer.drawString( GuiText.Condenser.getLocal(), 8, 6, 4210752 );
fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
mode.set( cvc.output );
pb.max = cvc.requiredEnergy;
pb.current = cvc.storedPower;
}
}