2013-12-27 23:59:59 +01:00
|
|
|
package appeng.client.gui.implementations;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import net.minecraft.client.gui.GuiButton;
|
|
|
|
import net.minecraft.entity.player.InventoryPlayer;
|
2014-01-05 09:48:20 +01:00
|
|
|
|
|
|
|
import org.lwjgl.input.Mouse;
|
|
|
|
|
2013-12-27 23:59:59 +01:00
|
|
|
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;
|
2014-02-07 21:37:22 +01:00
|
|
|
import appeng.core.AELog;
|
2013-12-27 23:59:59 +01:00
|
|
|
import appeng.core.localization.GuiText;
|
2014-02-09 02:34:52 +01:00
|
|
|
import appeng.core.sync.network.NetworkHandler;
|
2013-12-27 23:59:59 +01:00
|
|
|
import appeng.core.sync.packets.PacketConfigButton;
|
|
|
|
import appeng.tile.misc.TileCondenser;
|
|
|
|
|
|
|
|
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 );
|
|
|
|
|
2014-01-05 09:48:20 +01:00
|
|
|
boolean backwards = Mouse.isButtonDown( 1 );
|
|
|
|
|
2013-12-27 23:59:59 +01:00
|
|
|
if ( mode == btn )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2014-02-09 02:34:52 +01:00
|
|
|
NetworkHandler.instance.sendToServer( new PacketConfigButton( Settings.CONDENSER_OUTPUT, backwards ) );
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
catch (IOException e)
|
|
|
|
{
|
2014-02-07 21:37:22 +01:00
|
|
|
AELog.error( e );
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@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)
|
|
|
|
{
|
2014-03-15 07:58:21 +01:00
|
|
|
fontRendererObj.drawString( getGuiDisplayName( GuiText.Condenser.getLocal() ), 8, 6, 4210752 );
|
2014-02-09 02:34:52 +01:00
|
|
|
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
2013-12-27 23:59:59 +01:00
|
|
|
|
|
|
|
mode.set( cvc.output );
|
2014-01-31 04:08:44 +01:00
|
|
|
mode.FillVar = "" + cvc.output.requiredPower;
|
|
|
|
|
2013-12-27 23:59:59 +01:00
|
|
|
pb.max = cvc.requiredEnergy;
|
|
|
|
pb.current = cvc.storedPower;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|