Relocate Source to proper directory.
This commit is contained in:
@@ -0,0 +1,178 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.CopyMode;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.implementations.items.IUpgradeModule;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiToggleButton;
|
||||
import appeng.container.implementations.ContainerCellWorkbench;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.tile.misc.TileCellWorkbench;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class GuiCellWorkbench extends GuiUpgradeable
|
||||
{
|
||||
|
||||
ContainerCellWorkbench ccwb;
|
||||
TileCellWorkbench tcw;
|
||||
|
||||
GuiImgButton clear;
|
||||
GuiImgButton partition;
|
||||
GuiToggleButton copyMode;
|
||||
|
||||
public GuiCellWorkbench(InventoryPlayer inventoryPlayer, TileCellWorkbench te) {
|
||||
super( new ContainerCellWorkbench( inventoryPlayer, te ) );
|
||||
ccwb = (ContainerCellWorkbench) inventorySlots;
|
||||
ySize = 251;
|
||||
tcw = te;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean drawUpgrades()
|
||||
{
|
||||
return ccwb.availableUpgrades() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
handleButtonVisibility();
|
||||
|
||||
bindTexture( getBackground() );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, 211 - 34, ySize );
|
||||
if ( drawUpgrades() )
|
||||
{
|
||||
if ( ccwb.availableUpgrades() <= 8 )
|
||||
{
|
||||
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + ccwb.availableUpgrades() * 18 );
|
||||
this.drawTexturedModalRect( offsetX + 177, offsetY + (7 + (ccwb.availableUpgrades()) * 18), 177, 151, 35, 7 );
|
||||
}
|
||||
else if ( ccwb.availableUpgrades() <= 16 )
|
||||
{
|
||||
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + 8 * 18 );
|
||||
this.drawTexturedModalRect( offsetX + 177, offsetY + (7 + (8) * 18), 177, 151, 35, 7 );
|
||||
|
||||
int dx = ccwb.availableUpgrades() - 8;
|
||||
this.drawTexturedModalRect( offsetX + 177 + 27, offsetY, 186, 0, 35 - 8, 7 + dx * 18 );
|
||||
if ( dx == 8 )
|
||||
this.drawTexturedModalRect( offsetX + 177 + 27, offsetY + (7 + (dx) * 18), 186, 151, 35 - 8, 7 );
|
||||
else
|
||||
this.drawTexturedModalRect( offsetX + 177 + 27 + 4, offsetY + (7 + (dx) * 18), 186 + 4, 151, 35 - 8, 7 );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + 8 * 18 );
|
||||
this.drawTexturedModalRect( offsetX + 177, offsetY + (7 + (8) * 18), 177, 151, 35, 7 );
|
||||
|
||||
this.drawTexturedModalRect( offsetX + 177 + 27, offsetY, 186, 0, 35 - 8, 7 + 8 * 18 );
|
||||
this.drawTexturedModalRect( offsetX + 177 + 27, offsetY + (7 + (8) * 18), 186, 151, 35 - 8, 7 );
|
||||
|
||||
int dx = ccwb.availableUpgrades() - 16;
|
||||
this.drawTexturedModalRect( offsetX + 177 + 27 + 18, offsetY, 186, 0, 35 - 8, 7 + dx * 18 );
|
||||
if ( dx == 8 )
|
||||
this.drawTexturedModalRect( offsetX + 177 + 27 + 18, offsetY + (7 + (dx) * 18), 186, 151, 35 - 8, 7 );
|
||||
else
|
||||
this.drawTexturedModalRect( offsetX + 177 + 27 + 18 + 4, offsetY + (7 + (dx) * 18), 186 + 4, 151, 35 - 8, 7 );
|
||||
}
|
||||
}
|
||||
if ( hasToolbox() )
|
||||
this.drawTexturedModalRect( offsetX + 178, offsetY + ySize - 90, 178, 161, 68, 68 );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( btn == copyMode )
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "CellWorkbench.Action", "CopyMode" ) );
|
||||
}
|
||||
else if ( btn == partition )
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "CellWorkbench.Action", "Partition" ) );
|
||||
}
|
||||
else if ( btn == clear )
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "CellWorkbench.Action", "Clear" ) );
|
||||
}
|
||||
else if ( btn == fuzzyMode )
|
||||
{
|
||||
boolean backwards = Mouse.isButtonDown( 1 );
|
||||
|
||||
FuzzyMode fz = (FuzzyMode) fuzzyMode.getCurrentValue();
|
||||
fz = Platform.rotateEnum( fz, backwards, Settings.FUZZY_MODE.getPossibleValues() );
|
||||
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "CellWorkbench.Fuzzy", fz.name() ) );
|
||||
}
|
||||
else
|
||||
super.actionPerformed( btn );
|
||||
}
|
||||
catch (IOException err)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addButtons()
|
||||
{
|
||||
clear = new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.ACTIONS, ActionItems.CLOSE );
|
||||
partition = new GuiImgButton( this.guiLeft - 18, guiTop + 28, Settings.ACTIONS, ActionItems.WRENCH );
|
||||
copyMode = new GuiToggleButton( this.guiLeft - 18, guiTop + 48, 11 * 16 + 5, 12 * 16 + 5, GuiText.CopyMode.getLocal(), GuiText.CopyModeDesc.getLocal() );
|
||||
fuzzyMode = new GuiImgButton( this.guiLeft - 18, guiTop + 68, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
||||
|
||||
buttonList.add( fuzzyMode );
|
||||
buttonList.add( partition );
|
||||
buttonList.add( clear );
|
||||
buttonList.add( copyMode );
|
||||
}
|
||||
|
||||
protected void handleButtonVisibility()
|
||||
{
|
||||
copyMode.setState( ccwb.copyMode == CopyMode.CLEAR_ON_REMOVE );
|
||||
|
||||
boolean hasFuzzy = false;
|
||||
IInventory inv = ccwb.getCellUpgradeInventory();
|
||||
for (int x = 0; x < inv.getSizeInventory(); x++)
|
||||
{
|
||||
ItemStack is = inv.getStackInSlot( x );
|
||||
if ( is != null && is.getItem() instanceof IUpgradeModule )
|
||||
{
|
||||
if ( ((IUpgradeModule) is.getItem()).getType( is ) == Upgrades.FUZZY )
|
||||
hasFuzzy = true;
|
||||
}
|
||||
}
|
||||
fuzzyMode.setVisibility( hasFuzzy );
|
||||
}
|
||||
|
||||
protected String getBackground()
|
||||
{
|
||||
return "guis/cellworkbench.png";
|
||||
}
|
||||
|
||||
protected GuiText getName()
|
||||
{
|
||||
return GuiText.CellWorkbench;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.container.implementations.ContainerChest;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||
import appeng.tile.storage.TileChest;
|
||||
|
||||
public class GuiChest extends AEBaseGui
|
||||
{
|
||||
|
||||
GuiTabButton priority;
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton)
|
||||
{
|
||||
super.actionPerformed( par1GuiButton );
|
||||
|
||||
if ( par1GuiButton == priority )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
buttonList.add( priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), itemRender ) );
|
||||
}
|
||||
|
||||
public GuiChest(InventoryPlayer inventoryPlayer, TileChest te) {
|
||||
super( new ContainerChest( inventoryPlayer, te ) );
|
||||
this.ySize = 166;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/chest.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString( getGuiDisplayName( GuiText.Chest.getLocal() ), 8, 6, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
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.AELog;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
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 );
|
||||
|
||||
boolean backwards = Mouse.isButtonDown( 1 );
|
||||
|
||||
if ( mode == btn )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketConfigButton( Settings.CONDENSER_OUTPUT, backwards ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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)
|
||||
{
|
||||
fontRendererObj.drawString( getGuiDisplayName( GuiText.Condenser.getLocal() ), 8, 6, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
|
||||
mode.set( cvc.output );
|
||||
mode.FillVar = "" + cvc.output.requiredPower;
|
||||
|
||||
pb.max = (int) cvc.requiredEnergy;
|
||||
pb.current = (int) cvc.storedPower;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiNumberBox;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.implementations.ContainerCraftAmount;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketCraftRequest;
|
||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||
import appeng.helpers.WirelessTerminalGuiObject;
|
||||
import appeng.parts.reporting.PartCraftingTerminal;
|
||||
import appeng.parts.reporting.PartPatternTerminal;
|
||||
import appeng.parts.reporting.PartTerminal;
|
||||
|
||||
public class GuiCraftAmount extends AEBaseGui
|
||||
{
|
||||
|
||||
GuiNumberBox amountToCraft;
|
||||
GuiTabButton originalGuiBtn;
|
||||
|
||||
GuiButton next;
|
||||
|
||||
GuiButton plus1, plus10, plus100, plus1000;
|
||||
GuiButton minus1, minus10, minus100, minus1000;
|
||||
|
||||
GuiBridge OriginalGui;
|
||||
|
||||
public GuiCraftAmount(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||
super( new ContainerCraftAmount( inventoryPlayer, te ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
int a = AEConfig.instance.craftItemsByStackAmounts( 0 );
|
||||
int b = AEConfig.instance.craftItemsByStackAmounts( 1 );
|
||||
int c = AEConfig.instance.craftItemsByStackAmounts( 2 );
|
||||
int d = AEConfig.instance.craftItemsByStackAmounts( 3 );
|
||||
|
||||
buttonList.add( plus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 26, 22, 20, "+" + a ) );
|
||||
buttonList.add( plus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 26, 28, 20, "+" + b ) );
|
||||
buttonList.add( plus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 26, 32, 20, "+" + c ) );
|
||||
buttonList.add( plus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 26, 38, 20, "+" + d ) );
|
||||
|
||||
buttonList.add( minus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 75, 22, 20, "-" + a ) );
|
||||
buttonList.add( minus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 75, 28, 20, "-" + b ) );
|
||||
buttonList.add( minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 75, 32, 20, "-" + c ) );
|
||||
buttonList.add( minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 75, 38, 20, "-" + d ) );
|
||||
|
||||
buttonList.add( next = new GuiButton( 0, this.guiLeft + 128, this.guiTop + 51, 38, 20, GuiText.Next.getLocal() ) );
|
||||
|
||||
ItemStack myIcon = null;
|
||||
Object target = ((AEBaseContainer) inventorySlots).getTarget();
|
||||
|
||||
if ( target instanceof WirelessTerminalGuiObject )
|
||||
{
|
||||
myIcon = AEApi.instance().items().itemWirelessTerminal.stack( 1 );
|
||||
OriginalGui = GuiBridge.GUI_WIRELESS_TERM;
|
||||
}
|
||||
|
||||
if ( target instanceof PartTerminal )
|
||||
{
|
||||
myIcon = AEApi.instance().parts().partTerminal.stack( 1 );
|
||||
OriginalGui = GuiBridge.GUI_ME;
|
||||
}
|
||||
|
||||
if ( target instanceof PartCraftingTerminal )
|
||||
{
|
||||
myIcon = AEApi.instance().parts().partCraftingTerminal.stack( 1 );
|
||||
OriginalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
|
||||
}
|
||||
|
||||
if ( target instanceof PartPatternTerminal )
|
||||
{
|
||||
myIcon = AEApi.instance().parts().partPatternTerminal.stack( 1 );
|
||||
OriginalGui = GuiBridge.GUI_PATTERN_TERMINAL;
|
||||
}
|
||||
|
||||
if ( OriginalGui != null )
|
||||
buttonList.add( originalGuiBtn = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender ) );
|
||||
|
||||
amountToCraft = new GuiNumberBox( fontRendererObj, this.guiLeft + 62, this.guiTop + 57, 59, fontRendererObj.FONT_HEIGHT, Integer.class );
|
||||
amountToCraft.setEnableBackgroundDrawing( false );
|
||||
amountToCraft.setMaxStringLength( 16 );
|
||||
amountToCraft.setTextColor( 0xFFFFFF );
|
||||
amountToCraft.setVisible( true );
|
||||
amountToCraft.setFocused( true );
|
||||
amountToCraft.setText( "1" );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
if ( btn == originalGuiBtn )
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( OriginalGui ) );
|
||||
}
|
||||
|
||||
if ( btn == next )
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketCraftRequest( Integer.parseInt( this.amountToCraft.getText() ), isShiftKeyDown() ) );
|
||||
}
|
||||
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
// nope..
|
||||
amountToCraft.setText( "1" );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
|
||||
boolean isPlus = btn == plus1 || btn == plus10 || btn == plus100 || btn == plus1000;
|
||||
boolean isMinus = btn == minus1 || btn == minus10 || btn == minus100 || btn == minus1000;
|
||||
|
||||
if ( isPlus || isMinus )
|
||||
addQty( getQty( btn ) );
|
||||
}
|
||||
|
||||
private void addQty(int i)
|
||||
{
|
||||
try
|
||||
{
|
||||
String Out = amountToCraft.getText();
|
||||
|
||||
boolean Fixed = false;
|
||||
while (Out.startsWith( "0" ) && Out.length() > 1)
|
||||
{
|
||||
Out = Out.substring( 1 );
|
||||
Fixed = true;
|
||||
}
|
||||
|
||||
if ( Fixed )
|
||||
amountToCraft.setText( Out );
|
||||
|
||||
if ( Out.length() == 0 )
|
||||
Out = "0";
|
||||
|
||||
long result = Integer.parseInt( Out );
|
||||
|
||||
if ( result == 1 && i > 1 )
|
||||
result = 0;
|
||||
|
||||
result += i;
|
||||
if ( result < 1 )
|
||||
result = 1;
|
||||
|
||||
Out = Long.toString( result );
|
||||
Integer.parseInt( Out );
|
||||
amountToCraft.setText( Out );
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
// :P
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char character, int key)
|
||||
{
|
||||
if ( !this.checkHotbarKeys( key ) )
|
||||
{
|
||||
if ( key == 28 )
|
||||
{
|
||||
actionPerformed( next );
|
||||
}
|
||||
if ( (key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit( character ))
|
||||
&& amountToCraft.textboxKeyTyped( character, key ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
String Out = amountToCraft.getText();
|
||||
|
||||
boolean Fixed = false;
|
||||
while (Out.startsWith( "0" ) && Out.length() > 1)
|
||||
{
|
||||
Out = Out.substring( 1 );
|
||||
Fixed = true;
|
||||
}
|
||||
|
||||
if ( Fixed )
|
||||
amountToCraft.setText( Out );
|
||||
|
||||
if ( Out.length() == 0 )
|
||||
Out = "0";
|
||||
|
||||
long result = Long.parseLong( Out );
|
||||
if ( result < 0 )
|
||||
{
|
||||
amountToCraft.setText( "1" );
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
// :P
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.keyTyped( character, key );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
next.displayString = isShiftKeyDown() ? GuiText.Start.getLocal() : GuiText.Next.getLocal();
|
||||
|
||||
bindTexture( "guis/craftAmt.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
|
||||
try
|
||||
{
|
||||
Long.parseLong( amountToCraft.getText() );
|
||||
next.enabled = amountToCraft.getText().length() > 0;
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
next.enabled = false;
|
||||
}
|
||||
|
||||
amountToCraft.drawTextBox();
|
||||
}
|
||||
|
||||
protected String getBackground()
|
||||
{
|
||||
return "guis/craftAmt.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString( GuiText.SelectAmount.getLocal(), 8, 6, 4210752 );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,519 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
import appeng.container.implementations.ContainerCraftConfirm;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.helpers.WirelessTerminalGuiObject;
|
||||
import appeng.parts.reporting.PartCraftingTerminal;
|
||||
import appeng.parts.reporting.PartPatternTerminal;
|
||||
import appeng.parts.reporting.PartTerminal;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
|
||||
public class GuiCraftConfirm extends AEBaseGui
|
||||
{
|
||||
|
||||
ContainerCraftConfirm ccc;
|
||||
|
||||
int rows = 5;
|
||||
|
||||
IItemList<IAEItemStack> storage = AEApi.instance().storage().createItemList();
|
||||
IItemList<IAEItemStack> pending = AEApi.instance().storage().createItemList();
|
||||
IItemList<IAEItemStack> missing = AEApi.instance().storage().createItemList();
|
||||
|
||||
List<IAEItemStack> visual = new ArrayList();
|
||||
|
||||
GuiBridge OriginalGui;
|
||||
|
||||
boolean isAutoStart()
|
||||
{
|
||||
return ((ContainerCraftConfirm) inventorySlots).autoStart;
|
||||
}
|
||||
|
||||
boolean isSimulation()
|
||||
{
|
||||
return ((ContainerCraftConfirm) inventorySlots).simulation;
|
||||
}
|
||||
|
||||
public GuiCraftConfirm(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||
super( new ContainerCraftConfirm( inventoryPlayer, te ) );
|
||||
xSize = 238;
|
||||
ySize = 206;
|
||||
myScrollBar = new GuiScrollbar();
|
||||
|
||||
ccc = (ContainerCraftConfirm) this.inventorySlots;
|
||||
|
||||
if ( te instanceof WirelessTerminalGuiObject )
|
||||
OriginalGui = GuiBridge.GUI_WIRELESS_TERM;
|
||||
|
||||
if ( te instanceof PartTerminal )
|
||||
OriginalGui = GuiBridge.GUI_ME;
|
||||
|
||||
if ( te instanceof PartCraftingTerminal )
|
||||
OriginalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
|
||||
|
||||
if ( te instanceof PartPatternTerminal )
|
||||
OriginalGui = GuiBridge.GUI_PATTERN_TERMINAL;
|
||||
|
||||
}
|
||||
|
||||
GuiButton cancel;
|
||||
GuiButton start;
|
||||
GuiButton selectcpu;
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
start = new GuiButton( 0, this.guiLeft + 162, this.guiTop + ySize - 25, 50, 20, GuiText.Start.getLocal() );
|
||||
start.enabled = false;
|
||||
buttonList.add( start );
|
||||
|
||||
selectcpu = new GuiButton( 0, this.guiLeft + (219 - 180) / 2, this.guiTop + ySize - 68, 180, 20, GuiText.CraftingCPU.getLocal() + ": "
|
||||
+ GuiText.Automatic );
|
||||
selectcpu.enabled = false;
|
||||
buttonList.add( selectcpu );
|
||||
|
||||
if ( OriginalGui != null )
|
||||
cancel = new GuiButton( 0, this.guiLeft + 6, this.guiTop + ySize - 25, 50, 20, GuiText.Cancel.getLocal() );
|
||||
|
||||
buttonList.add( cancel );
|
||||
}
|
||||
|
||||
private void updateCPUButtonText()
|
||||
{
|
||||
String btnTextText = GuiText.CraftingCPU.getLocal() + ": " + GuiText.Automatic.getLocal();
|
||||
if ( ccc.selectedCpu >= 0 )// && ccc.selectedCpu < ccc.cpus.size() )
|
||||
{
|
||||
if ( ccc.myName.length() > 0 )
|
||||
{
|
||||
String name = ccc.myName.substring( 0, Math.min( 20, ccc.myName.length() ) );
|
||||
btnTextText = GuiText.CraftingCPU.getLocal() + ": " + name;
|
||||
}
|
||||
else
|
||||
btnTextText = GuiText.CraftingCPU.getLocal() + ": #" + ccc.selectedCpu;
|
||||
}
|
||||
|
||||
if ( ccc.noCPU )
|
||||
btnTextText = GuiText.NoCraftingCPUs.getLocal();
|
||||
|
||||
selectcpu.displayString = btnTextText;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
boolean backwards = Mouse.isButtonDown( 1 );
|
||||
|
||||
if ( btn == selectcpu )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "Terminal.Cpu", backwards ? "Prev" : "Next" ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
|
||||
if ( btn == cancel )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( OriginalGui ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
|
||||
if ( btn == start )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "Terminal.Start", "Start" ) );
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private long getTotal(IAEItemStack is)
|
||||
{
|
||||
IAEItemStack a = storage.findPrecise( is );
|
||||
IAEItemStack c = pending.findPrecise( is );
|
||||
IAEItemStack m = missing.findPrecise( is );
|
||||
|
||||
long total = 0;
|
||||
|
||||
if ( a != null )
|
||||
total += a.getStackSize();
|
||||
|
||||
if ( c != null )
|
||||
total += c.getStackSize();
|
||||
|
||||
if ( m != null )
|
||||
total += m.getStackSize();
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
public void postUpdate(List<IAEItemStack> list, byte ref)
|
||||
{
|
||||
switch (ref)
|
||||
{
|
||||
case 0:
|
||||
for (IAEItemStack l : list)
|
||||
handleInput( storage, l );
|
||||
break;
|
||||
|
||||
case 1:
|
||||
for (IAEItemStack l : list)
|
||||
handleInput( pending, l );
|
||||
break;
|
||||
|
||||
case 2:
|
||||
for (IAEItemStack l : list)
|
||||
handleInput( missing, l );
|
||||
break;
|
||||
}
|
||||
|
||||
for (IAEItemStack l : list)
|
||||
{
|
||||
long amt = getTotal( l );
|
||||
|
||||
if ( amt <= 0 )
|
||||
deleteVisualStack( l );
|
||||
else
|
||||
{
|
||||
IAEItemStack is = findVisualStack( l );
|
||||
is.setStackSize( amt );
|
||||
}
|
||||
}
|
||||
|
||||
setScrollBar();
|
||||
}
|
||||
|
||||
private void handleInput(IItemList<IAEItemStack> s, IAEItemStack l)
|
||||
{
|
||||
IAEItemStack a = s.findPrecise( l );
|
||||
|
||||
if ( l.getStackSize() <= 0 )
|
||||
{
|
||||
if ( a != null )
|
||||
a.reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( a == null )
|
||||
{
|
||||
s.add( l.copy() );
|
||||
a = s.findPrecise( l );
|
||||
}
|
||||
|
||||
if ( a != null )
|
||||
a.setStackSize( l.getStackSize() );
|
||||
}
|
||||
}
|
||||
|
||||
private IAEItemStack findVisualStack(IAEItemStack l)
|
||||
{
|
||||
Iterator<IAEItemStack> i = visual.iterator();
|
||||
while (i.hasNext())
|
||||
{
|
||||
IAEItemStack o = i.next();
|
||||
if ( o.equals( l ) )
|
||||
return o;
|
||||
}
|
||||
|
||||
IAEItemStack stack = l.copy();
|
||||
visual.add( stack );
|
||||
return stack;
|
||||
}
|
||||
|
||||
private void deleteVisualStack(IAEItemStack l)
|
||||
{
|
||||
Iterator<IAEItemStack> i = visual.iterator();
|
||||
while (i.hasNext())
|
||||
{
|
||||
IAEItemStack o = i.next();
|
||||
if ( o.equals( l ) )
|
||||
{
|
||||
i.remove();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setScrollBar()
|
||||
{
|
||||
int size = visual.size();
|
||||
|
||||
myScrollBar.setTop( 19 ).setLeft( 218 ).setHeight( 114 );
|
||||
myScrollBar.setRange( 0, (size + 2) / 3 - rows, 1 );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char character, int key)
|
||||
{
|
||||
if ( !this.checkHotbarKeys( key ) )
|
||||
{
|
||||
if ( key == 28 )
|
||||
{
|
||||
actionPerformed( start );
|
||||
}
|
||||
super.keyTyped( character, key );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
setScrollBar();
|
||||
bindTexture( "guis/craftingreport.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
}
|
||||
|
||||
int tooltip = -1;
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouse_x, int mouse_y, float btn)
|
||||
{
|
||||
updateCPUButtonText();
|
||||
|
||||
start.enabled = ccc.noCPU || isSimulation() ? false : true;
|
||||
selectcpu.enabled = isSimulation() ? false : true;
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
||||
int gx = (width - xSize) / 2;
|
||||
int gy = (height - ySize) / 2;
|
||||
int yoff = 23;
|
||||
|
||||
tooltip = -1;
|
||||
|
||||
for (int z = 0; z <= 4 * 5; z++)
|
||||
{
|
||||
int minX = gx + 9 + x * 67;
|
||||
int minY = gy + 22 + y * yoff;
|
||||
|
||||
if ( minX < mouse_x && minX + 67 > mouse_x )
|
||||
{
|
||||
if ( minY < mouse_y && minY + yoff - 2 > mouse_y )
|
||||
{
|
||||
tooltip = z;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
x++;
|
||||
|
||||
if ( x > 2 )
|
||||
{
|
||||
y++;
|
||||
x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
super.drawScreen( mouse_x, mouse_y, btn );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
long BytesUsed = ccc.bytesUsed;
|
||||
String byteUsed = NumberFormat.getInstance().format( BytesUsed );
|
||||
String Add = BytesUsed > 0 ? (byteUsed + " " + GuiText.BytesUsed.getLocal()) : GuiText.CalculatingWait.getLocal();
|
||||
fontRendererObj.drawString( GuiText.CraftingPlan.getLocal() + " - " + Add, 8, 7, 4210752 );
|
||||
|
||||
String dsp = null;
|
||||
|
||||
if ( isSimulation() )
|
||||
dsp = GuiText.Simulation.getLocal();
|
||||
else
|
||||
dsp = ccc.cpuBytesAvail > 0 ? (GuiText.Bytes.getLocal() + ": " + ccc.cpuBytesAvail + " : " + GuiText.CoProcessors.getLocal() + ": " + ccc.cpuCoProcessors)
|
||||
: GuiText.Bytes.getLocal() + ": N/A : " + GuiText.CoProcessors.getLocal() + ": N/A";
|
||||
|
||||
int offset = (219 - fontRendererObj.getStringWidth( dsp )) / 2;
|
||||
fontRendererObj.drawString( dsp, offset, 165, 4210752 );
|
||||
|
||||
int sectionLength = 67;
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int xo = 0 + 9;
|
||||
int yo = 0 + 22;
|
||||
int viewStart = myScrollBar.getCurrentScroll() * 3;
|
||||
int viewEnd = viewStart + 3 * rows;
|
||||
|
||||
String dspToolTip = "";
|
||||
List<String> lineList = new LinkedList();
|
||||
int toolPosX = 0;
|
||||
int toolPosY = 0;
|
||||
|
||||
int offY = 23;
|
||||
|
||||
for (int z = viewStart; z < Math.min( viewEnd, visual.size() ); z++)
|
||||
{
|
||||
IAEItemStack refStack = visual.get( z );// repo.getReferenceItem( z );
|
||||
if ( refStack != null )
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScaled( 0.5, 0.5, 0.5 );
|
||||
|
||||
IAEItemStack stored = storage.findPrecise( refStack );
|
||||
IAEItemStack pendingStack = pending.findPrecise( refStack );
|
||||
IAEItemStack missingStack = missing.findPrecise( refStack );
|
||||
|
||||
int lines = 0;
|
||||
|
||||
if ( stored != null && stored.getStackSize() > 0 )
|
||||
lines++;
|
||||
if ( pendingStack != null && pendingStack.getStackSize() > 0 )
|
||||
lines++;
|
||||
if ( pendingStack != null && pendingStack.getStackSize() > 0 )
|
||||
lines++;
|
||||
|
||||
int negY = ((lines - 1) * 5) / 2;
|
||||
int downY = 0;
|
||||
boolean red = false;
|
||||
|
||||
if ( stored != null && stored.getStackSize() > 0 )
|
||||
{
|
||||
String str = Long.toString( stored.getStackSize() );
|
||||
if ( stored.getStackSize() >= 10000 )
|
||||
str = Long.toString( stored.getStackSize() / 1000 ) + "k";
|
||||
if ( stored.getStackSize() >= 10000000 )
|
||||
str = Long.toString( stored.getStackSize() / 1000000 ) + "m";
|
||||
|
||||
str = GuiText.FromStorage.getLocal() + ": " + str;
|
||||
int w = 4 + fontRendererObj.getStringWidth( str );
|
||||
fontRendererObj.drawString( str, (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - ((float) w * 0.5)) * 2), (int) ((y * offY + yo
|
||||
+ 6 - negY + downY) * 2), 4210752 );
|
||||
|
||||
if ( tooltip == z - viewStart )
|
||||
lineList.add( GuiText.FromStorage.getLocal() + ": " + Long.toString( stored.getStackSize() ) );
|
||||
|
||||
downY += 5;
|
||||
}
|
||||
|
||||
if ( missingStack != null && missingStack.getStackSize() > 0 )
|
||||
{
|
||||
String str = Long.toString( missingStack.getStackSize() );
|
||||
if ( missingStack.getStackSize() >= 10000 )
|
||||
str = Long.toString( missingStack.getStackSize() / 1000 ) + "k";
|
||||
if ( missingStack.getStackSize() >= 10000000 )
|
||||
str = Long.toString( missingStack.getStackSize() / 1000000 ) + "m";
|
||||
|
||||
str = GuiText.Missing.getLocal() + ": " + str;
|
||||
int w = 4 + fontRendererObj.getStringWidth( str );
|
||||
fontRendererObj.drawString( str, (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - ((float) w * 0.5)) * 2), (int) ((y * offY + yo
|
||||
+ 6 - negY + downY) * 2), 4210752 );
|
||||
|
||||
if ( tooltip == z - viewStart )
|
||||
lineList.add( GuiText.Missing.getLocal() + ": " + Long.toString( missingStack.getStackSize() ) );
|
||||
|
||||
red = true;
|
||||
downY += 5;
|
||||
}
|
||||
|
||||
if ( pendingStack != null && pendingStack.getStackSize() > 0 )
|
||||
{
|
||||
String str = Long.toString( pendingStack.getStackSize() );
|
||||
if ( pendingStack.getStackSize() >= 10000 )
|
||||
str = Long.toString( pendingStack.getStackSize() / 1000 ) + "k";
|
||||
if ( pendingStack.getStackSize() >= 10000000 )
|
||||
str = Long.toString( pendingStack.getStackSize() / 1000000 ) + "m";
|
||||
|
||||
str = GuiText.ToCraft.getLocal() + ": " + str;
|
||||
int w = 4 + fontRendererObj.getStringWidth( str );
|
||||
fontRendererObj.drawString( str, (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - ((float) w * 0.5)) * 2), (int) ((y * offY + yo
|
||||
+ 6 - negY + downY) * 2), 4210752 );
|
||||
|
||||
if ( tooltip == z - viewStart )
|
||||
lineList.add( GuiText.ToCraft.getLocal() + ": " + Long.toString( pendingStack.getStackSize() ) );
|
||||
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
int posX = x * (1 + sectionLength) + xo + sectionLength - 19;
|
||||
int posY = y * offY + yo;
|
||||
|
||||
ItemStack is = refStack.copy().getItemStack();
|
||||
|
||||
if ( tooltip == z - viewStart )
|
||||
{
|
||||
dspToolTip = Platform.getItemDisplayName( is );
|
||||
|
||||
if ( lineList.size() > 0 )
|
||||
dspToolTip = dspToolTip + "\n" + Joiner.on( "\n" ).join( lineList );
|
||||
|
||||
toolPosX = x * (1 + sectionLength) + xo + sectionLength - 8;
|
||||
toolPosY = y * offY + yo;
|
||||
}
|
||||
|
||||
drawItem( posX, posY, is );
|
||||
|
||||
if ( red )
|
||||
{
|
||||
int startX = x * (1 + sectionLength) + xo;
|
||||
int startY = posY - 4;
|
||||
drawRect( startX, startY, startX + sectionLength, startY + offY, 0x1AFF0000 );
|
||||
}
|
||||
|
||||
x++;
|
||||
|
||||
if ( x > 2 )
|
||||
{
|
||||
y++;
|
||||
x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( tooltip >= 0 && dspToolTip.length() > 0 )
|
||||
{
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
drawTooltip( toolPosX, toolPosY + 10, 0, dspToolTip );
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,415 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.SortDir;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.ViewItems;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.container.implementations.ContainerCraftingCPU;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
|
||||
public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
{
|
||||
|
||||
int rows = 6;
|
||||
|
||||
IItemList<IAEItemStack> storage = AEApi.instance().storage().createItemList();
|
||||
IItemList<IAEItemStack> active = AEApi.instance().storage().createItemList();
|
||||
IItemList<IAEItemStack> pending = AEApi.instance().storage().createItemList();
|
||||
|
||||
List<IAEItemStack> visual = new ArrayList();
|
||||
|
||||
public void clearItems()
|
||||
{
|
||||
storage = AEApi.instance().storage().createItemList();
|
||||
active = AEApi.instance().storage().createItemList();
|
||||
pending = AEApi.instance().storage().createItemList();
|
||||
visual = new ArrayList();
|
||||
}
|
||||
|
||||
protected GuiCraftingCPU(ContainerCraftingCPU container) {
|
||||
super( container );
|
||||
this.ySize = 184;
|
||||
this.xSize = 238;
|
||||
myScrollBar = new GuiScrollbar();
|
||||
}
|
||||
|
||||
public GuiCraftingCPU(InventoryPlayer inventoryPlayer, Object te) {
|
||||
this( new ContainerCraftingCPU( inventoryPlayer, te ) );
|
||||
}
|
||||
|
||||
GuiButton cancel;
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
if ( cancel == btn )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "TileCrafting.Cancel", "Cancel" ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
setScrollBar();
|
||||
cancel = new GuiButton( 0, this.guiLeft + 163, this.guiTop + ySize - 25, 50, 20, GuiText.Cancel.getLocal() );
|
||||
buttonList.add( cancel );
|
||||
}
|
||||
|
||||
private long getTotal(IAEItemStack is)
|
||||
{
|
||||
IAEItemStack a = storage.findPrecise( is );
|
||||
IAEItemStack b = active.findPrecise( is );
|
||||
IAEItemStack c = pending.findPrecise( is );
|
||||
|
||||
long total = 0;
|
||||
|
||||
if ( a != null )
|
||||
total += a.getStackSize();
|
||||
|
||||
if ( b != null )
|
||||
total += b.getStackSize();
|
||||
|
||||
if ( c != null )
|
||||
total += c.getStackSize();
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
public void postUpdate(List<IAEItemStack> list, byte ref)
|
||||
{
|
||||
switch (ref)
|
||||
{
|
||||
case 0:
|
||||
for (IAEItemStack l : list)
|
||||
handleInput( storage, l );
|
||||
break;
|
||||
|
||||
case 1:
|
||||
for (IAEItemStack l : list)
|
||||
handleInput( active, l );
|
||||
break;
|
||||
|
||||
case 2:
|
||||
for (IAEItemStack l : list)
|
||||
handleInput( pending, l );
|
||||
break;
|
||||
}
|
||||
|
||||
for (IAEItemStack l : list)
|
||||
{
|
||||
long amt = getTotal( l );
|
||||
|
||||
if ( amt <= 0 )
|
||||
deleteVisualStack( l );
|
||||
else
|
||||
{
|
||||
IAEItemStack is = findVisualStack( l );
|
||||
is.setStackSize( amt );
|
||||
}
|
||||
}
|
||||
|
||||
setScrollBar();
|
||||
}
|
||||
|
||||
private void handleInput(IItemList<IAEItemStack> s, IAEItemStack l)
|
||||
{
|
||||
IAEItemStack a = s.findPrecise( l );
|
||||
|
||||
if ( l.getStackSize() <= 0 )
|
||||
{
|
||||
if ( a != null )
|
||||
a.reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( a == null )
|
||||
{
|
||||
s.add( l.copy() );
|
||||
a = s.findPrecise( l );
|
||||
}
|
||||
|
||||
if ( a != null )
|
||||
a.setStackSize( l.getStackSize() );
|
||||
}
|
||||
}
|
||||
|
||||
private IAEItemStack findVisualStack(IAEItemStack l)
|
||||
{
|
||||
Iterator<IAEItemStack> i = visual.iterator();
|
||||
while (i.hasNext())
|
||||
{
|
||||
IAEItemStack o = i.next();
|
||||
if ( o.equals( l ) )
|
||||
return o;
|
||||
}
|
||||
|
||||
IAEItemStack stack = l.copy();
|
||||
visual.add( stack );
|
||||
return stack;
|
||||
}
|
||||
|
||||
private void deleteVisualStack(IAEItemStack l)
|
||||
{
|
||||
Iterator<IAEItemStack> i = visual.iterator();
|
||||
while (i.hasNext())
|
||||
{
|
||||
IAEItemStack o = i.next();
|
||||
if ( o.equals( l ) )
|
||||
{
|
||||
i.remove();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setScrollBar()
|
||||
{
|
||||
int size = visual.size();
|
||||
|
||||
myScrollBar.setTop( 19 ).setLeft( 218 ).setHeight( 137 );
|
||||
myScrollBar.setRange( 0, (size + 2) / 3 - rows, 1 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/craftingcpu.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
}
|
||||
|
||||
int tooltip = -1;
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouse_x, int mouse_y, float btn)
|
||||
{
|
||||
cancel.enabled = !visual.isEmpty();
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
||||
int gx = (width - xSize) / 2;
|
||||
int gy = (height - ySize) / 2;
|
||||
int yoff = 23;
|
||||
|
||||
tooltip = -1;
|
||||
|
||||
for (int z = 0; z <= 4 * 5; z++)
|
||||
{
|
||||
int minX = gx + 9 + x * 67;
|
||||
int minY = gy + 22 + y * yoff;
|
||||
|
||||
if ( minX < mouse_x && minX + 67 > mouse_x )
|
||||
{
|
||||
if ( minY < mouse_y && minY + yoff - 2 > mouse_y )
|
||||
{
|
||||
tooltip = z;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
x++;
|
||||
|
||||
if ( x > 2 )
|
||||
{
|
||||
y++;
|
||||
x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
super.drawScreen( mouse_x, mouse_y, btn );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString( getGuiDisplayName( GuiText.CraftingStatus.getLocal() ), 8, 7, 4210752 );
|
||||
|
||||
int sectionLength = 67;
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int xo = 0 + 9;
|
||||
int yo = 0 + 22;
|
||||
int viewStart = myScrollBar.getCurrentScroll() * 3;
|
||||
int viewEnd = viewStart + 3 * 6;
|
||||
|
||||
String dspToolTip = "";
|
||||
List<String> lineList = new LinkedList();
|
||||
int toolPosX = 0;
|
||||
int toolPosY = 0;
|
||||
|
||||
int offY = 23;
|
||||
|
||||
for (int z = viewStart; z < Math.min( viewEnd, visual.size() ); z++)
|
||||
{
|
||||
IAEItemStack refStack = visual.get( z );// repo.getReferenceItem( z );
|
||||
if ( refStack != null )
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScaled( 0.5, 0.5, 0.5 );
|
||||
|
||||
IAEItemStack stored = storage.findPrecise( refStack );
|
||||
IAEItemStack activeStack = active.findPrecise( refStack );
|
||||
IAEItemStack pendingStack = pending.findPrecise( refStack );
|
||||
|
||||
int lines = 0;
|
||||
|
||||
if ( stored != null && stored.getStackSize() > 0 )
|
||||
lines++;
|
||||
if ( activeStack != null && activeStack.getStackSize() > 0 )
|
||||
lines++;
|
||||
if ( pendingStack != null && pendingStack.getStackSize() > 0 )
|
||||
lines++;
|
||||
|
||||
int negY = ((lines - 1) * 5) / 2;
|
||||
int downY = 0;
|
||||
|
||||
if ( stored != null && stored.getStackSize() > 0 )
|
||||
{
|
||||
String str = Long.toString( stored.getStackSize() );
|
||||
if ( stored.getStackSize() >= 10000 )
|
||||
str = Long.toString( stored.getStackSize() / 1000 ) + "k";
|
||||
if ( stored.getStackSize() >= 10000000 )
|
||||
str = Long.toString( stored.getStackSize() / 1000000 ) + "m";
|
||||
|
||||
str = GuiText.Stored.getLocal() + ": " + str;
|
||||
int w = 4 + fontRendererObj.getStringWidth( str );
|
||||
fontRendererObj.drawString( str, (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - ((float) w * 0.5)) * 2), (int) ((y * offY + yo
|
||||
+ 6 - negY + downY) * 2), 4210752 );
|
||||
|
||||
if ( tooltip == z - viewStart )
|
||||
lineList.add( GuiText.Stored.getLocal() + ": " + Long.toString( stored.getStackSize() ) );
|
||||
|
||||
downY += 5;
|
||||
}
|
||||
|
||||
if ( activeStack != null && activeStack.getStackSize() > 0 )
|
||||
{
|
||||
String str = Long.toString( activeStack.getStackSize() );
|
||||
if ( activeStack.getStackSize() >= 10000 )
|
||||
str = Long.toString( activeStack.getStackSize() / 1000 ) + "k";
|
||||
if ( activeStack.getStackSize() >= 10000000 )
|
||||
str = Long.toString( activeStack.getStackSize() / 1000000 ) + "m";
|
||||
|
||||
str = GuiText.Crafting.getLocal() + ": " + str;
|
||||
int w = 4 + fontRendererObj.getStringWidth( str );
|
||||
fontRendererObj.drawString( str, (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - ((float) w * 0.5)) * 2), (int) ((y * offY + yo
|
||||
+ 6 - negY + downY) * 2), 4210752 );
|
||||
|
||||
if ( tooltip == z - viewStart )
|
||||
lineList.add( GuiText.Crafting.getLocal() + ": " + Long.toString( activeStack.getStackSize() ) );
|
||||
|
||||
downY += 5;
|
||||
}
|
||||
|
||||
if ( pendingStack != null && pendingStack.getStackSize() > 0 )
|
||||
{
|
||||
String str = Long.toString( pendingStack.getStackSize() );
|
||||
if ( pendingStack.getStackSize() >= 10000 )
|
||||
str = Long.toString( pendingStack.getStackSize() / 1000 ) + "k";
|
||||
if ( pendingStack.getStackSize() >= 10000000 )
|
||||
str = Long.toString( pendingStack.getStackSize() / 1000000 ) + "m";
|
||||
|
||||
str = GuiText.Scheduled.getLocal() + ": " + str;
|
||||
int w = 4 + fontRendererObj.getStringWidth( str );
|
||||
fontRendererObj.drawString( str, (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - ((float) w * 0.5)) * 2), (int) ((y * offY + yo
|
||||
+ 6 - negY + downY) * 2), 4210752 );
|
||||
|
||||
if ( tooltip == z - viewStart )
|
||||
lineList.add( GuiText.Scheduled.getLocal() + ": " + Long.toString( pendingStack.getStackSize() ) );
|
||||
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
int posX = x * (1 + sectionLength) + xo + sectionLength - 19;
|
||||
int posY = y * offY + yo;
|
||||
|
||||
ItemStack is = refStack.copy().getItemStack();
|
||||
|
||||
if ( tooltip == z - viewStart )
|
||||
{
|
||||
dspToolTip = Platform.getItemDisplayName( is );
|
||||
|
||||
if ( lineList.size() > 0 )
|
||||
dspToolTip = dspToolTip + "\n" + Joiner.on( "\n" ).join( lineList );
|
||||
|
||||
toolPosX = x * (1 + sectionLength) + xo + sectionLength - 8;
|
||||
toolPosY = y * offY + yo;
|
||||
}
|
||||
|
||||
drawItem( posX, posY, is );
|
||||
|
||||
x++;
|
||||
|
||||
if ( x > 2 )
|
||||
{
|
||||
y++;
|
||||
x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( tooltip >= 0 && dspToolTip.length() > 0 )
|
||||
{
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
drawTooltip( toolPosX, toolPosY + 10, 0, dspToolTip );
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getSortBy()
|
||||
{
|
||||
return SortOrder.NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getSortDir()
|
||||
{
|
||||
return SortDir.ASCENDING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getSortDisplay()
|
||||
{
|
||||
return ViewItems.ALL;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.container.implementations.ContainerCraftingStatus;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.helpers.WirelessTerminalGuiObject;
|
||||
import appeng.parts.reporting.PartCraftingTerminal;
|
||||
import appeng.parts.reporting.PartPatternTerminal;
|
||||
import appeng.parts.reporting.PartTerminal;
|
||||
|
||||
public class GuiCraftingStatus extends GuiCraftingCPU
|
||||
{
|
||||
|
||||
ContainerCraftingStatus ccc;
|
||||
GuiButton selectcpu;
|
||||
|
||||
GuiTabButton originalGuiBtn;
|
||||
GuiBridge OriginalGui;
|
||||
ItemStack myIcon = null;
|
||||
|
||||
public GuiCraftingStatus(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||
super( new ContainerCraftingStatus( inventoryPlayer, te ) );
|
||||
|
||||
ccc = (ContainerCraftingStatus) inventorySlots;
|
||||
Object target = ccc.getTarget();
|
||||
|
||||
if ( target instanceof WirelessTerminalGuiObject )
|
||||
{
|
||||
myIcon = AEApi.instance().items().itemWirelessTerminal.stack( 1 );
|
||||
OriginalGui = GuiBridge.GUI_WIRELESS_TERM;
|
||||
}
|
||||
|
||||
if ( target instanceof PartTerminal )
|
||||
{
|
||||
myIcon = AEApi.instance().parts().partTerminal.stack( 1 );
|
||||
OriginalGui = GuiBridge.GUI_ME;
|
||||
}
|
||||
|
||||
if ( target instanceof PartCraftingTerminal )
|
||||
{
|
||||
myIcon = AEApi.instance().parts().partCraftingTerminal.stack( 1 );
|
||||
OriginalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
|
||||
}
|
||||
|
||||
if ( target instanceof PartPatternTerminal )
|
||||
{
|
||||
myIcon = AEApi.instance().parts().partPatternTerminal.stack( 1 );
|
||||
OriginalGui = GuiBridge.GUI_PATTERN_TERMINAL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
boolean backwards = Mouse.isButtonDown( 1 );
|
||||
|
||||
if ( btn == selectcpu )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "Terminal.Cpu", backwards ? "Prev" : "Next" ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
|
||||
if ( btn == originalGuiBtn )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( OriginalGui ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getGuiDisplayName(String in)
|
||||
{
|
||||
return in; // the cup name is on the button
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
selectcpu = new GuiButton( 0, this.guiLeft + 8, this.guiTop + ySize - 25, 150, 20, GuiText.CraftingCPU.getLocal() + ": " + GuiText.NoCraftingCPUs );
|
||||
// selectcpu.enabled = false;
|
||||
buttonList.add( selectcpu );
|
||||
|
||||
if ( myIcon != null )
|
||||
{
|
||||
buttonList.add( originalGuiBtn = new GuiTabButton( this.guiLeft + 213, this.guiTop - 4, myIcon, myIcon.getDisplayName(), itemRender ) );
|
||||
originalGuiBtn.hideEdge = 13;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateCPUButtonText()
|
||||
{
|
||||
String btnTextText = GuiText.NoCraftingJobs.getLocal();
|
||||
|
||||
if ( ccc.selectedCpu >= 0 )// && ccc.selectedCpu < ccc.cpus.size() )
|
||||
{
|
||||
if ( ccc.myName.length() > 0 )
|
||||
{
|
||||
String name = ccc.myName.substring( 0, Math.min( 20, ccc.myName.length() ) );
|
||||
btnTextText = GuiText.CPUs.getLocal() + ": " + name;
|
||||
}
|
||||
else
|
||||
btnTextText = GuiText.CPUs.getLocal() + ": #" + ccc.selectedCpu;
|
||||
}
|
||||
|
||||
if ( ccc.noCPU )
|
||||
btnTextText = GuiText.NoCraftingJobs.getLocal();
|
||||
|
||||
selectcpu.displayString = btnTextText;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouse_x, int mouse_y, float btn)
|
||||
{
|
||||
updateCPUButtonText();
|
||||
super.drawScreen( mouse_x, mouse_y, btn );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.container.implementations.ContainerCraftingTerm;
|
||||
import appeng.container.slot.SlotCraftingMatrix;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketInventoryAction;
|
||||
import appeng.helpers.InventoryAction;
|
||||
|
||||
public class GuiCraftingTerm extends GuiMEMonitorable
|
||||
{
|
||||
|
||||
GuiImgButton clearBtn;
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
buttonList.add( clearBtn = new GuiImgButton( this.guiLeft + 92, this.guiTop + this.ySize - 156, Settings.ACTIONS, ActionItems.STASH ) );
|
||||
clearBtn.halfSize = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
if ( clearBtn == btn )
|
||||
{
|
||||
Slot s = null;
|
||||
Container c = inventorySlots;
|
||||
for (Object j : c.inventorySlots)
|
||||
{
|
||||
if ( j instanceof SlotCraftingMatrix )
|
||||
s = (Slot) j;
|
||||
}
|
||||
|
||||
if ( s != null )
|
||||
{
|
||||
PacketInventoryAction p;
|
||||
try
|
||||
{
|
||||
p = new PacketInventoryAction( InventoryAction.MOVE_REGION, s.slotNumber, 0 );
|
||||
NetworkHandler.instance.sendToServer( p );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public GuiCraftingTerm(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||
super( inventoryPlayer, te, new ContainerCraftingTerm( inventoryPlayer, te ) );
|
||||
reservedSpace = 73;
|
||||
}
|
||||
|
||||
protected String getBackground()
|
||||
{
|
||||
return "guis/crafting.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawFG( offsetX, offsetY, mouseX, mouseY );
|
||||
fontRendererObj.drawString( GuiText.CraftingTerminal.getLocal(), 8, ySize - 96 + 1 - reservedSpace, 4210752 );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.container.implementations.ContainerDrive;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||
import appeng.tile.storage.TileDrive;
|
||||
|
||||
public class GuiDrive extends AEBaseGui
|
||||
{
|
||||
|
||||
GuiTabButton priority;
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton)
|
||||
{
|
||||
super.actionPerformed( par1GuiButton );
|
||||
|
||||
if ( par1GuiButton == priority )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
buttonList.add( priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), itemRender ) );
|
||||
}
|
||||
|
||||
public GuiDrive(InventoryPlayer inventoryPlayer, TileDrive te) {
|
||||
super( new ContainerDrive( inventoryPlayer, te ) );
|
||||
this.ySize = 199;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/drive.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString( getGuiDisplayName( GuiText.Drive.getLocal() ), 8, 6, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
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.FuzzyMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.container.implementations.ContainerFormationPlane;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||
import appeng.parts.automation.PartFormationPlane;
|
||||
|
||||
public class GuiFormationPlane extends GuiUpgradeable
|
||||
{
|
||||
|
||||
GuiTabButton priority;
|
||||
|
||||
public GuiFormationPlane(InventoryPlayer inventoryPlayer, PartFormationPlane te) {
|
||||
super( new ContainerFormationPlane( inventoryPlayer, te ) );
|
||||
this.ySize = 251;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawBG( offsetX, offsetY, mouseX, mouseY );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString( getGuiDisplayName( GuiText.FormationPlane.getLocal() ), 8, 6, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
|
||||
if ( fuzzyMode != null )
|
||||
fuzzyMode.set( cvb.fzMode );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addButtons()
|
||||
{
|
||||
fuzzyMode = new GuiImgButton( this.guiLeft - 18, guiTop + 28, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
||||
|
||||
buttonList.add( priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), itemRender ) );
|
||||
|
||||
buttonList.add( fuzzyMode );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
if ( btn == priority )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected String getBackground()
|
||||
{
|
||||
return "guis/storagebus.png";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.container.implementations.ContainerGrinder;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.tile.grindstone.TileGrinder;
|
||||
|
||||
public class GuiGrinder extends AEBaseGui
|
||||
{
|
||||
|
||||
public GuiGrinder(InventoryPlayer inventoryPlayer, TileGrinder te) {
|
||||
super( new ContainerGrinder( inventoryPlayer, te ) );
|
||||
this.ySize = 176;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/grinder.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString( getGuiDisplayName( GuiText.GrindStone.getLocal() ), 8, 6, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.FullnessMode;
|
||||
import appeng.api.config.OperationMode;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.container.implementations.ContainerIOPort;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketConfigButton;
|
||||
import appeng.tile.storage.TileIOPort;
|
||||
|
||||
public class GuiIOPort extends GuiUpgradeable
|
||||
{
|
||||
|
||||
GuiImgButton fullMode;
|
||||
GuiImgButton operationMode;
|
||||
|
||||
public GuiIOPort(InventoryPlayer inventoryPlayer, TileIOPort te) {
|
||||
super( new ContainerIOPort( inventoryPlayer, te ) );
|
||||
this.ySize = 166;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawBG( offsetX, offsetY, mouseX, mouseY );
|
||||
this.drawItem( offsetX + 66 - 8, offsetY + 17, AEApi.instance().items().itemCell1k.stack( 1 ) );
|
||||
this.drawItem( offsetX + 94 + 8, offsetY + 17, AEApi.instance().blocks().blockDrive.stack( 1 ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString( getGuiDisplayName( GuiText.IOPort.getLocal() ), 8, 6, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
|
||||
if ( redstoneMode != null )
|
||||
redstoneMode.set( cvb.rsMode );
|
||||
|
||||
if ( operationMode != null )
|
||||
operationMode.set( ((ContainerIOPort) cvb).opMode );
|
||||
|
||||
if ( fullMode != null )
|
||||
fullMode.set( ((ContainerIOPort) cvb).fMode );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addButtons()
|
||||
{
|
||||
redstoneMode = new GuiImgButton( this.guiLeft - 18, guiTop + 28, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
|
||||
fullMode = new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.FULLNESS_MODE, FullnessMode.EMPTY );
|
||||
operationMode = new GuiImgButton( this.guiLeft + 80, guiTop + 17, Settings.OPERATION_MODE, OperationMode.EMPTY );
|
||||
|
||||
buttonList.add( operationMode );
|
||||
buttonList.add( redstoneMode );
|
||||
buttonList.add( fullMode );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
boolean backwards = Mouse.isButtonDown( 1 );
|
||||
|
||||
try
|
||||
{
|
||||
if ( btn == fullMode )
|
||||
NetworkHandler.instance.sendToServer( new PacketConfigButton( fullMode.getSetting(), backwards ) );
|
||||
|
||||
if ( btn == operationMode )
|
||||
NetworkHandler.instance.sendToServer( new PacketConfigButton( operationMode.getSetting(), backwards ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
|
||||
protected String getBackground()
|
||||
{
|
||||
return "guis/ioport.png";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiProgressBar;
|
||||
import appeng.client.gui.widgets.GuiProgressBar.Direction;
|
||||
import appeng.container.implementations.ContainerInscriber;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.tile.misc.TileInscriber;
|
||||
|
||||
public class GuiInscriber extends AEBaseGui
|
||||
{
|
||||
|
||||
ContainerInscriber cvc;
|
||||
GuiProgressBar pb;
|
||||
|
||||
public GuiInscriber(InventoryPlayer inventoryPlayer, TileInscriber te) {
|
||||
super( new ContainerInscriber( inventoryPlayer, te ) );
|
||||
cvc = (ContainerInscriber) inventorySlots;
|
||||
this.ySize = 176;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
pb = new GuiProgressBar( "guis/inscriber.png", 135, 39, 179, 39, 6, 18, Direction.VERTICAL );
|
||||
this.buttonList.add( pb );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/inscriber.png" );
|
||||
pb.xPosition = 135 + guiLeft;
|
||||
pb.yPosition = 39 + guiTop;
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
}
|
||||
|
||||
@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) + "%";
|
||||
|
||||
fontRendererObj.drawString( getGuiDisplayName( GuiText.Inscriber.getLocal() ), 8, 6, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.client.gui.widgets.GuiToggleButton;
|
||||
import appeng.container.implementations.ContainerInterface;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketConfigButton;
|
||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||
import appeng.helpers.IInterfaceHost;
|
||||
|
||||
public class GuiInterface extends GuiUpgradeable
|
||||
{
|
||||
|
||||
GuiTabButton priority;
|
||||
GuiImgButton BlockMode;
|
||||
GuiToggleButton interfaceMode;
|
||||
|
||||
public GuiInterface(InventoryPlayer inventoryPlayer, IInterfaceHost te) {
|
||||
super( new ContainerInterface( inventoryPlayer, te ) );
|
||||
this.ySize = 211;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
boolean backwards = Mouse.isButtonDown( 1 );
|
||||
|
||||
if ( btn == priority )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if ( btn == interfaceMode )
|
||||
NetworkHandler.instance.sendToServer( new PacketConfigButton( Settings.INTERFACE_TERMINAL, backwards ) );
|
||||
|
||||
if ( btn == BlockMode )
|
||||
NetworkHandler.instance.sendToServer( new PacketConfigButton( BlockMode.getSetting(), backwards ) );
|
||||
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addButtons()
|
||||
{
|
||||
priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), itemRender );
|
||||
buttonList.add( priority );
|
||||
|
||||
BlockMode = new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.BLOCK, YesNo.NO );
|
||||
buttonList.add( BlockMode );
|
||||
|
||||
interfaceMode = new GuiToggleButton( this.guiLeft - 18, guiTop + 26, 84, 85, GuiText.InterfaceTerminal.getLocal(),
|
||||
GuiText.InterfaceTerminalHint.getLocal() );
|
||||
buttonList.add( interfaceMode );
|
||||
}
|
||||
|
||||
protected String getBackground()
|
||||
{
|
||||
return "guis/interface.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
if ( BlockMode != null )
|
||||
BlockMode.set( ((ContainerInterface) cvb).bMode );
|
||||
|
||||
if ( interfaceMode != null )
|
||||
interfaceMode.setState( ((ContainerInterface) cvb).iTermMode == YesNo.YES );
|
||||
|
||||
fontRendererObj.drawString( getGuiDisplayName( GuiText.Interface.getLocal() ), 8, 6, 4210752 );
|
||||
|
||||
fontRendererObj.drawString( GuiText.Config.getLocal(), 18, 6 + 11 + 7, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.StoredItems.getLocal(), 18, 6 + 60 + 7, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.Patterns.getLocal(), 8, 6 + 73 + 7, 4210752 );
|
||||
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
import appeng.client.me.ClientDCInternalInv;
|
||||
import appeng.client.me.SlotDisconnected;
|
||||
import appeng.container.implementations.ContainerInterfaceTerminal;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.parts.reporting.PartMonitor;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
|
||||
public class GuiInterfaceTerminal extends AEBaseGui
|
||||
{
|
||||
|
||||
HashMap<Long, ClientDCInternalInv> byId = new HashMap();
|
||||
HashMultimap<String, ClientDCInternalInv> byName = HashMultimap.create();
|
||||
ArrayList<String> names = new ArrayList();
|
||||
|
||||
ArrayList<Object> lines = new ArrayList();
|
||||
|
||||
private int getTotalRows()
|
||||
{
|
||||
return names.size() + byId.size();// unique names, and each inv row.
|
||||
}
|
||||
|
||||
public GuiInterfaceTerminal(InventoryPlayer inventoryPlayer, PartMonitor te) {
|
||||
super( new ContainerInterfaceTerminal( inventoryPlayer, te ) );
|
||||
myScrollBar = new GuiScrollbar();
|
||||
xSize = 195;
|
||||
ySize = 222;
|
||||
}
|
||||
|
||||
LinkedList<SlotDisconnected> dcSlots = new LinkedList();
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
myScrollBar.setLeft( 175 );
|
||||
myScrollBar.setHeight( 106 );
|
||||
myScrollBar.setTop( 18 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/interfaceterminal.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
|
||||
int offset = 17;
|
||||
int ex = myScrollBar.getCurrentScroll();
|
||||
int linesOnPage = 6;
|
||||
|
||||
for (int x = 0; x < linesOnPage; x++)
|
||||
{
|
||||
if ( ex + x < lines.size() )
|
||||
{
|
||||
Object lineObj = lines.get( ex + x );
|
||||
if ( lineObj instanceof ClientDCInternalInv )
|
||||
{
|
||||
ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
|
||||
|
||||
GL11.glColor4f( 1, 1, 1, 1 );
|
||||
for (int z = 0; z < inv.inv.getSizeInventory(); z++)
|
||||
this.drawTexturedModalRect( offsetX + z * 18 + 7, offsetY + offset, 7, 139, 18, 18 );
|
||||
}
|
||||
}
|
||||
offset += 18;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString( getGuiDisplayName( GuiText.InterfaceTerminal.getLocal() ), 8, 6, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
|
||||
int offset = 17;
|
||||
|
||||
// for (String name : lines)
|
||||
int ex = myScrollBar.getCurrentScroll();
|
||||
int linesOnPage = 6;
|
||||
|
||||
Iterator<Object> o = inventorySlots.inventorySlots.iterator();
|
||||
while (o.hasNext())
|
||||
{
|
||||
if ( o.next() instanceof SlotDisconnected )
|
||||
o.remove();
|
||||
}
|
||||
|
||||
for (int x = 0; x < linesOnPage; x++)
|
||||
{
|
||||
if ( ex + x < lines.size() )
|
||||
{
|
||||
Object lineObj = lines.get( ex + x );
|
||||
if ( lineObj instanceof ClientDCInternalInv )
|
||||
{
|
||||
ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
|
||||
for (int z = 0; z < inv.inv.getSizeInventory(); z++)
|
||||
{
|
||||
inventorySlots.inventorySlots.add( new SlotDisconnected( inv, z, z * 18 + 8, 1 + offset ) );
|
||||
}
|
||||
}
|
||||
else if ( lineObj instanceof String )
|
||||
{
|
||||
String name = (String) lineObj;
|
||||
int rows = byName.get( name ).size();
|
||||
if ( rows > 1 )
|
||||
name = name + " (" + rows + ")";
|
||||
|
||||
while (name.length() > 2 && fontRendererObj.getStringWidth( name ) > 155)
|
||||
name = name.substring( 0, name.length() - 1 );
|
||||
|
||||
fontRendererObj.drawString( name, 10, 6 + offset, 4210752 );
|
||||
}
|
||||
offset += 18;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean refreshList = false;
|
||||
|
||||
public void postUpdate(NBTTagCompound in)
|
||||
{
|
||||
if ( in.getBoolean( "clear" ) )
|
||||
{
|
||||
byId.clear();
|
||||
refreshList = true;
|
||||
}
|
||||
|
||||
for (Object oKey : in.func_150296_c())
|
||||
{
|
||||
String key = (String) oKey;
|
||||
if ( key.startsWith( "=" ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
long id = Long.parseLong( key.substring( 1 ), Character.MAX_RADIX );
|
||||
NBTTagCompound invData = in.getCompoundTag( key );
|
||||
ClientDCInternalInv current = getById( id, invData.getLong( "sortBy" ), invData.getString( "un" ) );
|
||||
|
||||
for (int x = 0; x < current.inv.getSizeInventory(); x++)
|
||||
{
|
||||
String which = Integer.toString( x );
|
||||
if ( invData.hasKey( which ) )
|
||||
current.inv.setInventorySlotContents( x, ItemStack.loadItemStackFromNBT( invData.getCompoundTag( which ) ) );
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( refreshList )
|
||||
{
|
||||
refreshList = false;
|
||||
|
||||
byName.clear();
|
||||
for (ClientDCInternalInv o : byId.values())
|
||||
byName.put( o.getName(), o );
|
||||
|
||||
names.clear();
|
||||
names.addAll( byName.keySet() );
|
||||
|
||||
Collections.sort( names );
|
||||
|
||||
lines = new ArrayList( getTotalRows() );
|
||||
for (String n : names)
|
||||
{
|
||||
lines.add( n );
|
||||
|
||||
ArrayList<ClientDCInternalInv> lset = new ArrayList();
|
||||
lset.addAll( byName.get( n ) );
|
||||
|
||||
Collections.sort( lset );
|
||||
|
||||
for (ClientDCInternalInv i : lset)
|
||||
{
|
||||
lines.add( i );
|
||||
}
|
||||
}
|
||||
|
||||
myScrollBar.setRange( 0, getTotalRows() - 6, 2 );
|
||||
}
|
||||
}
|
||||
|
||||
private ClientDCInternalInv getById(long id, long sortBy, String string)
|
||||
{
|
||||
ClientDCInternalInv o = byId.get( id );
|
||||
|
||||
if ( o == null )
|
||||
{
|
||||
byId.put( id, o = new ClientDCInternalInv( 9, id, sortBy, string ) );
|
||||
refreshList = true;
|
||||
}
|
||||
|
||||
return o;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.LevelType;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiNumberBox;
|
||||
import appeng.container.implementations.ContainerLevelEmitter;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketConfigButton;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.parts.automation.PartLevelEmitter;
|
||||
|
||||
public class GuiLevelEmitter extends GuiUpgradeable
|
||||
{
|
||||
|
||||
GuiNumberBox level;
|
||||
|
||||
GuiButton plus1, plus10, plus100, plus1000;
|
||||
GuiButton minus1, minus10, minus100, minus1000;
|
||||
|
||||
GuiImgButton levelMode;
|
||||
GuiImgButton craftingMode;
|
||||
|
||||
public GuiLevelEmitter(InventoryPlayer inventoryPlayer, PartLevelEmitter te) {
|
||||
super( new ContainerLevelEmitter( inventoryPlayer, te ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
level = new GuiNumberBox( fontRendererObj, this.guiLeft + 24, this.guiTop + 43, 79, fontRendererObj.FONT_HEIGHT, Long.class );
|
||||
level.setEnableBackgroundDrawing( false );
|
||||
level.setMaxStringLength( 16 );
|
||||
level.setTextColor( 0xFFFFFF );
|
||||
level.setVisible( true );
|
||||
level.setFocused( true );
|
||||
((ContainerLevelEmitter) inventorySlots).setTextField( level );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addButtons()
|
||||
{
|
||||
levelMode = new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.LEVEL_TYPE, LevelType.ITEM_LEVEL );
|
||||
redstoneMode = new GuiImgButton( this.guiLeft - 18, guiTop + 28, Settings.REDSTONE_EMITTER, RedstoneMode.LOW_SIGNAL );
|
||||
fuzzyMode = new GuiImgButton( this.guiLeft - 18, guiTop + 48, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
||||
craftingMode = new GuiImgButton( this.guiLeft - 18, guiTop + 48, Settings.CRAFT_VIA_REDSTONE, YesNo.NO );
|
||||
|
||||
int a = AEConfig.instance.levelByStackAmounts( 0 );
|
||||
int b = AEConfig.instance.levelByStackAmounts( 1 );
|
||||
int c = AEConfig.instance.levelByStackAmounts( 2 );
|
||||
int d = AEConfig.instance.levelByStackAmounts( 3 );
|
||||
|
||||
buttonList.add( plus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 17, 22, 20, "+" + a ) );
|
||||
buttonList.add( plus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 17, 28, 20, "+" + b ) );
|
||||
buttonList.add( plus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 17, 32, 20, "+" + c ) );
|
||||
buttonList.add( plus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 17, 38, 20, "+" + d ) );
|
||||
|
||||
buttonList.add( minus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 59, 22, 20, "-" + a ) );
|
||||
buttonList.add( minus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 59, 28, 20, "-" + b ) );
|
||||
buttonList.add( minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 59, 32, 20, "-" + c ) );
|
||||
buttonList.add( minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 59, 38, 20, "-" + d ) );
|
||||
|
||||
buttonList.add( levelMode );
|
||||
buttonList.add( redstoneMode );
|
||||
buttonList.add( fuzzyMode );
|
||||
buttonList.add( craftingMode );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
boolean backwards = Mouse.isButtonDown( 1 );
|
||||
|
||||
try
|
||||
{
|
||||
if ( btn == craftingMode )
|
||||
NetworkHandler.instance.sendToServer( new PacketConfigButton( craftingMode.getSetting(), backwards ) );
|
||||
|
||||
if ( btn == levelMode )
|
||||
NetworkHandler.instance.sendToServer( new PacketConfigButton( levelMode.getSetting(), backwards ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
|
||||
boolean isPlus = btn == plus1 || btn == plus10 || btn == plus100 || btn == plus1000;
|
||||
boolean isMinus = btn == minus1 || btn == minus10 || btn == minus100 || btn == minus1000;
|
||||
|
||||
if ( isPlus || isMinus )
|
||||
addQty( getQty( btn ) );
|
||||
}
|
||||
|
||||
private void addQty(long i)
|
||||
{
|
||||
try
|
||||
{
|
||||
String Out = level.getText();
|
||||
|
||||
boolean Fixed = false;
|
||||
while (Out.startsWith( "0" ) && Out.length() > 1)
|
||||
{
|
||||
Out = Out.substring( 1 );
|
||||
Fixed = true;
|
||||
}
|
||||
|
||||
if ( Fixed )
|
||||
level.setText( Out );
|
||||
|
||||
if ( Out.length() == 0 )
|
||||
Out = "0";
|
||||
|
||||
long result = Long.parseLong( Out );
|
||||
result += i;
|
||||
if ( result < 0 )
|
||||
result = 0;
|
||||
|
||||
level.setText( Out = Long.toString( result ) );
|
||||
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "LevelEmitter.Value", Out ) );
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
// nope..
|
||||
level.setText( "0" );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
|
||||
protected void handleButtonVisibility()
|
||||
{
|
||||
craftingMode.setVisibility( bc.getInstalledUpgrades( Upgrades.CRAFTING ) > 0 );
|
||||
fuzzyMode.setVisibility( bc.getInstalledUpgrades( Upgrades.FUZZY ) > 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char character, int key)
|
||||
{
|
||||
if ( !this.checkHotbarKeys( key ) )
|
||||
{
|
||||
if ( (key == 211 || key == 205 || key == 203 || key == 14 || Character.isDigit( character )) && level.textboxKeyTyped( character, key ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
String Out = level.getText();
|
||||
|
||||
boolean Fixed = false;
|
||||
while (Out.startsWith( "0" ) && Out.length() > 1)
|
||||
{
|
||||
Out = Out.substring( 1 );
|
||||
Fixed = true;
|
||||
}
|
||||
|
||||
if ( Fixed )
|
||||
level.setText( Out );
|
||||
|
||||
if ( Out.length() == 0 )
|
||||
Out = "0";
|
||||
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "LevelEmitter.Value", Out ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.keyTyped( character, key );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
boolean notCraftingMode = bc.getInstalledUpgrades( Upgrades.CRAFTING ) == 0;
|
||||
|
||||
// configure enabled status...
|
||||
level.setEnabled( notCraftingMode );
|
||||
plus1.enabled = notCraftingMode;
|
||||
plus10.enabled = notCraftingMode;
|
||||
plus100.enabled = notCraftingMode;
|
||||
plus1000.enabled = notCraftingMode;
|
||||
minus1.enabled = notCraftingMode;
|
||||
minus10.enabled = notCraftingMode;
|
||||
minus100.enabled = notCraftingMode;
|
||||
minus1000.enabled = notCraftingMode;
|
||||
levelMode.enabled = notCraftingMode;
|
||||
redstoneMode.enabled = notCraftingMode;
|
||||
|
||||
super.drawFG( offsetX, offsetY, mouseX, mouseY );
|
||||
|
||||
if ( craftingMode != null )
|
||||
craftingMode.set( ((ContainerLevelEmitter) cvb).cmType );
|
||||
|
||||
if ( levelMode != null )
|
||||
levelMode.set( ((ContainerLevelEmitter) cvb).lvType );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawBG( offsetX, offsetY, mouseX, mouseY );
|
||||
level.drawTextBox();
|
||||
}
|
||||
|
||||
protected String getBackground()
|
||||
{
|
||||
return "guis/lvlemitter.png";
|
||||
}
|
||||
|
||||
protected GuiText getName()
|
||||
{
|
||||
return GuiText.LevelEmitter;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiProgressBar;
|
||||
import appeng.client.gui.widgets.GuiProgressBar.Direction;
|
||||
import appeng.container.implementations.ContainerMAC;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.tile.crafting.TileMolecularAssembler;
|
||||
|
||||
public class GuiMAC extends GuiUpgradeable
|
||||
{
|
||||
|
||||
ContainerMAC cmac;
|
||||
GuiProgressBar pb;
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
pb = new GuiProgressBar( "guis/mac.png", 139, 36, 148, 201, 6, 18, Direction.VERTICAL );
|
||||
this.buttonList.add( pb );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
pb.xPosition = 148 + guiLeft;
|
||||
pb.yPosition = 48 + guiTop;
|
||||
super.drawBG( offsetX, offsetY, mouseX, mouseY );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
pb.max = 100;
|
||||
pb.current = cmac.craftProgress;
|
||||
pb.FullMsg = pb.current + "%";
|
||||
|
||||
super.drawFG( offsetX, offsetY, mouseX, mouseY );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addButtons()
|
||||
{
|
||||
redstoneMode = new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
|
||||
buttonList.add( redstoneMode );
|
||||
}
|
||||
|
||||
protected String getBackground()
|
||||
{
|
||||
return "guis/mac.png";
|
||||
}
|
||||
|
||||
public GuiMAC(InventoryPlayer inventoryPlayer, TileMolecularAssembler te) {
|
||||
super( new ContainerMAC( inventoryPlayer, te ) );
|
||||
this.ySize = 197;
|
||||
this.cmac = (ContainerMAC) this.inventorySlots;
|
||||
}
|
||||
|
||||
protected GuiText getName()
|
||||
{
|
||||
return GuiText.MolecularAssembler;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,472 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import appeng.api.config.SearchBoxMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.TerminalStyle;
|
||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||
import appeng.api.implementations.tiles.IMEChest;
|
||||
import appeng.api.implementations.tiles.IViewCellStorage;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigurableObject;
|
||||
import appeng.client.gui.AEBaseMEGui;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.client.gui.widgets.MEGuiTextField;
|
||||
import appeng.client.me.InternalSlotME;
|
||||
import appeng.client.me.ItemRepo;
|
||||
import appeng.container.implementations.ContainerMEMonitorable;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.container.slot.SlotCraftingMatrix;
|
||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.helpers.WirelessTerminalGuiObject;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.parts.reporting.PartTerminal;
|
||||
import appeng.tile.misc.TileSecurity;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfigManagerHost
|
||||
{
|
||||
|
||||
GuiTabButton craftingStatusBtn;
|
||||
|
||||
MEGuiTextField searchField;
|
||||
private static String memoryText = "";
|
||||
|
||||
public static int CraftingGridOffsetX;
|
||||
public static int CraftingGridOffsetY;
|
||||
|
||||
ItemRepo repo;
|
||||
|
||||
GuiText myName;
|
||||
|
||||
int xoffset = 9;
|
||||
int perRow = 9;
|
||||
int reservedSpace = 0;
|
||||
int lowerTextureOffset = 0;
|
||||
boolean customSortOrder = true;
|
||||
|
||||
int rows = 0;
|
||||
int maxRows = Integer.MAX_VALUE;
|
||||
|
||||
int standardSize;
|
||||
|
||||
IConfigManager configSrc;
|
||||
|
||||
GuiImgButton ViewBox;
|
||||
GuiImgButton SortByBox;
|
||||
GuiImgButton SortDirBox;
|
||||
|
||||
GuiImgButton searchBoxSettings, terminalStyleBox;
|
||||
boolean viewCell;
|
||||
|
||||
ItemStack myCurrentViewCells[] = new ItemStack[5];
|
||||
ContainerMEMonitorable mecontainer;
|
||||
|
||||
public GuiMEMonitorable(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||
this( inventoryPlayer, te, new ContainerMEMonitorable( inventoryPlayer, te ) );
|
||||
}
|
||||
|
||||
public GuiMEMonitorable(InventoryPlayer inventoryPlayer, ITerminalHost te, ContainerMEMonitorable c) {
|
||||
|
||||
super( c );
|
||||
myScrollBar = new GuiScrollbar();
|
||||
repo = new ItemRepo( myScrollBar, this );
|
||||
|
||||
xSize = 185;
|
||||
ySize = 204;
|
||||
|
||||
if ( te instanceof IViewCellStorage )
|
||||
xSize += 33;
|
||||
|
||||
standardSize = xSize;
|
||||
|
||||
configSrc = ((IConfigurableObject) inventorySlots).getConfigManager();
|
||||
(mecontainer = (ContainerMEMonitorable) inventorySlots).gui = this;
|
||||
|
||||
viewCell = te instanceof IViewCellStorage;
|
||||
|
||||
if ( te instanceof TileSecurity )
|
||||
myName = GuiText.Security;
|
||||
else if ( te instanceof WirelessTerminalGuiObject )
|
||||
myName = GuiText.WirelessTerminal;
|
||||
else if ( te instanceof IPortableCell )
|
||||
myName = GuiText.PortableCell;
|
||||
else if ( te instanceof IMEChest )
|
||||
myName = GuiText.Chest;
|
||||
else if ( te instanceof PartTerminal )
|
||||
myName = GuiText.Terminal;
|
||||
}
|
||||
|
||||
public void postUpdate(List<IAEItemStack> list)
|
||||
{
|
||||
for (IAEItemStack is : list)
|
||||
repo.postUpdate( is );
|
||||
|
||||
repo.updateView();
|
||||
setScrollBar();
|
||||
}
|
||||
|
||||
private void setScrollBar()
|
||||
{
|
||||
myScrollBar.setTop( 18 ).setLeft( 175 ).setHeight( rows * 18 - 2 );
|
||||
myScrollBar.setRange( 0, (repo.size() + perRow - 1) / perRow - rows, Math.max( 1, rows / 6 ) );
|
||||
}
|
||||
|
||||
public void re_init()
|
||||
{
|
||||
this.buttonList.clear();
|
||||
this.initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuiClosed()
|
||||
{
|
||||
super.onGuiClosed();
|
||||
memoryText = searchField.getText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
maxRows = getMaxRows();
|
||||
perRow = AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ((width - standardSize) / 18);
|
||||
|
||||
boolean hasNEI = AppEng.instance.isIntegrationEnabled( IntegrationType.NEI );
|
||||
|
||||
int NEI = hasNEI ? 0 : 0;
|
||||
int top = hasNEI ? 22 : 0;
|
||||
|
||||
int magicNumber = 114 + 1;
|
||||
int extraSpace = height - magicNumber - NEI - top - reservedSpace;
|
||||
|
||||
rows = (int) Math.floor( extraSpace / 18 );
|
||||
if ( rows > maxRows )
|
||||
{
|
||||
top += (rows - maxRows) * 18 / 2;
|
||||
rows = maxRows;
|
||||
}
|
||||
|
||||
if ( hasNEI )
|
||||
rows--;
|
||||
|
||||
if ( rows < 3 )
|
||||
rows = 3;
|
||||
|
||||
meSlots.clear();
|
||||
for (int y = 0; y < rows; y++)
|
||||
{
|
||||
for (int x = 0; x < perRow; x++)
|
||||
{
|
||||
meSlots.add( new InternalSlotME( repo, x + y * perRow, xoffset + x * 18, 18 + y * 18 ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL )
|
||||
this.xSize = standardSize + ((perRow - 9) * 18);
|
||||
else
|
||||
this.xSize = standardSize;
|
||||
|
||||
super.initGui();
|
||||
// full size : 204
|
||||
// extra slots : 72
|
||||
// slot 18
|
||||
|
||||
this.ySize = magicNumber + rows * 18 + reservedSpace;
|
||||
// this.guiTop = top;
|
||||
int unusedSpace = height - ySize;
|
||||
guiTop = (int) Math.floor( (float) unusedSpace / (unusedSpace < 0 ? 3.8f : 2.0f) );
|
||||
|
||||
int offset = guiTop + 8;
|
||||
|
||||
if ( customSortOrder )
|
||||
{
|
||||
buttonList.add( SortByBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_BY, configSrc.getSetting( Settings.SORT_BY ) ) );
|
||||
offset += 20;
|
||||
}
|
||||
|
||||
if ( viewCell || this instanceof GuiWirelessTerm )
|
||||
{
|
||||
buttonList.add( ViewBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.VIEW_MODE, configSrc.getSetting( Settings.VIEW_MODE ) ) );
|
||||
offset += 20;
|
||||
}
|
||||
|
||||
buttonList.add( SortDirBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_DIRECTION, configSrc.getSetting( Settings.SORT_DIRECTION ) ) );
|
||||
offset += 20;
|
||||
|
||||
buttonList.add( searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance.settings
|
||||
.getSetting( Settings.SEARCH_MODE ) ) );
|
||||
offset += 20;
|
||||
|
||||
if ( !(this instanceof GuiMEPortableCell) || this instanceof GuiWirelessTerm )
|
||||
{
|
||||
buttonList.add( terminalStyleBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance.settings
|
||||
.getSetting( Settings.TERMINAL_STYLE ) ) );
|
||||
}
|
||||
|
||||
searchField = new MEGuiTextField( fontRendererObj, this.guiLeft + Math.max( 82, xoffset ), this.guiTop + 6, 89, fontRendererObj.FONT_HEIGHT );
|
||||
searchField.setEnableBackgroundDrawing( false );
|
||||
searchField.setMaxStringLength( 25 );
|
||||
searchField.setTextColor( 0xFFFFFF );
|
||||
searchField.setVisible( true );
|
||||
|
||||
if ( viewCell || this instanceof GuiWirelessTerm )
|
||||
{
|
||||
buttonList.add( craftingStatusBtn = new GuiTabButton( this.guiLeft + 170, this.guiTop - 4, 2 + 11 * 16, GuiText.CraftingStatus.getLocal(),
|
||||
itemRender ) );
|
||||
craftingStatusBtn.hideEdge = 13;
|
||||
}
|
||||
|
||||
// Enum setting = AEConfig.instance.getSetting( "Terminal", SearchBoxMode.class, SearchBoxMode.AUTOSEARCH );
|
||||
Enum setting = AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE );
|
||||
searchField.setFocused( SearchBoxMode.AUTOSEARCH == setting || SearchBoxMode.NEI_AUTOSEARCH == setting );
|
||||
|
||||
if ( isSubGui() )
|
||||
{
|
||||
searchField.setText( memoryText );
|
||||
repo.searchString = memoryText;
|
||||
repo.updateView();
|
||||
setScrollBar();
|
||||
}
|
||||
|
||||
CraftingGridOffsetX = Integer.MAX_VALUE;
|
||||
CraftingGridOffsetY = Integer.MAX_VALUE;
|
||||
|
||||
for (Object s : inventorySlots.inventorySlots)
|
||||
{
|
||||
if ( s instanceof AppEngSlot )
|
||||
{
|
||||
if ( ((AppEngSlot) s).xDisplayPosition < 197 )
|
||||
repositionSlot( (AppEngSlot) s );
|
||||
}
|
||||
|
||||
if ( s instanceof SlotCraftingMatrix || s instanceof SlotFakeCraftingMatrix )
|
||||
{
|
||||
Slot g = (Slot) s;
|
||||
if ( g.xDisplayPosition > 0 && g.yDisplayPosition > 0 )
|
||||
{
|
||||
CraftingGridOffsetX = Math.min( CraftingGridOffsetX, g.xDisplayPosition );
|
||||
CraftingGridOffsetY = Math.min( CraftingGridOffsetY, g.yDisplayPosition );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CraftingGridOffsetX -= 25;
|
||||
CraftingGridOffsetY -= 6;
|
||||
}
|
||||
|
||||
protected void repositionSlot(AppEngSlot s)
|
||||
{
|
||||
s.yDisplayPosition = s.defY + ySize - 78 - 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
if ( btn == craftingStatusBtn )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_CRAFTING_STATUS ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
|
||||
if ( btn instanceof GuiImgButton )
|
||||
{
|
||||
boolean backwards = Mouse.isButtonDown( 1 );
|
||||
|
||||
GuiImgButton iBtn = (GuiImgButton) btn;
|
||||
if ( iBtn.getSetting() != Settings.ACTIONS )
|
||||
{
|
||||
Enum cv = iBtn.getCurrentValue();
|
||||
Enum next = Platform.rotateEnum( cv, backwards, iBtn.getSetting().getPossibleValues() );
|
||||
|
||||
if ( btn == terminalStyleBox )
|
||||
AEConfig.instance.settings.putSetting( iBtn.getSetting(), next );
|
||||
else if ( btn == searchBoxSettings )
|
||||
AEConfig.instance.settings.putSetting( iBtn.getSetting(), next );
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( iBtn.getSetting().name(), next.name() ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
|
||||
iBtn.set( next );
|
||||
|
||||
if ( next.getClass() == SearchBoxMode.class || next.getClass() == TerminalStyle.class )
|
||||
re_init();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int xCoord, int yCoord, int btn)
|
||||
{
|
||||
Enum setting = AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE );
|
||||
if ( !(SearchBoxMode.AUTOSEARCH == setting || SearchBoxMode.NEI_AUTOSEARCH == setting) )
|
||||
searchField.mouseClicked( xCoord, yCoord, btn );
|
||||
|
||||
if ( btn == 1 && searchField.isMouseIn( xCoord, yCoord ) )
|
||||
{
|
||||
searchField.setText( "" );
|
||||
repo.searchString = "";
|
||||
repo.updateView();
|
||||
setScrollBar();
|
||||
}
|
||||
|
||||
super.mouseClicked( xCoord, yCoord, btn );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char character, int key)
|
||||
{
|
||||
if ( !this.checkHotbarKeys( key ) )
|
||||
{
|
||||
if ( character == ' ' && this.searchField.getText().length() == 0 )
|
||||
return;
|
||||
|
||||
if ( searchField.textboxKeyTyped( character, key ) )
|
||||
{
|
||||
repo.searchString = this.searchField.getText();
|
||||
repo.updateView();
|
||||
setScrollBar();
|
||||
}
|
||||
else
|
||||
{
|
||||
super.keyTyped( character, key );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen()
|
||||
{
|
||||
repo.setPower( mecontainer.hasPower );
|
||||
super.updateScreen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
int x_width = 197;
|
||||
|
||||
bindTexture( getBackground() );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, x_width, 18 );
|
||||
|
||||
if ( viewCell || (this instanceof GuiSecurity) )
|
||||
this.drawTexturedModalRect( offsetX + x_width, offsetY, x_width, 0, 46, 128 );
|
||||
|
||||
for (int x = 0; x < rows; x++)
|
||||
this.drawTexturedModalRect( offsetX, offsetY + 18 + x * 18, 0, 18, x_width, 18 );
|
||||
|
||||
this.drawTexturedModalRect( offsetX, offsetY + 16 + rows * 18 + lowerTextureOffset, 0, 106 - 18 - 18, x_width, 99 + reservedSpace - lowerTextureOffset );
|
||||
|
||||
if ( viewCell )
|
||||
{
|
||||
boolean update = false;
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if ( myCurrentViewCells[i] != mecontainer.cellView[i].getStack() )
|
||||
{
|
||||
update = true;
|
||||
myCurrentViewCells[i] = mecontainer.cellView[i].getStack();
|
||||
}
|
||||
}
|
||||
|
||||
if ( update )
|
||||
repo.setViewCell( myCurrentViewCells );
|
||||
}
|
||||
|
||||
if ( searchField != null )
|
||||
searchField.drawTextBox();
|
||||
}
|
||||
|
||||
protected String getBackground()
|
||||
{
|
||||
return "guis/terminal.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString( getGuiDisplayName( myName.getLocal() ), 8, 6, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getSortBy()
|
||||
{
|
||||
return configSrc.getSetting( Settings.SORT_BY );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getSortDir()
|
||||
{
|
||||
return configSrc.getSetting( Settings.SORT_DIRECTION );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getSortDisplay()
|
||||
{
|
||||
return configSrc.getSetting( Settings.VIEW_MODE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
|
||||
{
|
||||
if ( SortByBox != null )
|
||||
SortByBox.set( configSrc.getSetting( Settings.SORT_BY ) );
|
||||
|
||||
if ( SortDirBox != null )
|
||||
SortDirBox.set( configSrc.getSetting( Settings.SORT_DIRECTION ) );
|
||||
|
||||
if ( ViewBox != null )
|
||||
ViewBox.set( configSrc.getSetting( Settings.VIEW_MODE ) );
|
||||
|
||||
repo.updateView();
|
||||
}
|
||||
|
||||
protected boolean isPowered()
|
||||
{
|
||||
return repo.hasPower();
|
||||
}
|
||||
|
||||
int getMaxRows()
|
||||
{
|
||||
return AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) == TerminalStyle.SMALL ? 6 : Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||
import appeng.container.implementations.ContainerMEPortableCell;
|
||||
|
||||
public class GuiMEPortableCell extends GuiMEMonitorable
|
||||
{
|
||||
|
||||
public GuiMEPortableCell(InventoryPlayer inventoryPlayer, IPortableCell te) {
|
||||
super( inventoryPlayer, te, new ContainerMEPortableCell( inventoryPlayer, null ) );
|
||||
}
|
||||
|
||||
int defaultGetMaxRows()
|
||||
{
|
||||
return super.getMaxRows();
|
||||
}
|
||||
|
||||
@Override
|
||||
int getMaxRows()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,295 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SortDir;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.ViewItems;
|
||||
import appeng.api.implementations.guiobjects.INetworkTool;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.client.me.ItemRepo;
|
||||
import appeng.client.me.SlotME;
|
||||
import appeng.container.implementations.ContainerNetworkStatus;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class GuiNetworkStatus extends AEBaseGui implements ISortSource
|
||||
{
|
||||
|
||||
ItemRepo repo;
|
||||
GuiImgButton units;
|
||||
|
||||
int rows = 4;
|
||||
|
||||
public GuiNetworkStatus(InventoryPlayer inventoryPlayer, INetworkTool te) {
|
||||
super( new ContainerNetworkStatus( inventoryPlayer, te ) );
|
||||
this.ySize = 153;
|
||||
this.xSize = 195;
|
||||
myScrollBar = new GuiScrollbar();
|
||||
repo = new ItemRepo( myScrollBar, this );
|
||||
repo.rowSize = 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
boolean backwards = Mouse.isButtonDown( 1 );
|
||||
|
||||
if ( btn == units )
|
||||
{
|
||||
AEConfig.instance.nextPowerUnit( backwards );
|
||||
units.set( AEConfig.instance.selectedPowerUnit() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
units = new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.POWER_UNITS, AEConfig.instance.selectedPowerUnit() );
|
||||
buttonList.add( units );
|
||||
}
|
||||
|
||||
public void postUpdate(List<IAEItemStack> list)
|
||||
{
|
||||
repo.clear();
|
||||
|
||||
for (IAEItemStack is : list)
|
||||
repo.postUpdate( is );
|
||||
|
||||
repo.updateView();
|
||||
setScrollBar();
|
||||
}
|
||||
|
||||
private void setScrollBar()
|
||||
{
|
||||
int size = repo.size();
|
||||
myScrollBar.setTop( 39 ).setLeft( 175 ).setHeight( 78 );
|
||||
myScrollBar.setRange( 0, (size + 4) / 5 - rows, 1 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/networkstatus.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
}
|
||||
|
||||
int tooltip = -1;
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouse_x, int mouse_y, float btn)
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
||||
int gx = (width - xSize) / 2;
|
||||
int gy = (height - ySize) / 2;
|
||||
|
||||
tooltip = -1;
|
||||
|
||||
for (int z = 0; z <= 4 * 5; z++)
|
||||
{
|
||||
int minX = gx + 14 + x * 31;
|
||||
int minY = gy + 41 + y * 18;
|
||||
|
||||
if ( minX < mouse_x && minX + 28 > mouse_x )
|
||||
{
|
||||
if ( minY < mouse_y && minY + 20 > mouse_y )
|
||||
{
|
||||
tooltip = z;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
x++;
|
||||
|
||||
if ( x > 4 )
|
||||
{
|
||||
y++;
|
||||
x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
super.drawScreen( mouse_x, mouse_y, btn );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
ContainerNetworkStatus ns = (ContainerNetworkStatus) inventorySlots;
|
||||
|
||||
fontRendererObj.drawString( GuiText.NetworkDetails.getLocal(), 8, 6, 4210752 );
|
||||
|
||||
fontRendererObj.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( ns.currentPower, false ), 13, 16, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( ns.maxPower, false ), 13, 26, 4210752 );
|
||||
|
||||
fontRendererObj.drawString( GuiText.PowerInputRate.getLocal() + ": " + Platform.formatPowerLong( ns.avgAddition, true ), 13, 143 - 10, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.PowerUsageRate.getLocal() + ": " + Platform.formatPowerLong( ns.powerUsage, true ), 13, 143 - 20, 4210752 );
|
||||
|
||||
int sectionLength = 30;
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int xo = 0 + 12;
|
||||
int yo = 0 + 42;
|
||||
int viewStart = 0;// myScrollBar.getCurrentScroll() * 5;
|
||||
int viewEnd = viewStart + 5 * 4;
|
||||
|
||||
String ToolTip = "";
|
||||
int toolPosX = 0;
|
||||
int toolPosY = 0;
|
||||
|
||||
for (int z = viewStart; z < Math.min( viewEnd, repo.size() ); z++)
|
||||
{
|
||||
IAEItemStack refStack = repo.getReferenceItem( z );
|
||||
if ( refStack != null )
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScaled( 0.5, 0.5, 0.5 );
|
||||
|
||||
String str = Long.toString( refStack.getStackSize() );
|
||||
if ( refStack.getStackSize() >= 10000 )
|
||||
str = Long.toString( refStack.getStackSize() / 1000 ) + "k";
|
||||
|
||||
int w = fontRendererObj.getStringWidth( str );
|
||||
fontRendererObj.drawString( str, (int) ((x * sectionLength + xo + sectionLength - 19 - ((float) w * 0.5)) * 2), (int) ((y * 18 + yo + 6) * 2),
|
||||
4210752 );
|
||||
|
||||
GL11.glPopMatrix();
|
||||
int posX = x * sectionLength + xo + sectionLength - 18;
|
||||
int posY = y * 18 + yo;
|
||||
|
||||
if ( tooltip == z - viewStart )
|
||||
{
|
||||
ToolTip = Platform.getItemDisplayName( repo.getItem( z ) );
|
||||
|
||||
ToolTip = ToolTip + ("\n" + GuiText.Installed.getLocal() + ": " + (refStack.getStackSize()));
|
||||
if ( refStack.getCountRequestable() > 0 )
|
||||
ToolTip = ToolTip + ("\n" + GuiText.EnergyDrain.getLocal() + ": " + Platform.formatPowerLong( refStack.getCountRequestable(), true ));
|
||||
|
||||
toolPosX = x * sectionLength + xo + sectionLength - 8;
|
||||
toolPosY = y * 18 + yo;
|
||||
}
|
||||
|
||||
drawItem( posX, posY, repo.getItem( z ) );
|
||||
|
||||
x++;
|
||||
|
||||
if ( x > 4 )
|
||||
{
|
||||
y++;
|
||||
x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( tooltip >= 0 && ToolTip.length() > 0 )
|
||||
{
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
drawTooltip( toolPosX, toolPosY + 10, 0, ToolTip );
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// @Override - NEI
|
||||
public List<String> handleItemTooltip(ItemStack stack, int mousex, int mousey, List<String> currenttip)
|
||||
{
|
||||
if ( stack != null )
|
||||
{
|
||||
Slot s = getSlot( mousex, mousey );
|
||||
if ( s instanceof SlotME )
|
||||
{
|
||||
IAEItemStack myStack = null;
|
||||
|
||||
try
|
||||
{
|
||||
SlotME theSlotField = (SlotME) s;
|
||||
myStack = theSlotField.getAEStack();
|
||||
}
|
||||
catch (Throwable ignore)
|
||||
{
|
||||
}
|
||||
|
||||
if ( myStack != null )
|
||||
{
|
||||
while (currenttip.size() > 1)
|
||||
currenttip.remove( 1 );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
// Vanilla version...
|
||||
protected void drawItemStackTooltip(ItemStack stack, int x, int y)
|
||||
{
|
||||
Slot s = getSlot( x, y );
|
||||
if ( s instanceof SlotME && stack != null )
|
||||
{
|
||||
IAEItemStack myStack = null;
|
||||
|
||||
try
|
||||
{
|
||||
SlotME theSlotField = (SlotME) s;
|
||||
myStack = theSlotField.getAEStack();
|
||||
}
|
||||
catch (Throwable ignore)
|
||||
{
|
||||
}
|
||||
|
||||
if ( myStack != null )
|
||||
{
|
||||
List currenttip = stack.getTooltip( this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips );
|
||||
|
||||
while (currenttip.size() > 1)
|
||||
currenttip.remove( 1 );
|
||||
|
||||
currenttip.add( GuiText.Installed.getLocal() + ": " + (myStack.getStackSize()) );
|
||||
currenttip.add( GuiText.EnergyDrain.getLocal() + ": " + Platform.formatPowerLong( myStack.getCountRequestable(), true ) );
|
||||
|
||||
drawTooltip( x, y, 0, join( currenttip, "\n" ) );
|
||||
}
|
||||
}
|
||||
// super.drawItemStackTooltip( stack, x, y );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getSortBy()
|
||||
{
|
||||
return SortOrder.NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getSortDir()
|
||||
{
|
||||
return SortDir.ASCENDING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getSortDisplay()
|
||||
{
|
||||
return ViewItems.ALL;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.api.implementations.guiobjects.INetworkTool;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiToggleButton;
|
||||
import appeng.container.implementations.ContainerNetworkTool;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
|
||||
public class GuiNetworkTool extends AEBaseGui
|
||||
{
|
||||
|
||||
GuiToggleButton tFacades;
|
||||
|
||||
public GuiNetworkTool(InventoryPlayer inventoryPlayer, INetworkTool te) {
|
||||
super( new ContainerNetworkTool( inventoryPlayer, te ) );
|
||||
this.ySize = 166;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
try
|
||||
{
|
||||
if ( btn == tFacades )
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "NetworkTool", "Toggle" ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
tFacades = new GuiToggleButton( this.guiLeft - 18, guiTop + 8, 23, 22, GuiText.TransparentFacades.getLocal(), GuiText.TransparentFacadesHint.getLocal() );
|
||||
|
||||
buttonList.add( tFacades );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/toolbox.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
if ( tFacades != null )
|
||||
tFacades.setState( ((ContainerNetworkTool) inventorySlots).facadeMode );
|
||||
|
||||
fontRendererObj.drawString( getGuiDisplayName( GuiText.NetworkTool.getLocal() ), 8, 6, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.container.implementations.ContainerPatternTerm;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
|
||||
public class GuiPatternTerm extends GuiMEMonitorable
|
||||
{
|
||||
|
||||
ContainerPatternTerm container;
|
||||
|
||||
GuiTabButton tabCraftButton;
|
||||
GuiTabButton tabProcessButton;
|
||||
// GuiImgButton substitutionsBtn;
|
||||
GuiImgButton encodeBtn;
|
||||
GuiImgButton clearBtn;
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
buttonList.add( tabCraftButton = new GuiTabButton( this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack( Blocks.crafting_table ),
|
||||
GuiText.CraftingPattern.getLocal(), itemRender ) );
|
||||
buttonList.add( tabProcessButton = new GuiTabButton( this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack( Blocks.furnace ),
|
||||
GuiText.ProcessingPattern.getLocal(), itemRender ) );
|
||||
|
||||
// buttonList.add( substitutionsBtn = new GuiImgButton( this.guiLeft + 84, this.guiTop + this.ySize - 163,
|
||||
// Settings.ACTIONS, ActionItems.SUBSTITUTION ) );
|
||||
// substitutionsBtn.halfSize = true;
|
||||
|
||||
buttonList.add( clearBtn = new GuiImgButton( this.guiLeft + 74, this.guiTop + this.ySize - 163, Settings.ACTIONS, ActionItems.CLOSE ) );
|
||||
clearBtn.halfSize = true;
|
||||
|
||||
buttonList.add( encodeBtn = new GuiImgButton( this.guiLeft + 147, this.guiTop + this.ySize - 142, Settings.ACTIONS, ActionItems.ENCODE ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
if ( tabCraftButton == btn || tabProcessButton == btn )
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "PatternTerminal.CraftMode", tabProcessButton == btn ? "1" : "0" ) );
|
||||
}
|
||||
|
||||
if ( encodeBtn == btn )
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "PatternTerminal.Encode", "1" ) );
|
||||
}
|
||||
|
||||
if ( clearBtn == btn )
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "PatternTerminal.Clear", "1" ) );
|
||||
}
|
||||
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// if ( substitutionsBtn == btn )
|
||||
// {
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
protected void repositionSlot(AppEngSlot s)
|
||||
{
|
||||
if ( s.isPlayerSide() )
|
||||
s.yDisplayPosition = s.defY + ySize - 78 - 5;
|
||||
else
|
||||
s.yDisplayPosition = s.defY + ySize - 78 - 3;
|
||||
}
|
||||
|
||||
public GuiPatternTerm(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||
super( inventoryPlayer, te, new ContainerPatternTerm( inventoryPlayer, te ) );
|
||||
container = (ContainerPatternTerm) this.inventorySlots;
|
||||
reservedSpace = 81;
|
||||
}
|
||||
|
||||
protected String getBackground()
|
||||
{
|
||||
if ( container.craftingMode )
|
||||
return "guis/pattern.png";
|
||||
return "guis/pattern2.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
if ( !container.craftingMode )
|
||||
{
|
||||
tabCraftButton.visible = false;
|
||||
tabProcessButton.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
tabCraftButton.visible = true;
|
||||
tabProcessButton.visible = false;
|
||||
}
|
||||
|
||||
super.drawFG( offsetX, offsetY, mouseX, mouseY );
|
||||
fontRendererObj.drawString( GuiText.PatternTerminal.getLocal(), 8, ySize - 96 + 2 - reservedSpace, 4210752 );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiNumberBox;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.implementations.ContainerPriority;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.helpers.IPriorityHost;
|
||||
import appeng.parts.automation.PartFormationPlane;
|
||||
import appeng.parts.misc.PartInterface;
|
||||
import appeng.parts.misc.PartStorageBus;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
import appeng.tile.storage.TileChest;
|
||||
import appeng.tile.storage.TileDrive;
|
||||
|
||||
public class GuiPriority extends AEBaseGui
|
||||
{
|
||||
|
||||
GuiNumberBox priority;
|
||||
GuiTabButton originalGuiBtn;
|
||||
|
||||
GuiButton plus1, plus10, plus100, plus1000;
|
||||
GuiButton minus1, minus10, minus100, minus1000;
|
||||
|
||||
GuiBridge OriginalGui;
|
||||
|
||||
public GuiPriority(InventoryPlayer inventoryPlayer, IPriorityHost te) {
|
||||
super( new ContainerPriority( inventoryPlayer, te ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
int a = AEConfig.instance.priorityByStacksAmounts( 0 );
|
||||
int b = AEConfig.instance.priorityByStacksAmounts( 1 );
|
||||
int c = AEConfig.instance.priorityByStacksAmounts( 2 );
|
||||
int d = AEConfig.instance.priorityByStacksAmounts( 3 );
|
||||
|
||||
buttonList.add( plus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 32, 22, 20, "+" + a ) );
|
||||
buttonList.add( plus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 32, 28, 20, "+" + b ) );
|
||||
buttonList.add( plus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 32, 32, 20, "+" + c ) );
|
||||
buttonList.add( plus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 32, 38, 20, "+" + d ) );
|
||||
|
||||
buttonList.add( minus1 = new GuiButton( 0, this.guiLeft + 20, this.guiTop + 69, 22, 20, "-" + a ) );
|
||||
buttonList.add( minus10 = new GuiButton( 0, this.guiLeft + 48, this.guiTop + 69, 28, 20, "-" + b ) );
|
||||
buttonList.add( minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 69, 32, 20, "-" + c ) );
|
||||
buttonList.add( minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 69, 38, 20, "-" + d ) );
|
||||
|
||||
ItemStack myIcon = null;
|
||||
Object target = ((AEBaseContainer) inventorySlots).getTarget();
|
||||
|
||||
if ( target instanceof PartStorageBus )
|
||||
{
|
||||
myIcon = AEApi.instance().parts().partStorageBus.stack( 1 );
|
||||
OriginalGui = GuiBridge.GUI_STORAGEBUS;
|
||||
}
|
||||
|
||||
if ( target instanceof PartFormationPlane )
|
||||
{
|
||||
myIcon = AEApi.instance().parts().partFormationPlane.stack( 1 );
|
||||
OriginalGui = GuiBridge.GUI_FPLANE;
|
||||
}
|
||||
|
||||
if ( target instanceof TileDrive )
|
||||
{
|
||||
myIcon = AEApi.instance().blocks().blockDrive.stack( 1 );
|
||||
OriginalGui = GuiBridge.GUI_DRIVE;
|
||||
}
|
||||
|
||||
if ( target instanceof TileChest )
|
||||
{
|
||||
myIcon = AEApi.instance().blocks().blockChest.stack( 1 );
|
||||
OriginalGui = GuiBridge.GUI_CHEST;
|
||||
}
|
||||
|
||||
if ( target instanceof TileInterface )
|
||||
{
|
||||
myIcon = AEApi.instance().blocks().blockInterface.stack( 1 );
|
||||
OriginalGui = GuiBridge.GUI_INTERFACE;
|
||||
}
|
||||
|
||||
if ( target instanceof PartInterface )
|
||||
{
|
||||
myIcon = AEApi.instance().parts().partInterface.stack( 1 );
|
||||
OriginalGui = GuiBridge.GUI_INTERFACE;
|
||||
}
|
||||
|
||||
if ( OriginalGui != null )
|
||||
buttonList.add( originalGuiBtn = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender ) );
|
||||
|
||||
priority = new GuiNumberBox( fontRendererObj, this.guiLeft + 62, this.guiTop + 57, 59, fontRendererObj.FONT_HEIGHT, Long.class );
|
||||
priority.setEnableBackgroundDrawing( false );
|
||||
priority.setMaxStringLength( 16 );
|
||||
priority.setTextColor( 0xFFFFFF );
|
||||
priority.setVisible( true );
|
||||
priority.setFocused( true );
|
||||
((ContainerPriority) inventorySlots).setTextField( priority );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
if ( btn == originalGuiBtn )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( OriginalGui ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
|
||||
boolean isPlus = btn == plus1 || btn == plus10 || btn == plus100 || btn == plus1000;
|
||||
boolean isMinus = btn == minus1 || btn == minus10 || btn == minus100 || btn == minus1000;
|
||||
|
||||
if ( isPlus || isMinus )
|
||||
addQty( getQty( btn ) );
|
||||
}
|
||||
|
||||
private void addQty(int i)
|
||||
{
|
||||
try
|
||||
{
|
||||
String Out = priority.getText();
|
||||
|
||||
boolean Fixed = false;
|
||||
while (Out.startsWith( "0" ) && Out.length() > 1)
|
||||
{
|
||||
Out = Out.substring( 1 );
|
||||
Fixed = true;
|
||||
}
|
||||
|
||||
if ( Fixed )
|
||||
priority.setText( Out );
|
||||
|
||||
if ( Out.length() == 0 )
|
||||
Out = "0";
|
||||
|
||||
long result = Long.parseLong( Out );
|
||||
result += i;
|
||||
|
||||
priority.setText( Out = Long.toString( result ) );
|
||||
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "PriorityHost.Priority", Out ) );
|
||||
}
|
||||
catch(NumberFormatException e )
|
||||
{
|
||||
// nope..
|
||||
priority.setText( "0" );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char character, int key)
|
||||
{
|
||||
if ( !this.checkHotbarKeys( key ) )
|
||||
{
|
||||
if ( (key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit( character ))
|
||||
&& priority.textboxKeyTyped( character, key ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
String Out = priority.getText();
|
||||
|
||||
boolean Fixed = false;
|
||||
while (Out.startsWith( "0" ) && Out.length() > 1)
|
||||
{
|
||||
Out = Out.substring( 1 );
|
||||
Fixed = true;
|
||||
}
|
||||
|
||||
if ( Fixed )
|
||||
priority.setText( Out );
|
||||
|
||||
if ( Out.length() == 0 )
|
||||
Out = "0";
|
||||
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "PriorityHost.Priority", Out ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.keyTyped( character, key );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/priority.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
|
||||
priority.drawTextBox();
|
||||
}
|
||||
|
||||
protected String getBackground()
|
||||
{
|
||||
return "guis/priority.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString( GuiText.Priority.getLocal(), 8, 6, 4210752 );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.container.implementations.ContainerQNB;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
|
||||
public class GuiQNB extends AEBaseGui
|
||||
{
|
||||
|
||||
public GuiQNB(InventoryPlayer inventoryPlayer, TileQuantumBridge te) {
|
||||
super( new ContainerQNB( inventoryPlayer, te ) );
|
||||
this.ySize = 166;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/chest.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString( getGuiDisplayName( GuiText.QuantumLinkChamber.getLocal() ), 8, 6, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.container.implementations.ContainerQuartzKnife;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.items.contents.QuartzKnifeObj;
|
||||
|
||||
public class GuiQuartzKnife extends AEBaseGui
|
||||
{
|
||||
|
||||
GuiTextField name;
|
||||
|
||||
public GuiQuartzKnife(InventoryPlayer inventoryPlayer, QuartzKnifeObj te) {
|
||||
super( new ContainerQuartzKnife( inventoryPlayer, te ) );
|
||||
this.ySize = 184;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
name = new GuiTextField( fontRendererObj, this.guiLeft + 24, this.guiTop + 32, 79, fontRendererObj.FONT_HEIGHT );
|
||||
name.setEnableBackgroundDrawing( false );
|
||||
name.setMaxStringLength( 32 );
|
||||
name.setTextColor( 0xFFFFFF );
|
||||
name.setVisible( true );
|
||||
name.setFocused( true );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/quartzknife.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
name.drawTextBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char character, int key)
|
||||
{
|
||||
if ( name.textboxKeyTyped( character, key ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
String Out = name.getText();
|
||||
((ContainerQuartzKnife) inventorySlots).setName( Out );
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "QuartzKnife.Name", Out ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.keyTyped( character, key );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString( getGuiDisplayName( GuiText.QuartzCuttingKnife.getLocal() ), 8, 6, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.widgets.GuiToggleButton;
|
||||
import appeng.container.implementations.ContainerSecurity;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
|
||||
public class GuiSecurity extends GuiMEMonitorable
|
||||
{
|
||||
|
||||
public GuiSecurity(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||
super( inventoryPlayer, te, new ContainerSecurity( inventoryPlayer, te ) );
|
||||
customSortOrder = false;
|
||||
reservedSpace = 33;
|
||||
|
||||
// increase size so that the slot is over the gui.
|
||||
xSize += 56;
|
||||
standardSize = xSize;
|
||||
}
|
||||
|
||||
GuiToggleButton inject, extract, craft, build, security;
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
int top = this.guiTop + this.ySize - 116;
|
||||
buttonList.add( inject = new GuiToggleButton( this.guiLeft + 56 + 18 * 0, top, 11 * 16 + 0, 12 * 16 + 0, SecurityPermissions.INJECT
|
||||
.getUnlocalizedName(), SecurityPermissions.INJECT.getUnlocalizedTip() ) );
|
||||
|
||||
buttonList.add( extract = new GuiToggleButton( this.guiLeft + 56 + 18 * 1, top, 11 * 16 + 1, 12 * 16 + 1, SecurityPermissions.EXTRACT
|
||||
.getUnlocalizedName(), SecurityPermissions.EXTRACT.getUnlocalizedTip() ) );
|
||||
|
||||
buttonList.add( craft = new GuiToggleButton( this.guiLeft + 56 + 18 * 2, top, 11 * 16 + 2, 12 * 16 + 2, SecurityPermissions.CRAFT.getUnlocalizedName(),
|
||||
SecurityPermissions.CRAFT.getUnlocalizedTip() ) );
|
||||
|
||||
buttonList.add( build = new GuiToggleButton( this.guiLeft + 56 + 18 * 3, top, 11 * 16 + 3, 12 * 16 + 3, SecurityPermissions.BUILD.getUnlocalizedName(),
|
||||
SecurityPermissions.BUILD.getUnlocalizedTip() ) );
|
||||
|
||||
buttonList.add( security = new GuiToggleButton( this.guiLeft + 56 + 18 * 4, top, 11 * 16 + 4, 12 * 16 + 4, SecurityPermissions.SECURITY
|
||||
.getUnlocalizedName(), SecurityPermissions.SECURITY.getUnlocalizedTip() ) );
|
||||
}
|
||||
|
||||
protected void actionPerformed(net.minecraft.client.gui.GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
SecurityPermissions toggleSetting = null;
|
||||
|
||||
if ( btn == inject )
|
||||
toggleSetting = SecurityPermissions.INJECT;
|
||||
if ( btn == extract )
|
||||
toggleSetting = SecurityPermissions.EXTRACT;
|
||||
if ( btn == craft )
|
||||
toggleSetting = SecurityPermissions.CRAFT;
|
||||
if ( btn == build )
|
||||
toggleSetting = SecurityPermissions.BUILD;
|
||||
if ( btn == security )
|
||||
toggleSetting = SecurityPermissions.SECURITY;
|
||||
|
||||
if ( toggleSetting != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "TileSecurity.ToggleOption", toggleSetting.name() ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
protected String getBackground()
|
||||
{
|
||||
ContainerSecurity cs = (ContainerSecurity) inventorySlots;
|
||||
|
||||
inject.setState( (cs.security & (1 << SecurityPermissions.INJECT.ordinal())) > 0 );
|
||||
extract.setState( (cs.security & (1 << SecurityPermissions.EXTRACT.ordinal())) > 0 );
|
||||
craft.setState( (cs.security & (1 << SecurityPermissions.CRAFT.ordinal())) > 0 );
|
||||
build.setState( (cs.security & (1 << SecurityPermissions.BUILD.ordinal())) > 0 );
|
||||
security.setState( (cs.security & (1 << SecurityPermissions.SECURITY.ordinal())) > 0 );
|
||||
|
||||
return "guis/security.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawFG( offsetX, offsetY, mouseX, mouseY );
|
||||
fontRendererObj.drawString( GuiText.SecurityCardEditor.getLocal(), 8, ySize - 96 + 1 - reservedSpace, 4210752 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum getSortBy()
|
||||
{
|
||||
return SortOrder.NAME;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.container.implementations.ContainerSkyChest;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.tile.storage.TileSkyChest;
|
||||
|
||||
public class GuiSkyChest extends AEBaseGui
|
||||
{
|
||||
|
||||
public GuiSkyChest(InventoryPlayer inventoryPlayer, TileSkyChest te) {
|
||||
super( new ContainerSkyChest( inventoryPlayer, te ) );
|
||||
this.ySize = 195;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/skychest.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString( getGuiDisplayName( GuiText.SkyChest.getLocal() ), 8, 8, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 2, 4210752 );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean enableSpaceClicking()
|
||||
{
|
||||
return !AppEng.instance.isIntegrationEnabled( IntegrationType.InvTweaks );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.container.implementations.ContainerSpatialIOPort;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.tile.spatial.TileSpatialIOPort;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class GuiSpatialIOPort extends AEBaseGui
|
||||
{
|
||||
|
||||
ContainerSpatialIOPort csiop;
|
||||
GuiImgButton units;
|
||||
|
||||
public GuiSpatialIOPort(InventoryPlayer inventoryPlayer, TileSpatialIOPort te) {
|
||||
super( new ContainerSpatialIOPort( inventoryPlayer, te ) );
|
||||
this.ySize = 199;
|
||||
csiop = (ContainerSpatialIOPort) inventorySlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
boolean backwards = Mouse.isButtonDown( 1 );
|
||||
|
||||
if ( btn == units )
|
||||
{
|
||||
AEConfig.instance.nextPowerUnit( backwards );
|
||||
units.set( AEConfig.instance.selectedPowerUnit() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
units = new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.POWER_UNITS, AEConfig.instance.selectedPowerUnit() );
|
||||
buttonList.add( units );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/spatialio.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( csiop.currentPower, false ), 13, 21, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( csiop.maxPower, false ), 13, 31, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.RequiredPower.getLocal() + ": " + Platform.formatPowerLong( csiop.reqPower, false ), 13, 78, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.Efficiency.getLocal() + ": " + (((float) csiop.eff) / 100) + "%", 13, 88, 4210752 );
|
||||
|
||||
fontRendererObj.drawString( getGuiDisplayName( GuiText.SpatialIOPort.getLocal() ), 8, 6, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96, 4210752 );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.StorageFilter;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.container.implementations.ContainerStorageBus;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketConfigButton;
|
||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.parts.misc.PartStorageBus;
|
||||
|
||||
public class GuiStorageBus extends GuiUpgradeable
|
||||
{
|
||||
|
||||
GuiImgButton rwMode;
|
||||
GuiImgButton storageFilter;
|
||||
GuiTabButton priority;
|
||||
GuiImgButton partition;
|
||||
GuiImgButton clear;
|
||||
|
||||
public GuiStorageBus(InventoryPlayer inventoryPlayer, PartStorageBus te) {
|
||||
super( new ContainerStorageBus( inventoryPlayer, te ) );
|
||||
this.ySize = 251;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawBG( offsetX, offsetY, mouseX, mouseY );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString( getGuiDisplayName( GuiText.StorageBus.getLocal() ), 8, 6, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
|
||||
if ( fuzzyMode != null )
|
||||
fuzzyMode.set( cvb.fzMode );
|
||||
|
||||
if ( storageFilter != null )
|
||||
storageFilter.set( ((ContainerStorageBus) cvb).storageFilter );
|
||||
|
||||
if ( rwMode != null )
|
||||
rwMode.set( ((ContainerStorageBus) cvb).rwMode );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addButtons()
|
||||
{
|
||||
clear = new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.ACTIONS, ActionItems.CLOSE );
|
||||
partition = new GuiImgButton( this.guiLeft - 18, guiTop + 28, Settings.ACTIONS, ActionItems.WRENCH );
|
||||
rwMode = new GuiImgButton( this.guiLeft - 18, guiTop + 48, Settings.ACCESS, AccessRestriction.READ_WRITE );
|
||||
storageFilter = new GuiImgButton( this.guiLeft - 18, guiTop + 68, Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY );
|
||||
fuzzyMode = new GuiImgButton( this.guiLeft - 18, guiTop + 88, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
||||
|
||||
buttonList.add( priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), itemRender ) );
|
||||
|
||||
buttonList.add( storageFilter );
|
||||
buttonList.add( fuzzyMode );
|
||||
buttonList.add( rwMode );
|
||||
buttonList.add( partition );
|
||||
buttonList.add( clear );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
boolean backwards = Mouse.isButtonDown( 1 );
|
||||
|
||||
try
|
||||
{
|
||||
if ( btn == partition )
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "StorageBus.Action", "Partition" ) );
|
||||
|
||||
else if ( btn == clear )
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "StorageBus.Action", "Clear" ) );
|
||||
|
||||
else if ( btn == priority )
|
||||
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
|
||||
|
||||
else if ( btn == fuzzyMode )
|
||||
NetworkHandler.instance.sendToServer( new PacketConfigButton( fuzzyMode.getSetting(), backwards ) );
|
||||
|
||||
else if ( btn == rwMode )
|
||||
NetworkHandler.instance.sendToServer( new PacketConfigButton( rwMode.getSetting(), backwards ) );
|
||||
|
||||
else if ( btn == storageFilter )
|
||||
NetworkHandler.instance.sendToServer( new PacketConfigButton( storageFilter.getSetting(), backwards ) );
|
||||
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
|
||||
protected String getBackground()
|
||||
{
|
||||
return "guis/storagebus.png";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.implementations.IUpgradeableHost;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.container.implementations.ContainerUpgradeable;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketConfigButton;
|
||||
import appeng.parts.automation.PartImportBus;
|
||||
|
||||
public class GuiUpgradeable extends AEBaseGui
|
||||
{
|
||||
|
||||
ContainerUpgradeable cvb;
|
||||
IUpgradeableHost bc;
|
||||
|
||||
GuiImgButton redstoneMode;
|
||||
GuiImgButton fuzzyMode;
|
||||
GuiImgButton craftMode;
|
||||
|
||||
public GuiUpgradeable(InventoryPlayer inventoryPlayer, IUpgradeableHost te) {
|
||||
this( new ContainerUpgradeable( inventoryPlayer, te ) );
|
||||
}
|
||||
|
||||
public GuiUpgradeable(ContainerUpgradeable te) {
|
||||
super( te );
|
||||
cvb = (ContainerUpgradeable) te;
|
||||
|
||||
bc = (IUpgradeableHost) te.getTarget();
|
||||
this.xSize = hasToolbox() ? 246 : 211;
|
||||
this.ySize = 184;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
addButtons();
|
||||
}
|
||||
|
||||
protected void addButtons()
|
||||
{
|
||||
redstoneMode = new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
|
||||
fuzzyMode = new GuiImgButton( this.guiLeft - 18, guiTop + 28, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
||||
craftMode = new GuiImgButton( this.guiLeft - 18, guiTop + 48, Settings.CRAFT_ONLY, YesNo.NO );
|
||||
|
||||
buttonList.add( craftMode );
|
||||
buttonList.add( redstoneMode );
|
||||
buttonList.add( fuzzyMode );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
boolean backwards = Mouse.isButtonDown( 1 );
|
||||
|
||||
try
|
||||
{
|
||||
if ( btn == redstoneMode )
|
||||
NetworkHandler.instance.sendToServer( new PacketConfigButton( redstoneMode.getSetting(), backwards ) );
|
||||
|
||||
if ( btn == craftMode )
|
||||
NetworkHandler.instance.sendToServer( new PacketConfigButton( craftMode.getSetting(), backwards ) );
|
||||
|
||||
if ( btn == fuzzyMode )
|
||||
NetworkHandler.instance.sendToServer( new PacketConfigButton( fuzzyMode.getSetting(), backwards ) );
|
||||
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean hasToolbox()
|
||||
{
|
||||
return ((ContainerUpgradeable) inventorySlots).hasToolbox();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
handleButtonVisibility();
|
||||
|
||||
bindTexture( getBackground() );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, 211 - 34, ySize );
|
||||
if ( drawUpgrades() )
|
||||
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 14 + cvb.availableUpgrades() * 18 );
|
||||
if ( hasToolbox() )
|
||||
this.drawTexturedModalRect( offsetX + 178, offsetY + ySize - 90, 178, ySize - 90, 68, 68 );
|
||||
}
|
||||
|
||||
protected boolean drawUpgrades()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getBackground()
|
||||
{
|
||||
return "guis/bus.png";
|
||||
}
|
||||
|
||||
protected void handleButtonVisibility()
|
||||
{
|
||||
if ( redstoneMode != null )
|
||||
redstoneMode.setVisibility( bc.getInstalledUpgrades( Upgrades.REDSTONE ) > 0 );
|
||||
if ( fuzzyMode != null )
|
||||
fuzzyMode.setVisibility( bc.getInstalledUpgrades( Upgrades.FUZZY ) > 0 );
|
||||
if ( craftMode != null )
|
||||
craftMode.setVisibility( bc.getInstalledUpgrades( Upgrades.CRAFTING ) > 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString( getGuiDisplayName( getName().getLocal() ), 8, 6, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
|
||||
if ( redstoneMode != null )
|
||||
redstoneMode.set( cvb.rsMode );
|
||||
|
||||
if ( fuzzyMode != null )
|
||||
fuzzyMode.set( cvb.fzMode );
|
||||
|
||||
if ( craftMode != null )
|
||||
craftMode.set( cvb.cMode );
|
||||
}
|
||||
|
||||
protected GuiText getName()
|
||||
{
|
||||
return bc instanceof PartImportBus ? GuiText.ImportBus : GuiText.ExportBus;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiProgressBar;
|
||||
import appeng.client.gui.widgets.GuiProgressBar.Direction;
|
||||
import appeng.container.implementations.ContainerVibrationChamber;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.tile.misc.TileVibrationChamber;
|
||||
|
||||
public class GuiVibrationChamber extends AEBaseGui
|
||||
{
|
||||
|
||||
ContainerVibrationChamber cvc;
|
||||
GuiProgressBar pb;
|
||||
|
||||
public GuiVibrationChamber(InventoryPlayer inventoryPlayer, TileVibrationChamber te) {
|
||||
super( new ContainerVibrationChamber( inventoryPlayer, te ) );
|
||||
cvc = (ContainerVibrationChamber) inventorySlots;
|
||||
this.ySize = 166;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
pb = new GuiProgressBar( "guis/vibchamber.png", 99, 36, 176, 14, 6, 18, Direction.VERTICAL );
|
||||
this.buttonList.add( pb );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/vibchamber.png" );
|
||||
pb.xPosition = 99 + guiLeft;
|
||||
pb.yPosition = 36 + guiTop;
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString( getGuiDisplayName( GuiText.VibrationChamber.getLocal() ), 8, 6, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
|
||||
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";
|
||||
|
||||
if ( cvc.burnProgress > 0 )
|
||||
{
|
||||
int i1 = cvc.burnProgress;
|
||||
bindTexture( "guis/vibchamber.png" );
|
||||
GL11.glColor3f( 1, 1, 1 );
|
||||
this.drawTexturedModalRect( k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2 );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.container.implementations.ContainerWireless;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.tile.networking.TileWireless;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class GuiWireless extends AEBaseGui
|
||||
{
|
||||
|
||||
GuiImgButton units;
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
boolean backwards = Mouse.isButtonDown( 1 );
|
||||
|
||||
if ( btn == units )
|
||||
{
|
||||
AEConfig.instance.nextPowerUnit( backwards );
|
||||
units.set( AEConfig.instance.selectedPowerUnit() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
units = new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.POWER_UNITS, AEConfig.instance.selectedPowerUnit() );
|
||||
buttonList.add( units );
|
||||
}
|
||||
|
||||
public GuiWireless(InventoryPlayer inventoryPlayer, TileWireless te) {
|
||||
super( new ContainerWireless( inventoryPlayer, te ) );
|
||||
this.ySize = 166;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/wireless.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString( getGuiDisplayName( GuiText.Wireless.getLocal() ), 8, 6, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
|
||||
ContainerWireless cw = (ContainerWireless) inventorySlots;
|
||||
|
||||
if ( cw.range > 0 )
|
||||
{
|
||||
String msga = GuiText.Range.getLocal() + ": " + ((double) cw.range / 10.0) + " m";
|
||||
String msgb = GuiText.PowerUsageRate.getLocal() + ": " + Platform.formatPowerLong( cw.drain, true );
|
||||
|
||||
int strWidth = Math.max( fontRendererObj.getStringWidth( msga ), fontRendererObj.getStringWidth( msgb ) );
|
||||
int cOffset = (this.xSize / 2) - (strWidth / 2);
|
||||
fontRendererObj.drawString( msga, cOffset, 20, 4210752 );
|
||||
fontRendererObj.drawString( msgb, cOffset, 20 + 12, 4210752 );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||
|
||||
public class GuiWirelessTerm extends GuiMEPortableCell
|
||||
{
|
||||
|
||||
public GuiWirelessTerm(InventoryPlayer inventoryPlayer, IPortableCell te) {
|
||||
super( inventoryPlayer, te );
|
||||
maxRows = Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
int getMaxRows()
|
||||
{
|
||||
return defaultGetMaxRows();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user