Basic reformat, hit once, hope never again

This commit is contained in:
thatsIch
2015-04-03 08:54:31 +02:00
parent 4ff1631f89
commit d34c988c88
886 changed files with 31400 additions and 30990 deletions
+15 -15
View File
@@ -613,6 +613,21 @@ public abstract class AEBaseGui extends GuiContainer
this.subGui = true; // in case the gui is reopened later ( i'm looking at you NEI )
}
protected Slot getSlot( int mouseX, int mouseY )
{
final List<Slot> slots = this.getInventorySlots();
for( Slot slot : slots )
{
// isPointInRegion
if( this.func_146978_c( slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, mouseX, mouseY ) )
{
return slot;
}
}
return null;
}
public abstract void drawBG( int offsetX, int offsetY, int mouseX, int mouseY );
@Override
@@ -652,21 +667,6 @@ public abstract class AEBaseGui extends GuiContainer
}
}
protected Slot getSlot( int mouseX, int mouseY )
{
final List<Slot> slots = this.getInventorySlots();
for( Slot slot : slots )
{
// isPointInRegion
if( this.func_146978_c( slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, mouseX, mouseY ) )
{
return slot;
}
}
return null;
}
protected boolean enableSpaceClicking()
{
return true;
@@ -18,6 +18,7 @@
package appeng.client.gui;
import java.text.NumberFormat;
import java.util.List;
import java.util.Locale;
@@ -30,19 +31,21 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.client.me.SlotME;
import appeng.core.AEConfig;
public abstract class AEBaseMEGui extends AEBaseGui
{
public AEBaseMEGui(Container container) {
public AEBaseMEGui( Container container )
{
super( container );
}
public List<String> handleItemTooltip(ItemStack stack, int mouseX, int mouseY, List<String> currentToolTip)
public List<String> handleItemTooltip( ItemStack stack, int mouseX, int mouseY, List<String> currentToolTip )
{
if ( stack != null )
if( stack != null )
{
Slot s = this.getSlot( mouseX, mouseY );
if ( s instanceof SlotME )
if( s instanceof SlotME )
{
int BigNumber = AEConfig.instance.useTerminalUseLargeFont() ? 999 : 9999;
@@ -53,19 +56,19 @@ public abstract class AEBaseMEGui extends AEBaseGui
SlotME theSlotField = (SlotME) s;
myStack = theSlotField.getAEStack();
}
catch (Throwable ignore)
catch( Throwable ignore )
{
}
if ( myStack != null )
if( myStack != null )
{
if ( myStack.getStackSize() > BigNumber || (myStack.getStackSize() > 1 && stack.isItemDamaged()) )
if( myStack.getStackSize() > BigNumber || ( myStack.getStackSize() > 1 && stack.isItemDamaged() ) )
currentToolTip.add( "\u00a77Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( myStack.getStackSize() ) );
if ( myStack.getCountRequestable() > 0 )
if( myStack.getCountRequestable() > 0 )
currentToolTip.add( "\u00a77Items Requestable: " + NumberFormat.getNumberInstance( Locale.US ).format( myStack.getCountRequestable() ) );
}
else if ( stack.stackSize > BigNumber || (stack.stackSize > 1 && stack.isItemDamaged()) )
else if( stack.stackSize > BigNumber || ( stack.stackSize > 1 && stack.isItemDamaged() ) )
{
currentToolTip.add( "\u00a77Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( stack.stackSize ) );
}
@@ -77,10 +80,10 @@ public abstract class AEBaseMEGui extends AEBaseGui
// Vanilla version...
// protected void drawItemStackTooltip(ItemStack stack, int x, int y)
@Override
protected void renderToolTip(ItemStack stack, int x, int y)
protected void renderToolTip( ItemStack stack, int x, int y )
{
Slot s = this.getSlot( x, y );
if ( s instanceof SlotME && stack != null )
if( s instanceof SlotME && stack != null )
{
int BigNumber = AEConfig.instance.useTerminalUseLargeFont() ? 999 : 9999;
@@ -91,24 +94,24 @@ public abstract class AEBaseMEGui extends AEBaseGui
SlotME theSlotField = (SlotME) s;
myStack = theSlotField.getAEStack();
}
catch (Throwable ignore)
catch( Throwable ignore )
{
}
if ( myStack != null )
if( myStack != null )
{
@SuppressWarnings( "unchecked" )
List<String> currentToolTip = stack.getTooltip( this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips );
if ( myStack.getStackSize() > BigNumber || (myStack.getStackSize() > 1 && stack.isItemDamaged()) )
if( myStack.getStackSize() > BigNumber || ( myStack.getStackSize() > 1 && stack.isItemDamaged() ) )
currentToolTip.add( "Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( myStack.getStackSize() ) );
if ( myStack.getCountRequestable() > 0 )
if( myStack.getCountRequestable() > 0 )
currentToolTip.add( "Items Requestable: " + NumberFormat.getNumberInstance( Locale.US ).format( myStack.getCountRequestable() ) );
this.drawTooltip( x, y, 0, join( currentToolTip, "\n" ) );
}
else if ( stack.stackSize > BigNumber )
else if( stack.stackSize > BigNumber )
{
List var4 = stack.getTooltip( this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips );
var4.add( "Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( stack.stackSize ) );
@@ -119,5 +122,4 @@ public abstract class AEBaseMEGui extends AEBaseGui
super.renderToolTip( stack, x, y );
// super.drawItemStackTooltip( stack, x, y );
}
}
+7 -5
View File
@@ -18,24 +18,26 @@
package appeng.client.gui;
import net.minecraft.inventory.Container;
public class GuiNull extends AEBaseGui
{
public GuiNull(Container container) {
public GuiNull( Container container )
{
super( container );
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
}
}
}
@@ -32,24 +32,30 @@ import cpw.mods.fml.client.config.IConfigElement;
import appeng.core.AEConfig;
import appeng.core.AppEng;
public class AEConfigGui extends GuiConfig
{
public AEConfigGui( GuiScreen parent )
{
super( parent, getConfigElements(), AppEng.MOD_ID, false, false, GuiConfig.getAbridgedConfigPath( AEConfig.instance.getFilePath() ) );
}
private static List<IConfigElement> getConfigElements()
{
List<IConfigElement> list = new ArrayList<IConfigElement>();
for (String cat : AEConfig.instance.getCategoryNames())
for( String cat : AEConfig.instance.getCategoryNames() )
{
if ( cat.equals( "versionchecker" ) )
if( cat.equals( "versionchecker" ) )
continue;
if ( cat.equals( "settings" ) )
if( cat.equals( "settings" ) )
continue;
ConfigCategory cc = AEConfig.instance.getCategory( cat );
if ( cc.isChild() )
if( cc.isChild() )
continue;
ConfigElement ce = new ConfigElement( cc );
@@ -58,9 +64,4 @@ public class AEConfigGui extends GuiConfig
return list;
}
public AEConfigGui(GuiScreen parent) {
super( parent, getConfigElements(), AppEng.MOD_ID, false, false, GuiConfig.getAbridgedConfigPath( AEConfig.instance.getFilePath() ) );
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.config;
import java.util.Set;
import net.minecraft.client.Minecraft;
@@ -25,11 +26,12 @@ import net.minecraft.client.gui.GuiScreen;
import cpw.mods.fml.client.IModGuiFactory;
public class AEConfigGuiFactory implements IModGuiFactory
{
@Override
public void initialize(Minecraft minecraftInstance)
public void initialize( Minecraft minecraftInstance )
{
}
@@ -47,9 +49,8 @@ public class AEConfigGuiFactory implements IModGuiFactory
}
@Override
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element)
public RuntimeOptionGuiHandler getHandlerFor( RuntimeOptionCategoryElement element )
{
return null;
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import org.lwjgl.input.Mouse;
@@ -42,6 +43,7 @@ import appeng.core.sync.packets.PacketValueConfig;
import appeng.tile.misc.TileCellWorkbench;
import appeng.util.Platform;
public class GuiCellWorkbench extends GuiUpgradeable
{
@@ -52,100 +54,14 @@ public class GuiCellWorkbench extends GuiUpgradeable
GuiImgButton partition;
GuiToggleButton copyMode;
public GuiCellWorkbench(InventoryPlayer inventoryPlayer, TileCellWorkbench te) {
public GuiCellWorkbench( InventoryPlayer inventoryPlayer, TileCellWorkbench te )
{
super( new ContainerCellWorkbench( inventoryPlayer, te ) );
this.workbench = (ContainerCellWorkbench) this.inventorySlots;
this.ySize = 251;
this.tcw = te;
}
@Override
protected boolean drawUpgrades()
{
return this.workbench.availableUpgrades() > 0;
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.handleButtonVisibility();
this.bindTexture( this.getBackground() );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, 211 - 34, this.ySize );
if ( this.drawUpgrades() )
{
if ( this.workbench.availableUpgrades() <= 8 )
{
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + this.workbench.availableUpgrades() * 18 );
this.drawTexturedModalRect( offsetX + 177, offsetY + (7 + (this.workbench.availableUpgrades()) * 18), 177, 151, 35, 7 );
}
else if ( this.workbench.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 = this.workbench.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 = this.workbench.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 ( this.hasToolbox() )
this.drawTexturedModalRect( offsetX + 178, offsetY + this.ySize - 90, 178, 161, 68, 68 );
}
@Override
protected void actionPerformed(GuiButton btn)
{
try
{
if ( btn == this.copyMode )
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "CellWorkbench.Action", "CopyMode" ) );
}
else if ( btn == this.partition )
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "CellWorkbench.Action", "Partition" ) );
}
else if ( btn == this.clear )
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "CellWorkbench.Action", "Clear" ) );
}
else if ( btn == this.fuzzyMode )
{
boolean backwards = Mouse.isButtonDown( 1 );
FuzzyMode fz = (FuzzyMode) this.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 ignored)
{
}
}
@Override
protected void addButtons()
{
@@ -160,6 +76,52 @@ public class GuiCellWorkbench extends GuiUpgradeable
this.buttonList.add( this.copyMode );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.handleButtonVisibility();
this.bindTexture( this.getBackground() );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, 211 - 34, this.ySize );
if( this.drawUpgrades() )
{
if( this.workbench.availableUpgrades() <= 8 )
{
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + this.workbench.availableUpgrades() * 18 );
this.drawTexturedModalRect( offsetX + 177, offsetY + ( 7 + ( this.workbench.availableUpgrades() ) * 18 ), 177, 151, 35, 7 );
}
else if( this.workbench.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 = this.workbench.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 = this.workbench.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( this.hasToolbox() )
this.drawTexturedModalRect( offsetX + 178, offsetY + this.ySize - 90, 178, 161, 68, 68 );
}
@Override
protected void handleButtonVisibility()
{
@@ -167,12 +129,12 @@ public class GuiCellWorkbench extends GuiUpgradeable
boolean hasFuzzy = false;
IInventory inv = this.workbench.getCellUpgradeInventory();
for (int x = 0; x < inv.getSizeInventory(); x++)
for( int x = 0; x < inv.getSizeInventory(); x++ )
{
ItemStack is = inv.getStackInSlot( x );
if ( is != null && is.getItem() instanceof IUpgradeModule )
if( is != null && is.getItem() instanceof IUpgradeModule )
{
if ( ((IUpgradeModule) is.getItem()).getType( is ) == Upgrades.FUZZY )
if( ( (IUpgradeModule) is.getItem() ).getType( is ) == Upgrades.FUZZY )
hasFuzzy = true;
}
}
@@ -185,9 +147,49 @@ public class GuiCellWorkbench extends GuiUpgradeable
return "guis/cellworkbench.png";
}
@Override
protected boolean drawUpgrades()
{
return this.workbench.availableUpgrades() > 0;
}
@Override
protected GuiText getName()
{
return GuiText.CellWorkbench;
}
@Override
protected void actionPerformed( GuiButton btn )
{
try
{
if( btn == this.copyMode )
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "CellWorkbench.Action", "CopyMode" ) );
}
else if( btn == this.partition )
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "CellWorkbench.Action", "Partition" ) );
}
else if( btn == this.clear )
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "CellWorkbench.Action", "Clear" ) );
}
else if( btn == this.fuzzyMode )
{
boolean backwards = Mouse.isButtonDown( 1 );
FuzzyMode fz = (FuzzyMode) this.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 ignored )
{
}
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
@@ -30,17 +31,24 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.tile.storage.TileChest;
public class GuiChest extends AEBaseGui
{
GuiTabButton priority;
public GuiChest( InventoryPlayer inventoryPlayer, TileChest te )
{
super( new ContainerChest( inventoryPlayer, te ) );
this.ySize = 166;
}
@Override
protected void actionPerformed(GuiButton par1GuiButton)
protected void actionPerformed( GuiButton par1GuiButton )
{
super.actionPerformed( par1GuiButton );
if ( par1GuiButton == this.priority )
if( par1GuiButton == this.priority )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
}
@@ -54,23 +62,17 @@ public class GuiChest extends AEBaseGui
this.buttonList.add( this.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)
{
this.bindTexture( "guis/chest.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.Chest.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/chest.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
}
@@ -35,6 +35,7 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.tile.misc.TileCondenser;
public class GuiCondenser extends AEBaseGui
{
@@ -42,7 +43,7 @@ public class GuiCondenser extends AEBaseGui
GuiProgressBar pb;
GuiImgButton mode;
public GuiCondenser(InventoryPlayer inventoryPlayer, TileCondenser te)
public GuiCondenser( InventoryPlayer inventoryPlayer, TileCondenser te )
{
super( new ContainerCondenser( inventoryPlayer, te ) );
this.cvc = (ContainerCondenser) this.inventorySlots;
@@ -50,13 +51,13 @@ public class GuiCondenser extends AEBaseGui
}
@Override
protected void actionPerformed(GuiButton btn)
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if ( this.mode == btn )
if( this.mode == btn )
{
NetworkHandler.instance.sendToServer( new PacketConfigButton( Settings.CONDENSER_OUTPUT, backwards ) );
}
@@ -76,22 +77,20 @@ public class GuiCondenser extends AEBaseGui
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.bindTexture( "guis/condenser.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.Condenser.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
this.mode.set( this.cvc.output );
this.mode.fillVar = String.valueOf( this.cvc.output.requiredPower );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/condenser.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
@@ -43,6 +44,7 @@ import appeng.parts.reporting.PartCraftingTerminal;
import appeng.parts.reporting.PartPatternTerminal;
import appeng.parts.reporting.PartTerminal;
public class GuiCraftAmount extends AEBaseGui
{
private GuiNumberBox amountToCraft;
@@ -62,7 +64,8 @@ public class GuiCraftAmount extends AEBaseGui
private GuiBridge originalGui;
@Reflected
public GuiCraftAmount(InventoryPlayer inventoryPlayer, ITerminalHost te) {
public GuiCraftAmount( InventoryPlayer inventoryPlayer, ITerminalHost te )
{
super( new ContainerCraftAmount( inventoryPlayer, te ) );
}
@@ -89,13 +92,13 @@ public class GuiCraftAmount extends AEBaseGui
this.buttonList.add( this.next = new GuiButton( 0, this.guiLeft + 128, this.guiTop + 51, 38, 20, GuiText.Next.getLocal() ) );
ItemStack myIcon = null;
Object target = ((AEBaseContainer) this.inventorySlots).getTarget();
Object target = ( (AEBaseContainer) this.inventorySlots ).getTarget();
final IDefinitions definitions = AEApi.instance().definitions();
final IParts parts = definitions.parts();
if ( target instanceof WirelessTerminalGuiObject )
if( target instanceof WirelessTerminalGuiObject )
{
for ( ItemStack wirelessTerminalStack : definitions.items().wirelessTerminal().maybeStack( 1 ).asSet() )
for( ItemStack wirelessTerminalStack : definitions.items().wirelessTerminal().maybeStack( 1 ).asSet() )
{
myIcon = wirelessTerminalStack;
}
@@ -103,34 +106,34 @@ public class GuiCraftAmount extends AEBaseGui
this.originalGui = GuiBridge.GUI_WIRELESS_TERM;
}
if ( target instanceof PartTerminal )
if( target instanceof PartTerminal )
{
for ( ItemStack stack : parts.terminal().maybeStack( 1 ).asSet() )
for( ItemStack stack : parts.terminal().maybeStack( 1 ).asSet() )
{
myIcon = stack;
}
this.originalGui = GuiBridge.GUI_ME;
}
if ( target instanceof PartCraftingTerminal )
if( target instanceof PartCraftingTerminal )
{
for ( ItemStack stack : parts.craftingTerminal().maybeStack( 1 ).asSet() )
for( ItemStack stack : parts.craftingTerminal().maybeStack( 1 ).asSet() )
{
myIcon = stack;
}
this.originalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
}
if ( target instanceof PartPatternTerminal )
if( target instanceof PartPatternTerminal )
{
for ( ItemStack stack : parts.patternTerminal().maybeStack( 1 ).asSet() )
for( ItemStack stack : parts.patternTerminal().maybeStack( 1 ).asSet() )
{
myIcon = stack;
}
this.originalGui = GuiBridge.GUI_PATTERN_TERMINAL;
}
if ( this.originalGui != null && myIcon != null )
if( this.originalGui != null && myIcon != null )
{
this.buttonList.add( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender ) );
}
@@ -145,111 +148,67 @@ public class GuiCraftAmount extends AEBaseGui
}
@Override
protected void actionPerformed(GuiButton btn)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
super.actionPerformed( btn );
try
{
if ( btn == this.originalGuiBtn )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( this.originalGui ) );
}
if ( btn == this.next )
{
NetworkHandler.instance.sendToServer( new PacketCraftRequest( Integer.parseInt( this.amountToCraft.getText() ), isShiftKeyDown() ) );
}
}
catch (NumberFormatException e)
{
// nope..
this.amountToCraft.setText( "1" );
}
boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
boolean isMinus = btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
if ( isPlus || isMinus )
this.addQty( this.getQty( btn ) );
}
private void addQty(int i)
{
try
{
String out = this.amountToCraft.getText();
boolean fixed = false;
while (out.startsWith( "0" ) && out.length() > 1)
{
out = out.substring( 1 );
fixed = true;
}
if ( fixed )
this.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 );
this.amountToCraft.setText( out );
}
catch (NumberFormatException e)
{
// :P
}
this.fontRendererObj.drawString( GuiText.SelectAmount.getLocal(), 8, 6, 4210752 );
}
@Override
protected void keyTyped(char character, int key)
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
if ( !this.checkHotbarKeys( key ) )
this.next.displayString = isShiftKeyDown() ? GuiText.Start.getLocal() : GuiText.Next.getLocal();
this.bindTexture( "guis/craftAmt.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
try
{
if ( key == 28 )
Long.parseLong( this.amountToCraft.getText() );
this.next.enabled = this.amountToCraft.getText().length() > 0;
}
catch( NumberFormatException e )
{
this.next.enabled = false;
}
this.amountToCraft.drawTextBox();
}
@Override
protected void keyTyped( char character, int key )
{
if( !this.checkHotbarKeys( key ) )
{
if( key == 28 )
{
this.actionPerformed( this.next );
}
if ( (key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit( character ))
&& this.amountToCraft.textboxKeyTyped( character, key ) )
if( ( key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit( character ) ) && this.amountToCraft.textboxKeyTyped( character, key ) )
{
try
{
String out = this.amountToCraft.getText();
boolean fixed = false;
while (out.startsWith( "0" ) && out.length() > 1)
while( out.startsWith( "0" ) && out.length() > 1 )
{
out = out.substring( 1 );
fixed = true;
}
if ( fixed )
if( fixed )
this.amountToCraft.setText( out );
if ( out.length() == 0 )
if( out.length() == 0 )
out = "0";
long result = Long.parseLong( out );
if ( result < 0 )
if( result < 0 )
{
this.amountToCraft.setText( "1" );
}
}
catch (NumberFormatException e)
catch( NumberFormatException e )
{
// :P
}
@@ -262,34 +221,76 @@ public class GuiCraftAmount extends AEBaseGui
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
protected void actionPerformed( GuiButton btn )
{
this.next.displayString = isShiftKeyDown() ? GuiText.Start.getLocal() : GuiText.Next.getLocal();
this.bindTexture( "guis/craftAmt.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
super.actionPerformed( btn );
try
{
Long.parseLong( this.amountToCraft.getText() );
this.next.enabled = this.amountToCraft.getText().length() > 0;
if( btn == this.originalGuiBtn )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( this.originalGui ) );
}
if( btn == this.next )
{
NetworkHandler.instance.sendToServer( new PacketCraftRequest( Integer.parseInt( this.amountToCraft.getText() ), isShiftKeyDown() ) );
}
}
catch (NumberFormatException e)
catch( NumberFormatException e )
{
this.next.enabled = false;
// nope..
this.amountToCraft.setText( "1" );
}
this.amountToCraft.drawTextBox();
boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
boolean isMinus = btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
if( isPlus || isMinus )
this.addQty( this.getQty( btn ) );
}
private void addQty( int i )
{
try
{
String out = this.amountToCraft.getText();
boolean fixed = false;
while( out.startsWith( "0" ) && out.length() > 1 )
{
out = out.substring( 1 );
fixed = true;
}
if( fixed )
this.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 );
this.amountToCraft.setText( out );
}
catch( NumberFormatException e )
{
// :P
}
}
protected String getBackground()
{
return "guis/craftAmt.png";
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.fontRendererObj.drawString( GuiText.SelectAmount.getLocal(), 8, 6, 4210752 );
}
}
@@ -26,8 +26,6 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import com.google.common.base.Joiner;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@@ -35,6 +33,8 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import com.google.common.base.Joiner;
import appeng.api.AEApi;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEItemStack;
@@ -54,6 +54,7 @@ import appeng.parts.reporting.PartPatternTerminal;
import appeng.parts.reporting.PartTerminal;
import appeng.util.Platform;
public class GuiCraftConfirm extends AEBaseGui
{
@@ -68,18 +69,13 @@ public class GuiCraftConfirm extends AEBaseGui
final List<IAEItemStack> visual = new ArrayList<IAEItemStack>();
GuiBridge OriginalGui;
GuiButton cancel;
GuiButton start;
GuiButton selectCPU;
int tooltip = -1;
boolean isAutoStart()
public GuiCraftConfirm( InventoryPlayer inventoryPlayer, ITerminalHost te )
{
return ((ContainerCraftConfirm) this.inventorySlots).autoStart;
}
boolean isSimulation()
{
return ((ContainerCraftConfirm) this.inventorySlots).simulation;
}
public GuiCraftConfirm(InventoryPlayer inventoryPlayer, ITerminalHost te) {
super( new ContainerCraftConfirm( inventoryPlayer, te ) );
this.xSize = 238;
this.ySize = 206;
@@ -87,23 +83,23 @@ public class GuiCraftConfirm extends AEBaseGui
this.ccc = (ContainerCraftConfirm) this.inventorySlots;
if ( te instanceof WirelessTerminalGuiObject )
if( te instanceof WirelessTerminalGuiObject )
this.OriginalGui = GuiBridge.GUI_WIRELESS_TERM;
if ( te instanceof PartTerminal )
if( te instanceof PartTerminal )
this.OriginalGui = GuiBridge.GUI_ME;
if ( te instanceof PartCraftingTerminal )
if( te instanceof PartCraftingTerminal )
this.OriginalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
if ( te instanceof PartPatternTerminal )
if( te instanceof PartPatternTerminal )
this.OriginalGui = GuiBridge.GUI_PATTERN_TERMINAL;
}
GuiButton cancel;
GuiButton start;
GuiButton selectCPU;
boolean isAutoStart()
{
return ( (ContainerCraftConfirm) this.inventorySlots ).autoStart;
}
@Override
public void initGui()
@@ -114,248 +110,50 @@ public class GuiCraftConfirm extends AEBaseGui
this.start.enabled = false;
this.buttonList.add( this.start );
this.selectCPU = new GuiButton( 0, this.guiLeft + (219 - 180) / 2, this.guiTop + this.ySize - 68, 180, 20, GuiText.CraftingCPU.getLocal() + ": "
+ GuiText.Automatic );
this.selectCPU = new GuiButton( 0, this.guiLeft + ( 219 - 180 ) / 2, this.guiTop + this.ySize - 68, 180, 20, GuiText.CraftingCPU.getLocal() + ": " + GuiText.Automatic );
this.selectCPU.enabled = false;
this.buttonList.add( this.selectCPU );
if ( this.OriginalGui != null )
if( this.OriginalGui != null )
this.cancel = new GuiButton( 0, this.guiLeft + 6, this.guiTop + this.ySize - 25, 50, 20, GuiText.Cancel.getLocal() );
this.buttonList.add( this.cancel );
}
private void updateCPUButtonText()
{
String btnTextText = GuiText.CraftingCPU.getLocal() + ": " + GuiText.Automatic.getLocal();
if ( this.ccc.selectedCpu >= 0 )// && status.selectedCpu < status.cpus.size() )
{
if ( this.ccc.myName.length() > 0 )
{
String name = this.ccc.myName.substring( 0, Math.min( 20, this.ccc.myName.length() ) );
btnTextText = GuiText.CraftingCPU.getLocal() + ": " + name;
}
else
btnTextText = GuiText.CraftingCPU.getLocal() + ": #" + this.ccc.selectedCpu;
}
if ( this.ccc.noCPU )
btnTextText = GuiText.NoCraftingCPUs.getLocal();
this.selectCPU.displayString = btnTextText;
}
@Override
protected void actionPerformed(GuiButton btn)
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if ( btn == this.selectCPU )
{
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "Terminal.Cpu", backwards ? "Prev" : "Next" ) );
}
catch (IOException e)
{
AELog.error( e );
}
}
if ( btn == this.cancel )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( this.OriginalGui ) );
}
if ( btn == this.start )
{
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "Terminal.Start", "Start" ) );
}
catch (Throwable e)
{
AELog.error( e );
}
}
}
private long getTotal(IAEItemStack is)
{
IAEItemStack a = this.storage.findPrecise( is );
IAEItemStack c = this.pending.findPrecise( is );
IAEItemStack m = this.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)
this.handleInput( this.storage, l );
break;
case 1:
for (IAEItemStack l : list)
this.handleInput( this.pending, l );
break;
case 2:
for (IAEItemStack l : list)
this.handleInput( this.missing, l );
break;
}
for (IAEItemStack l : list)
{
long amt = this.getTotal( l );
if ( amt <= 0 )
this.deleteVisualStack( l );
else
{
IAEItemStack is = this.findVisualStack( l );
is.setStackSize( amt );
}
}
this.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)
{
for (IAEItemStack o : this.visual)
{
if ( o.equals( l ) )
{
return o;
}
}
IAEItemStack stack = l.copy();
this.visual.add( stack );
return stack;
}
private void deleteVisualStack(IAEItemStack l)
{
Iterator<IAEItemStack> i = this.visual.iterator();
while (i.hasNext())
{
IAEItemStack o = i.next();
if ( o.equals( l ) )
{
i.remove();
return;
}
}
}
private void setScrollBar()
{
int size = this.visual.size();
this.myScrollBar.setTop( 19 ).setLeft( 218 ).setHeight( 114 );
this.myScrollBar.setRange( 0, (size + 2) / 3 - this.rows, 1 );
}
@Override
protected void keyTyped(char character, int key)
{
if ( !this.checkHotbarKeys( key ) )
{
if ( key == 28 )
{
this.actionPerformed( this.start );
}
super.keyTyped( character, key );
}
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.setScrollBar();
this.bindTexture( "guis/craftingreport.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
int tooltip = -1;
@Override
public void drawScreen(int mouse_x, int mouse_y, float btn)
public void drawScreen( int mouse_x, int mouse_y, float btn )
{
this.updateCPUButtonText();
this.start.enabled = !(this.ccc.noCPU || this.isSimulation());
this.start.enabled = !( this.ccc.noCPU || this.isSimulation() );
this.selectCPU.enabled = !this.isSimulation();
int x = 0;
int y = 0;
int gx = (this.width - this.xSize) / 2;
int gy = (this.height - this.ySize) / 2;
int gx = ( this.width - this.xSize ) / 2;
int gy = ( this.height - this.ySize ) / 2;
int offY = 23;
this.tooltip = -1;
for (int z = 0; z <= 4 * 5; z++)
for( int z = 0; z <= 4 * 5; z++ )
{
int minX = gx + 9 + x * 67;
int minY = gy + 22 + y * offY;
if ( minX < mouse_x && minX + 67 > mouse_x )
if( minX < mouse_x && minX + 67 > mouse_x )
{
if ( minY < mouse_y && minY + offY - 2 > mouse_y )
if( minY < mouse_y && minY + offY - 2 > mouse_y )
{
this.tooltip = z;
break;
}
}
x++;
if ( x > 2 )
if( x > 2 )
{
y++;
x = 0;
@@ -365,23 +163,47 @@ public class GuiCraftConfirm extends AEBaseGui
super.drawScreen( mouse_x, mouse_y, btn );
}
private void updateCPUButtonText()
{
String btnTextText = GuiText.CraftingCPU.getLocal() + ": " + GuiText.Automatic.getLocal();
if( this.ccc.selectedCpu >= 0 )// && status.selectedCpu < status.cpus.size() )
{
if( this.ccc.myName.length() > 0 )
{
String name = this.ccc.myName.substring( 0, Math.min( 20, this.ccc.myName.length() ) );
btnTextText = GuiText.CraftingCPU.getLocal() + ": " + name;
}
else
btnTextText = GuiText.CraftingCPU.getLocal() + ": #" + this.ccc.selectedCpu;
}
if( this.ccc.noCPU )
btnTextText = GuiText.NoCraftingCPUs.getLocal();
this.selectCPU.displayString = btnTextText;
}
boolean isSimulation()
{
return ( (ContainerCraftConfirm) this.inventorySlots ).simulation;
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
long BytesUsed = this.ccc.bytesUsed;
String byteUsed = NumberFormat.getInstance().format( BytesUsed );
String Add = BytesUsed > 0 ? (byteUsed + ' ' + GuiText.BytesUsed.getLocal()) : GuiText.CalculatingWait.getLocal();
String Add = BytesUsed > 0 ? ( byteUsed + ' ' + GuiText.BytesUsed.getLocal() ) : GuiText.CalculatingWait.getLocal();
this.fontRendererObj.drawString( GuiText.CraftingPlan.getLocal() + " - " + Add, 8, 7, 4210752 );
String dsp = null;
if ( this.isSimulation() )
if( this.isSimulation() )
dsp = GuiText.Simulation.getLocal();
else
dsp = this.ccc.cpuBytesAvail > 0 ? (GuiText.Bytes.getLocal() + ": " + this.ccc.cpuBytesAvail + " : " + GuiText.CoProcessors.getLocal() + ": " + this.ccc.cpuCoProcessors)
: GuiText.Bytes.getLocal() + ": N/A : " + GuiText.CoProcessors.getLocal() + ": N/A";
dsp = this.ccc.cpuBytesAvail > 0 ? ( GuiText.Bytes.getLocal() + ": " + this.ccc.cpuBytesAvail + " : " + GuiText.CoProcessors.getLocal() + ": " + this.ccc.cpuCoProcessors ) : GuiText.Bytes.getLocal() + ": N/A : " + GuiText.CoProcessors.getLocal() + ": N/A";
int offset = (219 - this.fontRendererObj.getStringWidth( dsp )) / 2;
int offset = ( 219 - this.fontRendererObj.getStringWidth( dsp ) ) / 2;
this.fontRendererObj.drawString( dsp, offset, 165, 4210752 );
int sectionLength = 67;
@@ -400,10 +222,10 @@ public class GuiCraftConfirm extends AEBaseGui
int offY = 23;
for (int z = viewStart; z < Math.min( viewEnd, this.visual.size() ); z++)
for( int z = viewStart; z < Math.min( viewEnd, this.visual.size() ); z++ )
{
IAEItemStack refStack = this.visual.get( z );// repo.getReferenceItem( z );
if ( refStack != null )
if( refStack != null )
{
GL11.glPushMatrix();
GL11.glScaled( 0.5, 0.5, 0.5 );
@@ -414,118 +236,284 @@ public class GuiCraftConfirm extends AEBaseGui
int lines = 0;
if ( stored != null && stored.getStackSize() > 0 )
if( stored != null && stored.getStackSize() > 0 )
lines++;
if ( pendingStack != null && pendingStack.getStackSize() > 0 )
if( pendingStack != null && pendingStack.getStackSize() > 0 )
lines++;
if ( pendingStack != null && pendingStack.getStackSize() > 0 )
if( pendingStack != null && pendingStack.getStackSize() > 0 )
lines++;
int negY = ((lines - 1) * 5) / 2;
int negY = ( ( lines - 1 ) * 5 ) / 2;
int downY = 0;
boolean red = false;
if ( stored != null && stored.getStackSize() > 0 )
if( stored != null && stored.getStackSize() > 0 )
{
String str = Long.toString( stored.getStackSize() );
if ( stored.getStackSize() >= 10000 )
if( stored.getStackSize() >= 10000 )
str = Long.toString( stored.getStackSize() / 1000 ) + 'k';
if ( stored.getStackSize() >= 10000000 )
if( stored.getStackSize() >= 10000000 )
str = Long.toString( stored.getStackSize() / 1000000 ) + 'm';
str = GuiText.FromStorage.getLocal() + ": " + str;
int w = 4 + this.fontRendererObj.getStringWidth( str );
this.fontRendererObj.drawString( str, (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2), (y * offY + yo
+ 6 - negY + downY) * 2, 4210752 );
this.fontRendererObj.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), ( y * offY + yo + 6 - negY + downY ) * 2, 4210752 );
if ( this.tooltip == z - viewStart )
if( this.tooltip == z - viewStart )
lineList.add( GuiText.FromStorage.getLocal() + ": " + Long.toString( stored.getStackSize() ) );
downY += 5;
}
if ( missingStack != null && missingStack.getStackSize() > 0 )
if( missingStack != null && missingStack.getStackSize() > 0 )
{
String str = Long.toString( missingStack.getStackSize() );
if ( missingStack.getStackSize() >= 10000 )
if( missingStack.getStackSize() >= 10000 )
str = Long.toString( missingStack.getStackSize() / 1000 ) + 'k';
if ( missingStack.getStackSize() >= 10000000 )
if( missingStack.getStackSize() >= 10000000 )
str = Long.toString( missingStack.getStackSize() / 1000000 ) + 'm';
str = GuiText.Missing.getLocal() + ": " + str;
int w = 4 + this.fontRendererObj.getStringWidth( str );
this.fontRendererObj.drawString( str, (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2), (y * offY + yo
+ 6 - negY + downY) * 2, 4210752 );
this.fontRendererObj.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), ( y * offY + yo + 6 - negY + downY ) * 2, 4210752 );
if ( this.tooltip == z - viewStart )
if( this.tooltip == z - viewStart )
lineList.add( GuiText.Missing.getLocal() + ": " + Long.toString( missingStack.getStackSize() ) );
red = true;
downY += 5;
}
if ( pendingStack != null && pendingStack.getStackSize() > 0 )
if( pendingStack != null && pendingStack.getStackSize() > 0 )
{
String str = Long.toString( pendingStack.getStackSize() );
if ( pendingStack.getStackSize() >= 10000 )
if( pendingStack.getStackSize() >= 10000 )
str = Long.toString( pendingStack.getStackSize() / 1000 ) + 'k';
if ( pendingStack.getStackSize() >= 10000000 )
if( pendingStack.getStackSize() >= 10000000 )
str = Long.toString( pendingStack.getStackSize() / 1000000 ) + 'm';
str = GuiText.ToCraft.getLocal() + ": " + str;
int w = 4 + this.fontRendererObj.getStringWidth( str );
this.fontRendererObj.drawString( str, (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2), (y * offY + yo
+ 6 - negY + downY) * 2, 4210752 );
this.fontRendererObj.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), ( y * offY + yo + 6 - negY + downY ) * 2, 4210752 );
if ( this.tooltip == z - viewStart )
if( this.tooltip == z - viewStart )
lineList.add( GuiText.ToCraft.getLocal() + ": " + Long.toString( pendingStack.getStackSize() ) );
}
GL11.glPopMatrix();
int posX = x * (1 + sectionLength) + xo + sectionLength - 19;
int posX = x * ( 1 + sectionLength ) + xo + sectionLength - 19;
int posY = y * offY + yo;
ItemStack is = refStack.copy().getItemStack();
if ( this.tooltip == z - viewStart )
if( this.tooltip == z - viewStart )
{
dspToolTip = Platform.getItemDisplayName( is );
if ( lineList.size() > 0 )
if( lineList.size() > 0 )
dspToolTip = dspToolTip + '\n' + Joiner.on( "\n" ).join( lineList );
toolPosX = x * (1 + sectionLength) + xo + sectionLength - 8;
toolPosX = x * ( 1 + sectionLength ) + xo + sectionLength - 8;
toolPosY = y * offY + yo;
}
this.drawItem( posX, posY, is );
if ( red )
if( red )
{
int startX = x * (1 + sectionLength) + xo;
int startX = x * ( 1 + sectionLength ) + xo;
int startY = posY - 4;
drawRect( startX, startY, startX + sectionLength, startY + offY, 0x1AFF0000 );
}
x++;
if ( x > 2 )
if( x > 2 )
{
y++;
x = 0;
}
}
}
if ( this.tooltip >= 0 && dspToolTip.length() > 0 )
if( this.tooltip >= 0 && dspToolTip.length() > 0 )
{
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
this.drawTooltip( toolPosX, toolPosY + 10, 0, dspToolTip );
GL11.glPopAttrib();
}
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.setScrollBar();
this.bindTexture( "guis/craftingreport.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
private void setScrollBar()
{
int size = this.visual.size();
this.myScrollBar.setTop( 19 ).setLeft( 218 ).setHeight( 114 );
this.myScrollBar.setRange( 0, ( size + 2 ) / 3 - this.rows, 1 );
}
public void postUpdate( List<IAEItemStack> list, byte ref )
{
switch( ref )
{
case 0:
for( IAEItemStack l : list )
this.handleInput( this.storage, l );
break;
case 1:
for( IAEItemStack l : list )
this.handleInput( this.pending, l );
break;
case 2:
for( IAEItemStack l : list )
this.handleInput( this.missing, l );
break;
}
for( IAEItemStack l : list )
{
long amt = this.getTotal( l );
if( amt <= 0 )
this.deleteVisualStack( l );
else
{
IAEItemStack is = this.findVisualStack( l );
is.setStackSize( amt );
}
}
this.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 long getTotal( IAEItemStack is )
{
IAEItemStack a = this.storage.findPrecise( is );
IAEItemStack c = this.pending.findPrecise( is );
IAEItemStack m = this.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;
}
private void deleteVisualStack( IAEItemStack l )
{
Iterator<IAEItemStack> i = this.visual.iterator();
while( i.hasNext() )
{
IAEItemStack o = i.next();
if( o.equals( l ) )
{
i.remove();
return;
}
}
}
private IAEItemStack findVisualStack( IAEItemStack l )
{
for( IAEItemStack o : this.visual )
{
if( o.equals( l ) )
{
return o;
}
}
IAEItemStack stack = l.copy();
this.visual.add( stack );
return stack;
}
@Override
protected void keyTyped( char character, int key )
{
if( !this.checkHotbarKeys( key ) )
{
if( key == 28 )
{
this.actionPerformed( this.start );
}
super.keyTyped( character, key );
}
}
@Override
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if( btn == this.selectCPU )
{
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "Terminal.Cpu", backwards ? "Prev" : "Next" ) );
}
catch( IOException e )
{
AELog.error( e );
}
}
if( btn == this.cancel )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( this.OriginalGui ) );
}
if( btn == this.start )
{
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "Terminal.Start", "Start" ) );
}
catch( Throwable e )
{
AELog.error( e );
}
}
}
}
@@ -51,6 +51,7 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.util.Platform;
public class GuiCraftingCPU extends AEBaseGui implements ISortSource
{
@@ -61,6 +62,21 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
IItemList<IAEItemStack> pending = AEApi.instance().storage().createItemList();
List<IAEItemStack> visual = new ArrayList<IAEItemStack>();
GuiButton cancel;
int tooltip = -1;
public GuiCraftingCPU( InventoryPlayer inventoryPlayer, Object te )
{
this( new ContainerCraftingCPU( inventoryPlayer, te ) );
}
protected GuiCraftingCPU( ContainerCraftingCPU container )
{
super( container );
this.ySize = 184;
this.xSize = 238;
this.myScrollBar = new GuiScrollbar();
}
public void clearItems()
{
@@ -70,31 +86,18 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
this.visual = new ArrayList<IAEItemStack>();
}
protected GuiCraftingCPU(ContainerCraftingCPU container) {
super( container );
this.ySize = 184;
this.xSize = 238;
this.myScrollBar = new GuiScrollbar();
}
public GuiCraftingCPU(InventoryPlayer inventoryPlayer, Object te) {
this( new ContainerCraftingCPU( inventoryPlayer, te ) );
}
GuiButton cancel;
@Override
protected void actionPerformed(GuiButton btn)
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
if ( this.cancel == btn )
if( this.cancel == btn )
{
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "TileCrafting.Cancel", "Cancel" ) );
}
catch (IOException e)
catch( IOException e )
{
AELog.error( e );
}
@@ -110,162 +113,45 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
this.buttonList.add( this.cancel );
}
private long getTotal(IAEItemStack is)
{
IAEItemStack a = this.storage.findPrecise( is );
IAEItemStack b = this.active.findPrecise( is );
IAEItemStack c = this.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)
this.handleInput( this.storage, l );
break;
case 1:
for (IAEItemStack l : list)
this.handleInput( this.active, l );
break;
case 2:
for (IAEItemStack l : list)
this.handleInput( this.pending, l );
break;
}
for (IAEItemStack l : list)
{
long amt = this.getTotal( l );
if ( amt <= 0 )
this.deleteVisualStack( l );
else
{
IAEItemStack is = this.findVisualStack( l );
is.setStackSize( amt );
}
}
this.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)
{
for (IAEItemStack o : this.visual)
{
if ( o.equals( l ) )
{
return o;
}
}
IAEItemStack stack = l.copy();
this.visual.add( stack );
return stack;
}
private void deleteVisualStack(IAEItemStack l)
{
Iterator<IAEItemStack> i = this.visual.iterator();
while (i.hasNext())
{
IAEItemStack o = i.next();
if ( o.equals( l ) )
{
i.remove();
return;
}
}
}
private void setScrollBar()
{
int size = this.visual.size();
this.myScrollBar.setTop( 19 ).setLeft( 218 ).setHeight( 137 );
this.myScrollBar.setRange( 0, (size + 2) / 3 - this.rows, 1 );
this.myScrollBar.setRange( 0, ( size + 2 ) / 3 - this.rows, 1 );
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.bindTexture( "guis/craftingcpu.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
int tooltip = -1;
@Override
public void drawScreen(int mouse_x, int mouse_y, float btn)
public void drawScreen( int mouse_x, int mouse_y, float btn )
{
this.cancel.enabled = !this.visual.isEmpty();
int x = 0;
int y = 0;
int gx = (this.width - this.xSize) / 2;
int gy = (this.height - this.ySize) / 2;
int gx = ( this.width - this.xSize ) / 2;
int gy = ( this.height - this.ySize ) / 2;
int offY = 23;
this.tooltip = -1;
for (int z = 0; z <= 4 * 5; z++)
for( int z = 0; z <= 4 * 5; z++ )
{
int minX = gx + 9 + x * 67;
int minY = gy + 22 + y * offY;
if ( minX < mouse_x && minX + 67 > mouse_x )
if( minX < mouse_x && minX + 67 > mouse_x )
{
if ( minY < mouse_y && minY + offY - 2 > mouse_y )
if( minY < mouse_y && minY + offY - 2 > mouse_y )
{
this.tooltip = z;
break;
}
}
x++;
if ( x > 2 )
if( x > 2 )
{
y++;
x = 0;
@@ -276,7 +162,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.CraftingStatus.getLocal() ), 8, 7, 4210752 );
@@ -296,10 +182,10 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
int offY = 23;
for (int z = viewStart; z < Math.min( viewEnd, this.visual.size() ); z++)
for( int z = viewStart; z < Math.min( viewEnd, this.visual.size() ); z++ )
{
IAEItemStack refStack = this.visual.get( z );// repo.getReferenceItem( z );
if ( refStack != null )
if( refStack != null )
{
GL11.glPushMatrix();
GL11.glScaled( 0.5, 0.5, 0.5 );
@@ -312,102 +198,98 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
boolean active = false;
boolean scheduled = false;
if ( stored != null && stored.getStackSize() > 0 )
if( stored != null && stored.getStackSize() > 0 )
{
lines++;
}
if ( activeStack != null && activeStack.getStackSize() > 0 )
if( activeStack != null && activeStack.getStackSize() > 0 )
{
lines++;
active = true;
}
if ( pendingStack != null && pendingStack.getStackSize() > 0 )
if( pendingStack != null && pendingStack.getStackSize() > 0 )
{
lines++;
scheduled = true;
}
if ( AEConfig.instance.useColoredCraftingStatus && ( active || scheduled ) )
if( AEConfig.instance.useColoredCraftingStatus && ( active || scheduled ) )
{
int bgColor = ( active ? AEColor.Green.blackVariant : AEColor.Yellow.blackVariant ) | 0x5A000000;
int startX = (x * (1 + sectionLength) + xo) * 2;
int startY = ((y * offY + yo) - 3) * 2;
drawRect( startX, startY, startX + (sectionLength * 2), startY + (offY * 2) - 2, bgColor);
int startX = ( x * ( 1 + sectionLength ) + xo ) * 2;
int startY = ( ( y * offY + yo ) - 3 ) * 2;
drawRect( startX, startY, startX + ( sectionLength * 2 ), startY + ( offY * 2 ) - 2, bgColor );
}
int negY = ((lines - 1) * 5) / 2;
int negY = ( ( lines - 1 ) * 5 ) / 2;
int downY = 0;
if ( stored != null && stored.getStackSize() > 0 )
if( stored != null && stored.getStackSize() > 0 )
{
String str = Long.toString( stored.getStackSize() );
if ( stored.getStackSize() >= 10000 )
if( stored.getStackSize() >= 10000 )
str = Long.toString( stored.getStackSize() / 1000 ) + 'k';
if ( stored.getStackSize() >= 10000000 )
if( stored.getStackSize() >= 10000000 )
str = Long.toString( stored.getStackSize() / 1000000 ) + 'm';
str = GuiText.Stored.getLocal() + ": " + str;
int w = 4 + this.fontRendererObj.getStringWidth( str );
this.fontRendererObj.drawString( str, (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2), (y * offY + yo
+ 6 - negY + downY) * 2, 4210752 );
this.fontRendererObj.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), ( y * offY + yo + 6 - negY + downY ) * 2, 4210752 );
if ( this.tooltip == z - viewStart )
if( this.tooltip == z - viewStart )
lineList.add( GuiText.Stored.getLocal() + ": " + Long.toString( stored.getStackSize() ) );
downY += 5;
}
if ( activeStack != null && activeStack.getStackSize() > 0 )
if( activeStack != null && activeStack.getStackSize() > 0 )
{
String str = Long.toString( activeStack.getStackSize() );
if ( activeStack.getStackSize() >= 10000 )
if( activeStack.getStackSize() >= 10000 )
str = Long.toString( activeStack.getStackSize() / 1000 ) + 'k';
if ( activeStack.getStackSize() >= 10000000 )
if( activeStack.getStackSize() >= 10000000 )
str = Long.toString( activeStack.getStackSize() / 1000000 ) + 'm';
str = GuiText.Crafting.getLocal() + ": " + str;
int w = 4 + this.fontRendererObj.getStringWidth( str );
this.fontRendererObj.drawString( str, (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2), (y * offY + yo
+ 6 - negY + downY) * 2, 4210752 );
this.fontRendererObj.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), ( y * offY + yo + 6 - negY + downY ) * 2, 4210752 );
if ( this.tooltip == z - viewStart )
if( this.tooltip == z - viewStart )
lineList.add( GuiText.Crafting.getLocal() + ": " + Long.toString( activeStack.getStackSize() ) );
downY += 5;
}
if ( pendingStack != null && pendingStack.getStackSize() > 0 )
if( pendingStack != null && pendingStack.getStackSize() > 0 )
{
String str = Long.toString( pendingStack.getStackSize() );
if ( pendingStack.getStackSize() >= 10000 )
if( pendingStack.getStackSize() >= 10000 )
str = Long.toString( pendingStack.getStackSize() / 1000 ) + 'k';
if ( pendingStack.getStackSize() >= 10000000 )
if( pendingStack.getStackSize() >= 10000000 )
str = Long.toString( pendingStack.getStackSize() / 1000000 ) + 'm';
str = GuiText.Scheduled.getLocal() + ": " + str;
int w = 4 + this.fontRendererObj.getStringWidth( str );
this.fontRendererObj.drawString( str, (int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2), (y * offY + yo
+ 6 - negY + downY) * 2, 4210752 );
this.fontRendererObj.drawString( str, (int) ( ( x * ( 1 + sectionLength ) + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), ( y * offY + yo + 6 - negY + downY ) * 2, 4210752 );
if ( this.tooltip == z - viewStart )
if( this.tooltip == z - viewStart )
lineList.add( GuiText.Scheduled.getLocal() + ": " + Long.toString( pendingStack.getStackSize() ) );
}
GL11.glPopMatrix();
int posX = x * (1 + sectionLength) + xo + sectionLength - 19;
int posX = x * ( 1 + sectionLength ) + xo + sectionLength - 19;
int posY = y * offY + yo;
ItemStack is = refStack.copy().getItemStack();
if ( this.tooltip == z - viewStart )
if( this.tooltip == z - viewStart )
{
dspToolTip = Platform.getItemDisplayName( is );
if ( lineList.size() > 0 )
if( lineList.size() > 0 )
dspToolTip = dspToolTip + '\n' + Joiner.on( "\n" ).join( lineList );
toolPosX = x * (1 + sectionLength) + xo + sectionLength - 8;
toolPosX = x * ( 1 + sectionLength ) + xo + sectionLength - 8;
toolPosY = y * offY + yo;
}
@@ -415,22 +297,134 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
x++;
if ( x > 2 )
if( x > 2 )
{
y++;
x = 0;
}
}
}
if ( this.tooltip >= 0 && dspToolTip.length() > 0 )
if( this.tooltip >= 0 && dspToolTip.length() > 0 )
{
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
this.drawTooltip( toolPosX, toolPosY + 10, 0, dspToolTip );
GL11.glPopAttrib();
}
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/craftingcpu.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
public void postUpdate( List<IAEItemStack> list, byte ref )
{
switch( ref )
{
case 0:
for( IAEItemStack l : list )
this.handleInput( this.storage, l );
break;
case 1:
for( IAEItemStack l : list )
this.handleInput( this.active, l );
break;
case 2:
for( IAEItemStack l : list )
this.handleInput( this.pending, l );
break;
}
for( IAEItemStack l : list )
{
long amt = this.getTotal( l );
if( amt <= 0 )
this.deleteVisualStack( l );
else
{
IAEItemStack is = this.findVisualStack( l );
is.setStackSize( amt );
}
}
this.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 long getTotal( IAEItemStack is )
{
IAEItemStack a = this.storage.findPrecise( is );
IAEItemStack b = this.active.findPrecise( is );
IAEItemStack c = this.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;
}
private void deleteVisualStack( IAEItemStack l )
{
Iterator<IAEItemStack> i = this.visual.iterator();
while( i.hasNext() )
{
IAEItemStack o = i.next();
if( o.equals( l ) )
{
i.remove();
return;
}
}
}
private IAEItemStack findVisualStack( IAEItemStack l )
{
for( IAEItemStack o : this.visual )
{
if( o.equals( l ) )
{
return o;
}
}
IAEItemStack stack = l.copy();
this.visual.add( stack );
return stack;
}
@Override
@@ -450,5 +444,4 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
{
return ViewItems.ALL;
}
}
@@ -19,8 +19,10 @@
/**
*
*/
package appeng.client.gui.implementations;
import java.io.IOException;
import org.lwjgl.input.Mouse;
@@ -46,6 +48,7 @@ import appeng.parts.reporting.PartCraftingTerminal;
import appeng.parts.reporting.PartPatternTerminal;
import appeng.parts.reporting.PartTerminal;
public class GuiCraftingStatus extends GuiCraftingCPU
{
@@ -56,7 +59,8 @@ public class GuiCraftingStatus extends GuiCraftingCPU
GuiBridge originalGui;
ItemStack myIcon = null;
public GuiCraftingStatus(InventoryPlayer inventoryPlayer, ITerminalHost te) {
public GuiCraftingStatus( InventoryPlayer inventoryPlayer, ITerminalHost te )
{
super( new ContainerCraftingStatus( inventoryPlayer, te ) );
this.status = (ContainerCraftingStatus) this.inventorySlots;
@@ -64,9 +68,9 @@ public class GuiCraftingStatus extends GuiCraftingCPU
final IDefinitions definitions = AEApi.instance().definitions();
final IParts parts = definitions.parts();
if ( target instanceof WirelessTerminalGuiObject )
if( target instanceof WirelessTerminalGuiObject )
{
for ( ItemStack wirelessTerminalStack : definitions.items().wirelessTerminal().maybeStack( 1 ).asSet() )
for( ItemStack wirelessTerminalStack : definitions.items().wirelessTerminal().maybeStack( 1 ).asSet() )
{
this.myIcon = wirelessTerminalStack;
}
@@ -74,27 +78,27 @@ public class GuiCraftingStatus extends GuiCraftingCPU
this.originalGui = GuiBridge.GUI_WIRELESS_TERM;
}
if ( target instanceof PartTerminal )
if( target instanceof PartTerminal )
{
for ( ItemStack stack : parts.terminal().maybeStack( 1 ).asSet() )
for( ItemStack stack : parts.terminal().maybeStack( 1 ).asSet() )
{
this.myIcon = stack;
}
this.originalGui = GuiBridge.GUI_ME;
}
if ( target instanceof PartCraftingTerminal )
if( target instanceof PartCraftingTerminal )
{
for ( ItemStack stack : parts.craftingTerminal().maybeStack( 1 ).asSet() )
for( ItemStack stack : parts.craftingTerminal().maybeStack( 1 ).asSet() )
{
this.myIcon = stack;
}
this.originalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
}
if ( target instanceof PartPatternTerminal )
if( target instanceof PartPatternTerminal )
{
for ( ItemStack stack : parts.patternTerminal().maybeStack( 1 ).asSet() )
for( ItemStack stack : parts.patternTerminal().maybeStack( 1 ).asSet() )
{
this.myIcon = stack;
}
@@ -103,36 +107,30 @@ public class GuiCraftingStatus extends GuiCraftingCPU
}
@Override
protected void actionPerformed(GuiButton btn)
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if ( btn == this.selectCPU )
if( btn == this.selectCPU )
{
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "Terminal.Cpu", backwards ? "Prev" : "Next" ) );
}
catch (IOException e)
catch( IOException e )
{
AELog.error( e );
}
}
if ( btn == this.originalGuiBtn )
if( btn == this.originalGuiBtn )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( this.originalGui ) );
}
}
@Override
protected String getGuiDisplayName(String in)
{
return in; // the cup name is on the button
}
@Override
public void initGui()
{
@@ -142,20 +140,27 @@ public class GuiCraftingStatus extends GuiCraftingCPU
// selectCPU.enabled = false;
this.buttonList.add( this.selectCPU );
if ( this.myIcon != null )
if( this.myIcon != null )
{
this.buttonList.add( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 213, this.guiTop - 4, this.myIcon, this.myIcon.getDisplayName(), itemRender ) );
this.originalGuiBtn.hideEdge = 13;
}
}
@Override
public void drawScreen( int mouseX, int mouseY, float btn )
{
this.updateCPUButtonText();
super.drawScreen( mouseX, mouseY, btn );
}
private void updateCPUButtonText()
{
String btnTextText = GuiText.NoCraftingJobs.getLocal();
if ( this.status.selectedCpu >= 0 )// && status.selectedCpu < status.cpus.size() )
if( this.status.selectedCpu >= 0 )// && status.selectedCpu < status.cpus.size() )
{
if ( this.status.myName.length() > 0 )
if( this.status.myName.length() > 0 )
{
String name = this.status.myName.substring( 0, Math.min( 20, this.status.myName.length() ) );
btnTextText = GuiText.CPUs.getLocal() + ": " + name;
@@ -164,16 +169,15 @@ public class GuiCraftingStatus extends GuiCraftingCPU
btnTextText = GuiText.CPUs.getLocal() + ": #" + this.status.selectedCpu;
}
if ( this.status.noCPU )
if( this.status.noCPU )
btnTextText = GuiText.NoCraftingJobs.getLocal();
this.selectCPU.displayString = btnTextText;
}
@Override
public void drawScreen(int mouseX, int mouseY, float btn)
protected String getGuiDisplayName( String in )
{
this.updateCPUButtonText();
super.drawScreen( mouseX, mouseY, btn );
return in; // the cup name is on the button
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
@@ -34,11 +35,42 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketInventoryAction;
import appeng.helpers.InventoryAction;
public class GuiCraftingTerm extends GuiMEMonitorable
{
GuiImgButton clearBtn;
public GuiCraftingTerm( InventoryPlayer inventoryPlayer, ITerminalHost te )
{
super( inventoryPlayer, te, new ContainerCraftingTerm( inventoryPlayer, te ) );
this.reservedSpace = 73;
}
@Override
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
if( this.clearBtn == btn )
{
Slot s = null;
Container c = this.inventorySlots;
for( Object j : c.inventorySlots )
{
if( j instanceof SlotCraftingMatrix )
s = (Slot) j;
}
if( s != null )
{
PacketInventoryAction p;
p = new PacketInventoryAction( InventoryAction.MOVE_REGION, s.slotNumber, 0 );
NetworkHandler.instance.sendToServer( p );
}
}
}
@Override
public void initGui()
{
@@ -48,32 +80,10 @@ public class GuiCraftingTerm extends GuiMEMonitorable
}
@Override
protected void actionPerformed(GuiButton btn)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
super.actionPerformed( btn );
if ( this.clearBtn == btn )
{
Slot s = null;
Container c = this.inventorySlots;
for (Object j : c.inventorySlots)
{
if ( j instanceof SlotCraftingMatrix )
s = (Slot) j;
}
if ( s != null )
{
PacketInventoryAction p;
p = new PacketInventoryAction( InventoryAction.MOVE_REGION, s.slotNumber, 0 );
NetworkHandler.instance.sendToServer( p );
}
}
}
public GuiCraftingTerm(InventoryPlayer inventoryPlayer, ITerminalHost te) {
super( inventoryPlayer, te, new ContainerCraftingTerm( inventoryPlayer, te ) );
this.reservedSpace = 73;
super.drawFG( offsetX, offsetY, mouseX, mouseY );
this.fontRendererObj.drawString( GuiText.CraftingTerminal.getLocal(), 8, this.ySize - 96 + 1 - this.reservedSpace, 4210752 );
}
@Override
@@ -81,12 +91,4 @@ public class GuiCraftingTerm extends GuiMEMonitorable
{
return "guis/crafting.png";
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
super.drawFG( offsetX, offsetY, mouseX, mouseY );
this.fontRendererObj.drawString( GuiText.CraftingTerminal.getLocal(), 8, this.ySize - 96 + 1 - this.reservedSpace, 4210752 );
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
@@ -30,17 +31,24 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.tile.storage.TileDrive;
public class GuiDrive extends AEBaseGui
{
GuiTabButton priority;
public GuiDrive( InventoryPlayer inventoryPlayer, TileDrive te )
{
super( new ContainerDrive( inventoryPlayer, te ) );
this.ySize = 199;
}
@Override
protected void actionPerformed(GuiButton par1GuiButton)
protected void actionPerformed( GuiButton par1GuiButton )
{
super.actionPerformed( par1GuiButton );
if ( par1GuiButton == this.priority )
if( par1GuiButton == this.priority )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
}
@@ -54,23 +62,17 @@ public class GuiDrive extends AEBaseGui
this.buttonList.add( this.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)
{
this.bindTexture( "guis/drive.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.Drive.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/drive.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
}
@@ -50,19 +50,6 @@ public class GuiFormationPlane extends GuiUpgradeable
this.ySize = 251;
}
@Override
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.FormationPlane.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
if ( this.fuzzyMode != null )
this.fuzzyMode.set( this.cvb.fzMode );
if ( this.placeMode != null )
this.placeMode.set( ( ( ContainerFormationPlane ) this.cvb ).placeMode );
}
@Override
protected void addButtons()
{
@@ -76,21 +63,16 @@ public class GuiFormationPlane extends GuiUpgradeable
}
@Override
protected void actionPerformed( GuiButton btn )
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
super.actionPerformed( btn );
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.FormationPlane.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
boolean backwards = Mouse.isButtonDown( 1 );
if ( btn == this.priority )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
}
else if ( btn == this.placeMode )
{
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.placeMode.getSetting(), backwards ) );
}
if( this.fuzzyMode != null )
this.fuzzyMode.set( this.cvb.fzMode );
if( this.placeMode != null )
this.placeMode.set( ( (ContainerFormationPlane) this.cvb ).placeMode );
}
@Override
@@ -99,4 +81,20 @@ public class GuiFormationPlane extends GuiUpgradeable
return "guis/storagebus.png";
}
@Override
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if( btn == this.priority )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
}
else if( btn == this.placeMode )
{
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.placeMode.getSetting(), backwards ) );
}
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.client.gui.AEBaseGui;
@@ -25,26 +26,27 @@ 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) {
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)
{
this.bindTexture( "guis/grinder.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.GrindStone.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/grinder.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
@@ -37,51 +38,19 @@ 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) {
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 );
final IDefinitions definitions = AEApi.instance().definitions();
for ( ItemStack cell1kStack : definitions.items().cell1k().maybeStack( 1 ).asSet() )
{
this.drawItem( offsetX + 66 - 8, offsetY + 17, cell1kStack );
}
for ( ItemStack driveStack : definitions.blocks().drive().maybeStack( 1 ).asSet() )
{
this.drawItem( offsetX + 94 + 8, offsetY + 17, driveStack );
}
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.IOPort.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
if ( this.redstoneMode != null )
this.redstoneMode.set( this.cvb.rsMode );
if ( this.operationMode != null )
this.operationMode.set( ((ContainerIOPort) this.cvb).opMode );
if ( this.fullMode != null )
this.fullMode.set( ((ContainerIOPort) this.cvb).fMode );
}
@Override
protected void addButtons()
{
@@ -95,17 +64,37 @@ public class GuiIOPort extends GuiUpgradeable
}
@Override
protected void actionPerformed(GuiButton btn)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
super.actionPerformed( btn );
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.IOPort.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
boolean backwards = Mouse.isButtonDown( 1 );
if( this.redstoneMode != null )
this.redstoneMode.set( this.cvb.rsMode );
if ( btn == this.fullMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.fullMode.getSetting(), backwards ) );
if( this.operationMode != null )
this.operationMode.set( ( (ContainerIOPort) this.cvb ).opMode );
if ( btn == this.operationMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.operationMode.getSetting(), backwards ) );
if( this.fullMode != null )
this.fullMode.set( ( (ContainerIOPort) this.cvb ).fMode );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
super.drawBG( offsetX, offsetY, mouseX, mouseY );
final IDefinitions definitions = AEApi.instance().definitions();
for( ItemStack cell1kStack : definitions.items().cell1k().maybeStack( 1 ).asSet() )
{
this.drawItem( offsetX + 66 - 8, offsetY + 17, cell1kStack );
}
for( ItemStack driveStack : definitions.blocks().drive().maybeStack( 1 ).asSet() )
{
this.drawItem( offsetX + 94 + 8, offsetY + 17, driveStack );
}
}
@Override
@@ -114,4 +103,17 @@ public class GuiIOPort extends GuiUpgradeable
return "guis/ioport.png";
}
@Override
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if( btn == this.fullMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.fullMode.getSetting(), backwards ) );
if( btn == this.operationMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.operationMode.getSetting(), backwards ) );
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.client.gui.AEBaseGui;
@@ -28,13 +29,14 @@ import appeng.container.implementations.ContainerUpgradeable;
import appeng.core.localization.GuiText;
import appeng.tile.misc.TileInscriber;
public class GuiInscriber extends AEBaseGui
{
final ContainerInscriber cvc;
GuiProgressBar pb;
public GuiInscriber(InventoryPlayer inventoryPlayer, TileInscriber te)
public GuiInscriber( InventoryPlayer inventoryPlayer, TileInscriber te )
{
super( new ContainerInscriber( inventoryPlayer, te ) );
this.cvc = (ContainerInscriber) this.inventorySlots;
@@ -42,32 +44,22 @@ public class GuiInscriber extends AEBaseGui
this.xSize = this.hasToolbox() ? 246 : 211;
}
protected boolean hasToolbox()
{
return ( (ContainerUpgradeable) this.inventorySlots ).hasToolbox();
}
@Override
public void initGui()
{
super.initGui();
this.pb = new GuiProgressBar( this.cvc, "guis/inscriber.png", 135, 39, 135, 177, 6, 18, Direction.VERTICAL );
this.pb = new GuiProgressBar( this.cvc, "guis/inscriber.png", 135, 39, 135, 177, 6, 18, Direction.VERTICAL );
this.buttonList.add( this.pb );
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.bindTexture( "guis/inscriber.png" );
this.pb.xPosition = 135 + this.guiLeft;
this.pb.yPosition = 39 + this.guiTop;
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, 211 - 34, this.ySize );
if ( this.drawUpgrades() )
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 14 + this.cvc.availableUpgrades() * 18 );
if ( this.hasToolbox() )
this.drawTexturedModalRect( offsetX + 178, offsetY + this.ySize - 90, 178, this.ySize - 90, 68, 68 );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.pb.setFullMsg( this.cvc.getCurrentProgress() * 100 / this.cvc.getMaxProgress() + "%" );
@@ -75,14 +67,23 @@ public class GuiInscriber extends AEBaseGui
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/inscriber.png" );
this.pb.xPosition = 135 + this.guiLeft;
this.pb.yPosition = 39 + this.guiTop;
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, 211 - 34, this.ySize );
if( this.drawUpgrades() )
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 14 + this.cvc.availableUpgrades() * 18 );
if( this.hasToolbox() )
this.drawTexturedModalRect( offsetX + 178, offsetY + this.ySize - 90, 178, this.ySize - 90, 68, 68 );
}
protected boolean drawUpgrades()
{
return true;
}
protected boolean hasToolbox()
{
return ((ContainerUpgradeable) this.inventorySlots).hasToolbox();
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
@@ -36,6 +37,7 @@ import appeng.core.sync.packets.PacketConfigButton;
import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.helpers.IInterfaceHost;
public class GuiInterface extends GuiUpgradeable
{
@@ -43,30 +45,12 @@ public class GuiInterface extends GuiUpgradeable
GuiImgButton BlockMode;
GuiToggleButton interfaceMode;
public GuiInterface(InventoryPlayer inventoryPlayer, IInterfaceHost te) {
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 == this.priority )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
}
if ( btn == this.interfaceMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( Settings.INTERFACE_TERMINAL, backwards ) );
if ( btn == this.BlockMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.BlockMode.getSetting(), backwards ) );
}
@Override
protected void addButtons()
{
@@ -76,25 +60,18 @@ public class GuiInterface extends GuiUpgradeable
this.BlockMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.BLOCK, YesNo.NO );
this.buttonList.add( this.BlockMode );
this.interfaceMode = new GuiToggleButton( this.guiLeft - 18, this.guiTop + 26, 84, 85, GuiText.InterfaceTerminal.getLocal(),
GuiText.InterfaceTerminalHint.getLocal() );
this.interfaceMode = new GuiToggleButton( this.guiLeft - 18, this.guiTop + 26, 84, 85, GuiText.InterfaceTerminal.getLocal(), GuiText.InterfaceTerminalHint.getLocal() );
this.buttonList.add( this.interfaceMode );
}
@Override
protected String getBackground()
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
return "guis/interface.png";
}
if( this.BlockMode != null )
this.BlockMode.set( ( (ContainerInterface) this.cvb ).bMode );
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
if ( this.BlockMode != null )
this.BlockMode.set( ((ContainerInterface) this.cvb).bMode );
if ( this.interfaceMode != null )
this.interfaceMode.setState( ((ContainerInterface) this.cvb).iTermMode == YesNo.YES );
if( this.interfaceMode != null )
this.interfaceMode.setState( ( (ContainerInterface) this.cvb ).iTermMode == YesNo.YES );
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.Interface.getLocal() ), 8, 6, 4210752 );
@@ -104,4 +81,29 @@ public class GuiInterface extends GuiUpgradeable
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
protected String getBackground()
{
return "guis/interface.png";
}
@Override
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if( btn == this.priority )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
}
if( btn == this.interfaceMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( Settings.INTERFACE_TERMINAL, backwards ) );
if( btn == this.BlockMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.BlockMode.getSetting(), backwards ) );
}
}
@@ -28,8 +28,6 @@ import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import com.google.common.collect.HashMultimap;
import org.lwjgl.opengl.GL11;
import net.minecraft.entity.player.InventoryPlayer;
@@ -37,6 +35,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import com.google.common.collect.HashMultimap;
import appeng.api.AEApi;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiScrollbar;
@@ -48,6 +48,7 @@ import appeng.core.localization.GuiText;
import appeng.parts.reporting.PartMonitor;
import appeng.util.Platform;
public class GuiInterfaceTerminal extends AEBaseGui
{
@@ -66,7 +67,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
private boolean refreshList = false;
private MEGuiTextField searchField;
public GuiInterfaceTerminal(InventoryPlayer inventoryPlayer, PartMonitor te)
public GuiInterfaceTerminal( InventoryPlayer inventoryPlayer, PartMonitor te )
{
super( new ContainerInterfaceTerminal( inventoryPlayer, te ) );
this.myScrollBar = new GuiScrollbar();
@@ -92,11 +93,54 @@ public class GuiInterfaceTerminal extends AEBaseGui
}
@Override
protected void mouseClicked(int xCoord, int yCoord, int btn)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.InterfaceTerminal.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
int offset = 17;
int ex = this.myScrollBar.getCurrentScroll();
Iterator<Object> o = this.inventorySlots.inventorySlots.iterator();
while( o.hasNext() )
{
if( o.next() instanceof SlotDisconnected )
o.remove();
}
for( int x = 0; x < LINES_ON_PAGE && ex + x < this.lines.size(); x++ )
{
Object lineObj = this.lines.get( ex + x );
if( lineObj instanceof ClientDCInternalInv )
{
ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
for( int z = 0; z < inv.inv.getSizeInventory(); z++ )
{
this.inventorySlots.inventorySlots.add( new SlotDisconnected( inv, z, z * 18 + 8, 1 + offset ) );
}
}
else if( lineObj instanceof String )
{
String name = (String) lineObj;
int rows = this.byName.get( name ).size();
if( rows > 1 )
name = name + " (" + rows + ')';
while( name.length() > 2 && this.fontRendererObj.getStringWidth( name ) > 155 )
name = name.substring( 0, name.length() - 1 );
this.fontRendererObj.drawString( name, 10, 6 + offset, 4210752 );
}
offset += 18;
}
}
@Override
protected void mouseClicked( int xCoord, int yCoord, int btn )
{
this.searchField.mouseClicked( xCoord, yCoord, btn );
if ( btn == 1 && this.searchField.isMouseIn( xCoord, yCoord ) )
if( btn == 1 && this.searchField.isMouseIn( xCoord, yCoord ) )
{
this.searchField.setText( "" );
this.refreshList();
@@ -106,26 +150,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
}
@Override
protected void keyTyped(char character, int key)
{
if ( !this.checkHotbarKeys( key ) )
{
if ( character == ' ' && this.searchField.getText().length() == 0 )
return;
if ( this.searchField.textboxKeyTyped( character, key ) )
{
this.refreshList();
}
else
{
super.keyTyped( character, key );
}
}
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/interfaceterminal.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
@@ -133,10 +158,10 @@ public class GuiInterfaceTerminal extends AEBaseGui
int offset = 17;
int ex = this.myScrollBar.getCurrentScroll();
for (int x = 0; x < LINES_ON_PAGE && ex + x < this.lines.size(); x++)
for( int x = 0; x < LINES_ON_PAGE && ex + x < this.lines.size(); x++ )
{
Object lineObj = this.lines.get( ex + x );
if ( lineObj instanceof ClientDCInternalInv )
if( lineObj instanceof ClientDCInternalInv )
{
ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
@@ -147,65 +172,41 @@ public class GuiInterfaceTerminal extends AEBaseGui
offset += 18;
}
if ( this.searchField != null )
if( this.searchField != null )
this.searchField.drawTextBox();
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
protected void keyTyped( char character, int key )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.InterfaceTerminal.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
int offset = 17;
int ex = this.myScrollBar.getCurrentScroll();
Iterator<Object> o = this.inventorySlots.inventorySlots.iterator();
while (o.hasNext())
if( !this.checkHotbarKeys( key ) )
{
if ( o.next() instanceof SlotDisconnected )
o.remove();
}
if( character == ' ' && this.searchField.getText().length() == 0 )
return;
for (int x = 0; x < LINES_ON_PAGE && ex + x < this.lines.size(); x++)
{
Object lineObj = this.lines.get( ex + x );
if ( lineObj instanceof ClientDCInternalInv )
if( this.searchField.textboxKeyTyped( character, key ) )
{
ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
for (int z = 0; z < inv.inv.getSizeInventory(); z++)
{
this.inventorySlots.inventorySlots.add( new SlotDisconnected( inv, z, z * 18 + 8, 1 + offset ) );
}
this.refreshList();
}
else if ( lineObj instanceof String )
else
{
String name = (String) lineObj;
int rows = this.byName.get( name ).size();
if ( rows > 1 )
name = name + " (" + rows + ')';
while (name.length() > 2 && this.fontRendererObj.getStringWidth( name ) > 155)
name = name.substring( 0, name.length() - 1 );
this.fontRendererObj.drawString( name, 10, 6 + offset, 4210752 );
super.keyTyped( character, key );
}
offset += 18;
}
}
public void postUpdate(NBTTagCompound in)
public void postUpdate( NBTTagCompound in )
{
if ( in.getBoolean( "clear" ) )
if( in.getBoolean( "clear" ) )
{
this.byId.clear();
this.refreshList = true;
}
for (Object oKey : in.func_150296_c())
for( Object oKey : in.func_150296_c() )
{
String key = (String) oKey;
if ( key.startsWith( "=" ) )
if( key.startsWith( "=" ) )
{
try
{
@@ -213,20 +214,20 @@ public class GuiInterfaceTerminal extends AEBaseGui
NBTTagCompound invData = in.getCompoundTag( key );
ClientDCInternalInv current = this.getById( id, invData.getLong( "sortBy" ), invData.getString( "un" ) );
for (int x = 0; x < current.inv.getSizeInventory(); x++)
for( int x = 0; x < current.inv.getSizeInventory(); x++ )
{
String which = Integer.toString( x );
if ( invData.hasKey( which ) )
if( invData.hasKey( which ) )
current.inv.setInventorySlotContents( x, ItemStack.loadItemStackFromNBT( invData.getCompoundTag( which ) ) );
}
}
catch (NumberFormatException ignored)
catch( NumberFormatException ignored )
{
}
}
}
if ( this.refreshList )
if( this.refreshList )
{
this.refreshList = false;
// invalid caches on refresh
@@ -249,10 +250,10 @@ public class GuiInterfaceTerminal extends AEBaseGui
final Set<Object> cachedSearch = this.getCacheForSearchTerm( searchFilterLowerCase );
final boolean rebuild = cachedSearch.isEmpty();
for (ClientDCInternalInv entry : this.byId.values())
for( ClientDCInternalInv entry : this.byId.values() )
{
// ignore inventory if not doing a full rebuild or cache already marks it as miss.
if ( !rebuild && !cachedSearch.contains( entry ) )
if( !rebuild && !cachedSearch.contains( entry ) )
{
continue;
}
@@ -261,12 +262,12 @@ public class GuiInterfaceTerminal extends AEBaseGui
boolean found = searchFilterLowerCase.isEmpty();
// Search if the current inventory holds a pattern containing the search term.
if ( !found && !searchFilterLowerCase.isEmpty() )
if( !found && !searchFilterLowerCase.isEmpty() )
{
for (ItemStack itemStack : entry.inv)
for( ItemStack itemStack : entry.inv )
{
found = this.itemStackMatchesSearchTerm( itemStack, searchFilterLowerCase );
if ( found )
if( found )
{
break;
}
@@ -274,7 +275,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
}
// if found, filter skipped or machine name matching the search term, add it
if ( found || entry.getName().toLowerCase().contains( searchFilterLowerCase ) )
if( found || entry.getName().toLowerCase().contains( searchFilterLowerCase ) )
{
this.byName.put( entry.getName(), entry );
cachedSearch.add( entry );
@@ -293,7 +294,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
this.lines.clear();
this.lines.ensureCapacity( this.getMaxRows() );
for (String n : this.names)
for( String n : this.names )
{
this.lines.add( n );
@@ -307,16 +308,16 @@ public class GuiInterfaceTerminal extends AEBaseGui
this.myScrollBar.setRange( 0, this.lines.size() - LINES_ON_PAGE, 2 );
}
private boolean itemStackMatchesSearchTerm(ItemStack itemStack, String searchTerm)
private boolean itemStackMatchesSearchTerm( ItemStack itemStack, String searchTerm )
{
if ( itemStack == null )
if( itemStack == null )
{
return false;
}
NBTTagCompound encodedValue = itemStack.getTagCompound();
if ( encodedValue == null )
if( encodedValue == null )
{
return false;
}
@@ -325,19 +326,18 @@ public class GuiInterfaceTerminal extends AEBaseGui
// NBTTagList inTag = encodedValue.getTagList( "in", 10 );
NBTTagList outTag = encodedValue.getTagList( "out", 10 );
for (int i = 0; i < outTag.tagCount(); i++)
for( int i = 0; i < outTag.tagCount(); i++ )
{
ItemStack parsedItemStack = ItemStack.loadItemStackFromNBT( outTag.getCompoundTagAt( i ) );
if ( parsedItemStack != null )
if( parsedItemStack != null )
{
String displayName = Platform.getItemDisplayName( AEApi.instance().storage().createItemStack( parsedItemStack ) ).toLowerCase();
if ( displayName.contains( searchTerm ) )
if( displayName.contains( searchTerm ) )
{
return true;
}
}
}
return false;
}
@@ -348,20 +348,20 @@ public class GuiInterfaceTerminal extends AEBaseGui
* If this cache should be empty, it will populate it with an earlier cache if available or at least the cache for
* the empty string.
*
* @param searchTerm
* the corresponding search
* @param searchTerm the corresponding search
*
* @return a Set matching a superset of the search term
*/
private Set<Object> getCacheForSearchTerm(String searchTerm)
private Set<Object> getCacheForSearchTerm( String searchTerm )
{
if ( !this.cachedSearches.containsKey( searchTerm ) )
if( !this.cachedSearches.containsKey( searchTerm ) )
{
this.cachedSearches.put( searchTerm, new HashSet<Object>() );
}
Set<Object> cache = this.cachedSearches.get( searchTerm );
if ( cache.isEmpty() && searchTerm.length() > 1 )
if( cache.isEmpty() && searchTerm.length() > 1 )
{
cache.addAll( this.getCacheForSearchTerm( searchTerm.substring( 0, searchTerm.length() - 1 ) ) );
return cache;
@@ -380,11 +380,11 @@ public class GuiInterfaceTerminal extends AEBaseGui
return this.names.size() + this.byId.size();
}
private ClientDCInternalInv getById(long id, long sortBy, String string)
private ClientDCInternalInv getById( long id, long sortBy, String string )
{
ClientDCInternalInv o = this.byId.get( id );
if ( o == null )
if( o == null )
{
this.byId.put( id, o = new ClientDCInternalInv( 9, id, sortBy, string ) );
this.refreshList = true;
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import org.lwjgl.input.Mouse;
@@ -42,6 +43,7 @@ import appeng.core.sync.packets.PacketConfigButton;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.parts.automation.PartLevelEmitter;
public class GuiLevelEmitter extends GuiUpgradeable
{
@@ -59,7 +61,8 @@ public class GuiLevelEmitter extends GuiUpgradeable
GuiImgButton levelMode;
GuiImgButton craftingMode;
public GuiLevelEmitter(InventoryPlayer inventoryPlayer, PartLevelEmitter te) {
public GuiLevelEmitter( InventoryPlayer inventoryPlayer, PartLevelEmitter te )
{
super( new ContainerLevelEmitter( inventoryPlayer, te ) );
}
@@ -74,7 +77,7 @@ public class GuiLevelEmitter extends GuiUpgradeable
this.level.setTextColor( 0xFFFFFF );
this.level.setVisible( true );
this.level.setFocused( true );
((ContainerLevelEmitter) this.inventorySlots).setTextField( this.level );
( (ContainerLevelEmitter) this.inventorySlots ).setTextField( this.level );
}
@Override
@@ -107,111 +110,7 @@ public class GuiLevelEmitter extends GuiUpgradeable
}
@Override
protected void actionPerformed(GuiButton btn)
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if ( btn == this.craftingMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.craftingMode.getSetting(), backwards ) );
if ( btn == this.levelMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.levelMode.getSetting(), backwards ) );
boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
boolean isMinus = btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
if ( isPlus || isMinus )
this.addQty( this.getQty( btn ) );
}
private void addQty(long i)
{
try
{
String Out = this.level.getText();
boolean Fixed = false;
while (Out.startsWith( "0" ) && Out.length() > 1)
{
Out = Out.substring( 1 );
Fixed = true;
}
if ( Fixed )
this.level.setText( Out );
if ( Out.length() == 0 )
Out = "0";
long result = Long.parseLong( Out );
result += i;
if ( result < 0 )
result = 0;
this.level.setText( Out = Long.toString( result ) );
NetworkHandler.instance.sendToServer( new PacketValueConfig( "LevelEmitter.Value", Out ) );
}
catch (NumberFormatException e)
{
// nope..
this.level.setText( "0" );
}
catch (IOException e)
{
AELog.error( e );
}
}
@Override
protected void handleButtonVisibility()
{
this.craftingMode.setVisibility( this.bc.getInstalledUpgrades( Upgrades.CRAFTING ) > 0 );
this.fuzzyMode.setVisibility( this.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 )) && this.level.textboxKeyTyped( character, key ) )
{
try
{
String Out = this.level.getText();
boolean Fixed = false;
while (Out.startsWith( "0" ) && Out.length() > 1)
{
Out = Out.substring( 1 );
Fixed = true;
}
if ( Fixed )
this.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)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
boolean notCraftingMode = this.bc.getInstalledUpgrades( Upgrades.CRAFTING ) == 0;
@@ -230,20 +129,27 @@ public class GuiLevelEmitter extends GuiUpgradeable
super.drawFG( offsetX, offsetY, mouseX, mouseY );
if ( this.craftingMode != null )
this.craftingMode.set( ((ContainerLevelEmitter) this.cvb).cmType );
if( this.craftingMode != null )
this.craftingMode.set( ( (ContainerLevelEmitter) this.cvb ).cmType );
if ( this.levelMode != null )
this.levelMode.set( ((ContainerLevelEmitter) this.cvb).lvType );
if( this.levelMode != null )
this.levelMode.set( ( (ContainerLevelEmitter) this.cvb ).lvType );
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
super.drawBG( offsetX, offsetY, mouseX, mouseY );
this.level.drawTextBox();
}
@Override
protected void handleButtonVisibility()
{
this.craftingMode.setVisibility( this.bc.getInstalledUpgrades( Upgrades.CRAFTING ) > 0 );
this.fuzzyMode.setVisibility( this.bc.getInstalledUpgrades( Upgrades.FUZZY ) > 0 );
}
@Override
protected String getBackground()
{
@@ -255,4 +161,101 @@ public class GuiLevelEmitter extends GuiUpgradeable
{
return GuiText.LevelEmitter;
}
@Override
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if( btn == this.craftingMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.craftingMode.getSetting(), backwards ) );
if( btn == this.levelMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.levelMode.getSetting(), backwards ) );
boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
boolean isMinus = btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
if( isPlus || isMinus )
this.addQty( this.getQty( btn ) );
}
private void addQty( long i )
{
try
{
String Out = this.level.getText();
boolean Fixed = false;
while( Out.startsWith( "0" ) && Out.length() > 1 )
{
Out = Out.substring( 1 );
Fixed = true;
}
if( Fixed )
this.level.setText( Out );
if( Out.length() == 0 )
Out = "0";
long result = Long.parseLong( Out );
result += i;
if( result < 0 )
result = 0;
this.level.setText( Out = Long.toString( result ) );
NetworkHandler.instance.sendToServer( new PacketValueConfig( "LevelEmitter.Value", Out ) );
}
catch( NumberFormatException e )
{
// nope..
this.level.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.isDigit( character ) ) && this.level.textboxKeyTyped( character, key ) )
{
try
{
String Out = this.level.getText();
boolean Fixed = false;
while( Out.startsWith( "0" ) && Out.length() > 1 )
{
Out = Out.substring( 1 );
Fixed = true;
}
if( Fixed )
this.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 );
}
}
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.config.RedstoneMode;
@@ -29,12 +30,20 @@ import appeng.container.implementations.ContainerMAC;
import appeng.core.localization.GuiText;
import appeng.tile.crafting.TileMolecularAssembler;
public class GuiMAC extends GuiUpgradeable
{
final ContainerMAC container;
GuiProgressBar pb;
public GuiMAC( InventoryPlayer inventoryPlayer, TileMolecularAssembler te )
{
super( new ContainerMAC( inventoryPlayer, te ) );
this.ySize = 197;
this.container = (ContainerMAC) this.inventorySlots;
}
@Override
public void initGui()
{
@@ -45,25 +54,25 @@ public class GuiMAC extends GuiUpgradeable
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
protected void addButtons()
{
this.pb.xPosition = 148 + this.guiLeft;
this.pb.yPosition = 48 + this.guiTop;
super.drawBG( offsetX, offsetY, mouseX, mouseY );
this.redstoneMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
this.buttonList.add( this.redstoneMode );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.pb.setFullMsg( this.container.getCurrentProgress() + "%" );
super.drawFG( offsetX, offsetY, mouseX, mouseY );
}
@Override
protected void addButtons()
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.redstoneMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 8, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
this.buttonList.add( this.redstoneMode );
this.pb.xPosition = 148 + this.guiLeft;
this.pb.yPosition = 48 + this.guiTop;
super.drawBG( offsetX, offsetY, mouseX, mouseY );
}
@Override
@@ -72,13 +81,6 @@ public class GuiMAC extends GuiUpgradeable
return "guis/mac.png";
}
public GuiMAC(InventoryPlayer inventoryPlayer, TileMolecularAssembler te)
{
super( new ContainerMAC( inventoryPlayer, te ) );
this.ySize = 197;
this.container = (ContainerMAC) this.inventorySlots;
}
@Override
protected GuiText getName()
{
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import java.util.List;
@@ -65,50 +66,42 @@ 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;
private static String memoryText = "";
final ItemRepo repo;
GuiText myName;
final int offsetX = 9;
final int lowerTextureOffset = 0;
final IConfigManager configSrc;
final boolean viewCell;
final ItemStack[] myCurrentViewCells = new ItemStack[5];
final ContainerMEMonitorable monitorableContainer;
GuiTabButton craftingStatusBtn;
MEGuiTextField searchField;
GuiText myName;
int perRow = 9;
int reservedSpace = 0;
final int lowerTextureOffset = 0;
boolean customSortOrder = true;
int rows = 0;
int maxRows = Integer.MAX_VALUE;
int standardSize;
final IConfigManager configSrc;
GuiImgButton ViewBox;
GuiImgButton SortByBox;
GuiImgButton SortDirBox;
GuiImgButton searchBoxSettings;
GuiImgButton terminalStyleBox;
final boolean viewCell;
final ItemStack[] myCurrentViewCells = new ItemStack[5];
final ContainerMEMonitorable monitorableContainer;
public GuiMEMonitorable(InventoryPlayer inventoryPlayer, ITerminalHost te) {
public GuiMEMonitorable( InventoryPlayer inventoryPlayer, ITerminalHost te )
{
this( inventoryPlayer, te, new ContainerMEMonitorable( inventoryPlayer, te ) );
}
public GuiMEMonitorable(InventoryPlayer inventoryPlayer, ITerminalHost te, ContainerMEMonitorable c) {
public GuiMEMonitorable( InventoryPlayer inventoryPlayer, ITerminalHost te, ContainerMEMonitorable c )
{
super( c );
this.myScrollBar = new GuiScrollbar();
@@ -117,31 +110,31 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
this.xSize = 185;
this.ySize = 204;
if ( te instanceof IViewCellStorage )
if( te instanceof IViewCellStorage )
this.xSize += 33;
this.standardSize = this.xSize;
this.configSrc = ((IConfigurableObject) this.inventorySlots).getConfigManager();
(this.monitorableContainer = (ContainerMEMonitorable) this.inventorySlots).gui = this;
this.configSrc = ( (IConfigurableObject) this.inventorySlots ).getConfigManager();
( this.monitorableContainer = (ContainerMEMonitorable) this.inventorySlots ).gui = this;
this.viewCell = te instanceof IViewCellStorage;
if ( te instanceof TileSecurity )
if( te instanceof TileSecurity )
this.myName = GuiText.Security;
else if ( te instanceof WirelessTerminalGuiObject )
else if( te instanceof WirelessTerminalGuiObject )
this.myName = GuiText.WirelessTerminal;
else if ( te instanceof IPortableCell )
else if( te instanceof IPortableCell )
this.myName = GuiText.PortableCell;
else if ( te instanceof IMEChest )
else if( te instanceof IMEChest )
this.myName = GuiText.Chest;
else if ( te instanceof PartTerminal )
else if( te instanceof PartTerminal )
this.myName = GuiText.Terminal;
}
public void postUpdate(List<IAEItemStack> list)
public void postUpdate( List<IAEItemStack> list )
{
for (IAEItemStack is : list)
for( IAEItemStack is : list )
this.repo.postUpdate( is );
this.repo.updateView();
@@ -151,7 +144,49 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
private void setScrollBar()
{
this.myScrollBar.setTop( 18 ).setLeft( 175 ).setHeight( this.rows * 18 - 2 );
this.myScrollBar.setRange( 0, (this.repo.size() + this.perRow - 1) / this.perRow - this.rows, Math.max( 1, this.rows / 6 ) );
this.myScrollBar.setRange( 0, ( this.repo.size() + this.perRow - 1 ) / this.perRow - this.rows, Math.max( 1, this.rows / 6 ) );
}
@Override
protected void actionPerformed( GuiButton btn )
{
if( btn == this.craftingStatusBtn )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_CRAFTING_STATUS ) );
}
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 == this.terminalStyleBox )
AEConfig.instance.settings.putSetting( iBtn.getSetting(), next );
else if( btn == this.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 )
this.re_init();
}
}
}
public void re_init()
@@ -160,18 +195,11 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
this.initGui();
}
@Override
public void onGuiClosed()
{
super.onGuiClosed();
memoryText = this.searchField.getText();
}
@Override
public void initGui()
{
this.maxRows = this.getMaxRows();
this.perRow = AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ((this.width - this.standardSize) / 18);
this.perRow = AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ( ( this.width - this.standardSize ) / 18 );
boolean hasNEI = AppEng.instance.isIntegrationEnabled( IntegrationType.NEI );
@@ -182,29 +210,29 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
int extraSpace = this.height - magicNumber - NEI - top - this.reservedSpace;
this.rows = (int) Math.floor( extraSpace / 18 );
if ( this.rows > this.maxRows )
if( this.rows > this.maxRows )
{
top += (this.rows - this.maxRows) * 18 / 2;
top += ( this.rows - this.maxRows ) * 18 / 2;
this.rows = this.maxRows;
}
if ( hasNEI )
if( hasNEI )
this.rows--;
if ( this.rows < 3 )
if( this.rows < 3 )
this.rows = 3;
this.meSlots.clear();
for (int y = 0; y < this.rows; y++)
for( int y = 0; y < this.rows; y++ )
{
for (int x = 0; x < this.perRow; x++)
for( int x = 0; x < this.perRow; x++ )
{
this.meSlots.add( new InternalSlotME( this.repo, x + y * this.perRow, this.offsetX + x * 18, 18 + y * 18 ) );
}
}
if ( AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL )
this.xSize = this.standardSize + ((this.perRow - 9) * 18);
if( AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL )
this.xSize = this.standardSize + ( ( this.perRow - 9 ) * 18 );
else
this.xSize = this.standardSize;
@@ -216,17 +244,17 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
this.ySize = magicNumber + this.rows * 18 + this.reservedSpace;
// this.guiTop = top;
int unusedSpace = this.height - this.ySize;
this.guiTop = (int) Math.floor( unusedSpace / (unusedSpace < 0 ? 3.8f : 2.0f) );
this.guiTop = (int) Math.floor( unusedSpace / ( unusedSpace < 0 ? 3.8f : 2.0f ) );
int offset = this.guiTop + 8;
if ( this.customSortOrder )
if( this.customSortOrder )
{
this.buttonList.add( this.SortByBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_BY, this.configSrc.getSetting( Settings.SORT_BY ) ) );
offset += 20;
}
if ( this.viewCell || this instanceof GuiWirelessTerm )
if( this.viewCell || this instanceof GuiWirelessTerm )
{
this.buttonList.add( this.ViewBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.VIEW_MODE, this.configSrc.getSetting( Settings.VIEW_MODE ) ) );
offset += 20;
@@ -235,14 +263,12 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
this.buttonList.add( this.SortDirBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_DIRECTION, this.configSrc.getSetting( Settings.SORT_DIRECTION ) ) );
offset += 20;
this.buttonList.add( this.searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance.settings
.getSetting( Settings.SEARCH_MODE ) ) );
this.buttonList.add( this.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 )
if( !( this instanceof GuiMEPortableCell ) || this instanceof GuiWirelessTerm )
{
this.buttonList.add( this.terminalStyleBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance.settings
.getSetting( Settings.TERMINAL_STYLE ) ) );
this.buttonList.add( this.terminalStyleBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance.settings.getSetting( Settings.TERMINAL_STYLE ) ) );
}
this.searchField = new MEGuiTextField( this.fontRendererObj, this.guiLeft + Math.max( 80, this.offsetX ), this.guiTop + 4, 90, 12 );
@@ -251,10 +277,9 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
this.searchField.setTextColor( 0xFFFFFF );
this.searchField.setVisible( true );
if ( this.viewCell || this instanceof GuiWirelessTerm )
if( this.viewCell || this instanceof GuiWirelessTerm )
{
this.buttonList.add( this.craftingStatusBtn = new GuiTabButton( this.guiLeft + 170, this.guiTop - 4, 2 + 11 * 16, GuiText.CraftingStatus.getLocal(),
itemRender ) );
this.buttonList.add( this.craftingStatusBtn = new GuiTabButton( this.guiLeft + 170, this.guiTop - 4, 2 + 11 * 16, GuiText.CraftingStatus.getLocal(), itemRender ) );
this.craftingStatusBtn.hideEdge = 13;
}
@@ -262,7 +287,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
Enum setting = AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE );
this.searchField.setFocused( SearchBoxMode.AUTOSEARCH == setting || SearchBoxMode.NEI_AUTOSEARCH == setting );
if ( this.isSubGui() )
if( this.isSubGui() )
{
this.searchField.setText( memoryText );
this.repo.searchString = memoryText;
@@ -273,18 +298,18 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
CraftingGridOffsetX = Integer.MAX_VALUE;
CraftingGridOffsetY = Integer.MAX_VALUE;
for (Object s : this.inventorySlots.inventorySlots)
for( Object s : this.inventorySlots.inventorySlots )
{
if ( s instanceof AppEngSlot )
if( s instanceof AppEngSlot )
{
if ( ((AppEngSlot) s).xDisplayPosition < 197 )
if( ( (AppEngSlot) s ).xDisplayPosition < 197 )
this.repositionSlot( (AppEngSlot) s );
}
if ( s instanceof SlotCraftingMatrix || s instanceof SlotFakeCraftingMatrix )
if( s instanceof SlotCraftingMatrix || s instanceof SlotFakeCraftingMatrix )
{
Slot g = (Slot) s;
if ( g.xDisplayPosition > 0 && g.yDisplayPosition > 0 )
if( g.xDisplayPosition > 0 && g.yDisplayPosition > 0 )
{
CraftingGridOffsetX = Math.min( CraftingGridOffsetX, g.xDisplayPosition );
CraftingGridOffsetY = Math.min( CraftingGridOffsetY, g.yDisplayPosition );
@@ -296,64 +321,24 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
CraftingGridOffsetY -= 6;
}
protected void repositionSlot(AppEngSlot s)
@Override
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
s.yDisplayPosition = s.defY + this.ySize - 78 - 5;
this.fontRendererObj.drawString( this.getGuiDisplayName( this.myName.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
protected void actionPerformed(GuiButton btn)
{
if ( btn == this.craftingStatusBtn )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_CRAFTING_STATUS ) );
}
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 == this.terminalStyleBox )
AEConfig.instance.settings.putSetting( iBtn.getSetting(), next );
else if ( btn == this.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 )
this.re_init();
}
}
}
@Override
protected void mouseClicked(int xCoord, int yCoord, int btn)
protected void mouseClicked( int xCoord, int yCoord, int btn )
{
Enum searchMode = AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE );
if ( searchMode != SearchBoxMode.AUTOSEARCH && searchMode != SearchBoxMode.NEI_AUTOSEARCH )
if( searchMode != SearchBoxMode.AUTOSEARCH && searchMode != SearchBoxMode.NEI_AUTOSEARCH )
{
this.searchField.mouseClicked( xCoord, yCoord, btn );
}
if ( btn == 1 && this.searchField.isMouseIn( xCoord, yCoord ) )
if( btn == 1 && this.searchField.isMouseIn( xCoord, yCoord ) )
{
this.searchField.setText( "" );
this.repo.searchString = "";
@@ -365,14 +350,79 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
}
@Override
protected void keyTyped(char character, int key)
public void onGuiClosed()
{
if ( !this.checkHotbarKeys( key ) )
super.onGuiClosed();
memoryText = this.searchField.getText();
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
int x_width = 197;
this.bindTexture( this.getBackground() );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, x_width, 18 );
if( this.viewCell || ( this instanceof GuiSecurity ) )
this.drawTexturedModalRect( offsetX + x_width, offsetY, x_width, 0, 46, 128 );
for( int x = 0; x < this.rows; x++ )
this.drawTexturedModalRect( offsetX, offsetY + 18 + x * 18, 0, 18, x_width, 18 );
this.drawTexturedModalRect( offsetX, offsetY + 16 + this.rows * 18 + this.lowerTextureOffset, 0, 106 - 18 - 18, x_width, 99 + this.reservedSpace - this.lowerTextureOffset );
if( this.viewCell )
{
if ( character == ' ' && this.searchField.getText().length() == 0 )
boolean update = false;
for( int i = 0; i < 5; i++ )
{
if( this.myCurrentViewCells[i] != this.monitorableContainer.cellView[i].getStack() )
{
update = true;
this.myCurrentViewCells[i] = this.monitorableContainer.cellView[i].getStack();
}
}
if( update )
this.repo.setViewCell( this.myCurrentViewCells );
}
if( this.searchField != null )
this.searchField.drawTextBox();
}
protected String getBackground()
{
return "guis/terminal.png";
}
@Override
protected boolean isPowered()
{
return this.repo.hasPower();
}
int getMaxRows()
{
return AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) == TerminalStyle.SMALL ? 6 : Integer.MAX_VALUE;
}
protected void repositionSlot( AppEngSlot s )
{
s.yDisplayPosition = s.defY + this.ySize - 78 - 5;
}
@Override
protected void keyTyped( char character, int key )
{
if( !this.checkHotbarKeys( key ) )
{
if( character == ' ' && this.searchField.getText().length() == 0 )
return;
if ( this.searchField.textboxKeyTyped( character, key ) )
if( this.searchField.textboxKeyTyped( character, key ) )
{
this.repo.searchString = this.searchField.getText();
this.repo.updateView();
@@ -392,55 +442,6 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
super.updateScreen();
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
int x_width = 197;
this.bindTexture( this.getBackground() );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, x_width, 18 );
if ( this.viewCell || (this instanceof GuiSecurity) )
this.drawTexturedModalRect( offsetX + x_width, offsetY, x_width, 0, 46, 128 );
for (int x = 0; x < this.rows; x++)
this.drawTexturedModalRect( offsetX, offsetY + 18 + x * 18, 0, 18, x_width, 18 );
this.drawTexturedModalRect( offsetX, offsetY + 16 + this.rows * 18 + this.lowerTextureOffset, 0, 106 - 18 - 18, x_width, 99 + this.reservedSpace - this.lowerTextureOffset );
if ( this.viewCell )
{
boolean update = false;
for (int i = 0; i < 5; i++)
{
if ( this.myCurrentViewCells[i] != this.monitorableContainer.cellView[i].getStack() )
{
update = true;
this.myCurrentViewCells[i] = this.monitorableContainer.cellView[i].getStack();
}
}
if ( update )
this.repo.setViewCell( this.myCurrentViewCells );
}
if ( this.searchField != null )
this.searchField.drawTextBox();
}
protected String getBackground()
{
return "guis/terminal.png";
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.fontRendererObj.drawString( this.getGuiDisplayName( this.myName.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
public Enum getSortBy()
{
@@ -460,29 +461,17 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
}
@Override
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
public void updateSetting( IConfigManager manager, Enum settingName, Enum newValue )
{
if ( this.SortByBox != null )
if( this.SortByBox != null )
this.SortByBox.set( this.configSrc.getSetting( Settings.SORT_BY ) );
if ( this.SortDirBox != null )
if( this.SortDirBox != null )
this.SortDirBox.set( this.configSrc.getSetting( Settings.SORT_DIRECTION ) );
if ( this.ViewBox != null )
if( this.ViewBox != null )
this.ViewBox.set( this.configSrc.getSetting( Settings.VIEW_MODE ) );
this.repo.updateView();
}
@Override
protected boolean isPowered()
{
return this.repo.hasPower();
}
int getMaxRows()
{
return AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) == TerminalStyle.SMALL ? 6 : Integer.MAX_VALUE;
}
}
@@ -18,15 +18,18 @@
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) {
public GuiMEPortableCell( InventoryPlayer inventoryPlayer, IPortableCell te )
{
super( inventoryPlayer, te, new ContainerMEPortableCell( inventoryPlayer, null ) );
}
@@ -46,15 +46,17 @@ import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.util.Platform;
public class GuiNetworkStatus extends AEBaseGui implements ISortSource
{
final ItemRepo repo;
GuiImgButton units;
final int rows = 4;
GuiImgButton units;
int tooltip = -1;
public GuiNetworkStatus(InventoryPlayer inventoryPlayer, INetworkTool te) {
public GuiNetworkStatus( InventoryPlayer inventoryPlayer, INetworkTool te )
{
super( new ContainerNetworkStatus( inventoryPlayer, te ) );
this.ySize = 153;
this.xSize = 195;
@@ -64,13 +66,13 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
}
@Override
protected void actionPerformed(GuiButton btn)
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if ( btn == this.units )
if( btn == this.units )
{
AEConfig.instance.nextPowerUnit( backwards );
this.units.set( AEConfig.instance.selectedPowerUnit() );
@@ -86,62 +88,34 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
this.buttonList.add( this.units );
}
public void postUpdate(List<IAEItemStack> list)
{
this.repo.clear();
for (IAEItemStack is : list)
this.repo.postUpdate( is );
this.repo.updateView();
this.setScrollBar();
}
private void setScrollBar()
{
int size = this.repo.size();
this.myScrollBar.setTop( 39 ).setLeft( 175 ).setHeight( 78 );
this.myScrollBar.setRange( 0, (size + 4) / 5 - this.rows, 1 );
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.bindTexture( "guis/networkstatus.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
int tooltip = -1;
@Override
public void drawScreen(int mouse_x, int mouse_y, float btn)
public void drawScreen( int mouse_x, int mouse_y, float btn )
{
int x = 0;
int y = 0;
int gx = (this.width - this.xSize) / 2;
int gy = (this.height - this.ySize) / 2;
int gx = ( this.width - this.xSize ) / 2;
int gy = ( this.height - this.ySize ) / 2;
this.tooltip = -1;
for (int z = 0; z <= 4 * 5; z++)
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( minX < mouse_x && minX + 28 > mouse_x )
{
if ( minY < mouse_y && minY + 20 > mouse_y )
if( minY < mouse_y && minY + 20 > mouse_y )
{
this.tooltip = z;
break;
}
}
x++;
if ( x > 4 )
if( x > 4 )
{
y++;
x = 0;
@@ -152,7 +126,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
ContainerNetworkStatus ns = (ContainerNetworkStatus) this.inventorySlots;
@@ -177,32 +151,31 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
int toolPosX = 0;
int toolPosY = 0;
for (int z = viewStart; z < Math.min( viewEnd, this.repo.size() ); z++)
for( int z = viewStart; z < Math.min( viewEnd, this.repo.size() ); z++ )
{
IAEItemStack refStack = this.repo.getReferenceItem( z );
if ( refStack != null )
if( refStack != null )
{
GL11.glPushMatrix();
GL11.glScaled( 0.5, 0.5, 0.5 );
String str = Long.toString( refStack.getStackSize() );
if ( refStack.getStackSize() >= 10000 )
if( refStack.getStackSize() >= 10000 )
str = Long.toString( refStack.getStackSize() / 1000 ) + 'k';
int w = this.fontRendererObj.getStringWidth( str );
this.fontRendererObj.drawString( str, (int) ((x * sectionLength + xo + sectionLength - 19 - (w * 0.5)) * 2), (y * 18 + yo + 6) * 2,
4210752 );
this.fontRendererObj.drawString( str, (int) ( ( x * sectionLength + xo + sectionLength - 19 - ( w * 0.5 ) ) * 2 ), ( y * 18 + yo + 6 ) * 2, 4210752 );
GL11.glPopMatrix();
int posX = x * sectionLength + xo + sectionLength - 18;
int posY = y * 18 + yo;
if ( this.tooltip == z - viewStart )
if( this.tooltip == z - viewStart )
{
toolTip = Platform.getItemDisplayName( this.repo.getItem( z ) );
toolTip += ( '\n' + GuiText.Installed.getLocal() + ": " + ( refStack.getStackSize() ) );
if ( refStack.getCountRequestable() > 0 )
if( refStack.getCountRequestable() > 0 )
toolTip += ( '\n' + GuiText.EnergyDrain.getLocal() + ": " + Platform.formatPowerLong( refStack.getCountRequestable(), true ) );
toolPosX = x * sectionLength + xo + sectionLength - 8;
@@ -213,31 +186,54 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
x++;
if ( x > 4 )
if( x > 4 )
{
y++;
x = 0;
}
}
}
if ( this.tooltip >= 0 && toolTip.length() > 0 )
if( this.tooltip >= 0 && toolTip.length() > 0 )
{
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
this.drawTooltip( toolPosX, toolPosY + 10, 0, toolTip );
GL11.glPopAttrib();
}
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/networkstatus.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
public void postUpdate( List<IAEItemStack> list )
{
this.repo.clear();
for( IAEItemStack is : list )
this.repo.postUpdate( is );
this.repo.updateView();
this.setScrollBar();
}
private void setScrollBar()
{
int size = this.repo.size();
this.myScrollBar.setTop( 39 ).setLeft( 175 ).setHeight( 78 );
this.myScrollBar.setRange( 0, ( size + 4 ) / 5 - this.rows, 1 );
}
// @Override - NEI
public List<String> handleItemTooltip(ItemStack stack, int mouseX, int mouseY, List<String> currentToolTip)
public List<String> handleItemTooltip( ItemStack stack, int mouseX, int mouseY, List<String> currentToolTip )
{
if ( stack != null )
if( stack != null )
{
Slot s = this.getSlot( mouseX, mouseY );
if ( s instanceof SlotME )
if( s instanceof SlotME )
{
IAEItemStack myStack = null;
@@ -246,15 +242,14 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
SlotME theSlotField = (SlotME) s;
myStack = theSlotField.getAEStack();
}
catch (Throwable ignore)
catch( Throwable ignore )
{
}
if ( myStack != null )
if( myStack != null )
{
while (currentToolTip.size() > 1)
while( currentToolTip.size() > 1 )
currentToolTip.remove( 1 );
}
}
}
@@ -262,10 +257,10 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
}
// Vanilla version...
protected void drawItemStackTooltip(ItemStack stack, int x, int y)
protected void drawItemStackTooltip( ItemStack stack, int x, int y )
{
Slot s = this.getSlot( x, y );
if ( s instanceof SlotME && stack != null )
if( s instanceof SlotME && stack != null )
{
IAEItemStack myStack = null;
@@ -274,18 +269,18 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
SlotME theSlotField = (SlotME) s;
myStack = theSlotField.getAEStack();
}
catch (Throwable ignore)
catch( Throwable ignore )
{
}
if ( myStack != null )
if( myStack != null )
{
List currentToolTip = stack.getTooltip( this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips );
while (currentToolTip.size() > 1)
while( currentToolTip.size() > 1 )
currentToolTip.remove( 1 );
currentToolTip.add( GuiText.Installed.getLocal() + ": " + (myStack.getStackSize()) );
currentToolTip.add( GuiText.Installed.getLocal() + ": " + ( myStack.getStackSize() ) );
currentToolTip.add( GuiText.EnergyDrain.getLocal() + ": " + Platform.formatPowerLong( myStack.getCountRequestable(), true ) );
this.drawTooltip( x, y, 0, join( currentToolTip, "\n" ) );
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
@@ -32,27 +33,29 @@ 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) {
public GuiNetworkTool( InventoryPlayer inventoryPlayer, INetworkTool te )
{
super( new ContainerNetworkTool( inventoryPlayer, te ) );
this.ySize = 166;
}
@Override
protected void actionPerformed(GuiButton btn)
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
try
{
if ( btn == this.tFacades )
if( btn == this.tFacades )
NetworkHandler.instance.sendToServer( new PacketValueConfig( "NetworkTool", "Toggle" ) );
}
catch (IOException e)
catch( IOException e )
{
AELog.error( e );
}
@@ -69,20 +72,19 @@ public class GuiNetworkTool extends AEBaseGui
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/toolbox.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
if ( this.tFacades != null )
this.tFacades.setState( ((ContainerNetworkTool) this.inventorySlots).facadeMode );
if( this.tFacades != null )
this.tFacades.setState( ( (ContainerNetworkTool) this.inventorySlots ).facadeMode );
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.NetworkTool.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/toolbox.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
@@ -36,6 +37,7 @@ import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketValueConfig;
public class GuiPatternTerm extends GuiMEMonitorable
{
@@ -47,50 +49,37 @@ public class GuiPatternTerm extends GuiMEMonitorable
GuiImgButton encodeBtn;
GuiImgButton clearBtn;
@Override
public void initGui()
public GuiPatternTerm( InventoryPlayer inventoryPlayer, ITerminalHost te )
{
super.initGui();
this.buttonList.add( this.tabCraftButton = new GuiTabButton( this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack( Blocks.crafting_table ),
GuiText.CraftingPattern.getLocal(), itemRender ) );
this.buttonList.add( this.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;
this.buttonList.add( this.clearBtn = new GuiImgButton( this.guiLeft + 74, this.guiTop + this.ySize - 163, Settings.ACTIONS, ActionItems.CLOSE ) );
this.clearBtn.halfSize = true;
this.buttonList.add( this.encodeBtn = new GuiImgButton( this.guiLeft + 147, this.guiTop + this.ySize - 142, Settings.ACTIONS, ActionItems.ENCODE ) );
super( inventoryPlayer, te, new ContainerPatternTerm( inventoryPlayer, te ) );
this.container = (ContainerPatternTerm) this.inventorySlots;
this.reservedSpace = 81;
}
@Override
protected void actionPerformed(GuiButton btn)
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
try
{
if ( this.tabCraftButton == btn || this.tabProcessButton == btn )
if( this.tabCraftButton == btn || this.tabProcessButton == btn )
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "PatternTerminal.CraftMode", this.tabProcessButton == btn ? "1" : "0" ) );
}
if ( this.encodeBtn == btn )
if( this.encodeBtn == btn )
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "PatternTerminal.Encode", "1" ) );
}
if ( this.clearBtn == btn )
if( this.clearBtn == btn )
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "PatternTerminal.Clear", "1" ) );
}
}
catch (IOException e)
catch( IOException e )
{
// TODO Auto-generated catch block
e.printStackTrace();
@@ -103,32 +92,26 @@ public class GuiPatternTerm extends GuiMEMonitorable
}
@Override
protected void repositionSlot(AppEngSlot s)
public void initGui()
{
if ( s.isPlayerSide() )
s.yDisplayPosition = s.defY + this.ySize - 78 - 5;
else
s.yDisplayPosition = s.defY + this.ySize - 78 - 3;
}
super.initGui();
this.buttonList.add( this.tabCraftButton = new GuiTabButton( this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack( Blocks.crafting_table ), GuiText.CraftingPattern.getLocal(), itemRender ) );
this.buttonList.add( this.tabProcessButton = new GuiTabButton( this.guiLeft + 173, this.guiTop + this.ySize - 177, new ItemStack( Blocks.furnace ), GuiText.ProcessingPattern.getLocal(), itemRender ) );
public GuiPatternTerm(InventoryPlayer inventoryPlayer, ITerminalHost te) {
super( inventoryPlayer, te, new ContainerPatternTerm( inventoryPlayer, te ) );
this.container = (ContainerPatternTerm) this.inventorySlots;
this.reservedSpace = 81;
// buttonList.add( substitutionsBtn = new GuiImgButton( this.guiLeft + 84, this.guiTop + this.ySize - 163,
// Settings.ACTIONS, ActionItems.SUBSTITUTION ) );
// substitutionsBtn.halfSize = true;
this.buttonList.add( this.clearBtn = new GuiImgButton( this.guiLeft + 74, this.guiTop + this.ySize - 163, Settings.ACTIONS, ActionItems.CLOSE ) );
this.clearBtn.halfSize = true;
this.buttonList.add( this.encodeBtn = new GuiImgButton( this.guiLeft + 147, this.guiTop + this.ySize - 142, Settings.ACTIONS, ActionItems.ENCODE ) );
}
@Override
protected String getBackground()
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
if ( this.container.craftingMode )
return "guis/pattern.png";
return "guis/pattern2.png";
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
if ( !this.container.craftingMode )
if( !this.container.craftingMode )
{
this.tabCraftButton.visible = false;
this.tabProcessButton.visible = true;
@@ -143,4 +126,20 @@ public class GuiPatternTerm extends GuiMEMonitorable
this.fontRendererObj.drawString( GuiText.PatternTerminal.getLocal(), 8, this.ySize - 96 + 2 - this.reservedSpace, 4210752 );
}
@Override
protected String getBackground()
{
if( this.container.craftingMode )
return "guis/pattern.png";
return "guis/pattern2.png";
}
@Override
protected void repositionSlot( AppEngSlot s )
{
if( s.isPlayerSide() )
s.yDisplayPosition = s.defY + this.ySize - 78 - 5;
else
s.yDisplayPosition = s.defY + this.ySize - 78 - 3;
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
@@ -48,6 +49,7 @@ import appeng.tile.misc.TileInterface;
import appeng.tile.storage.TileChest;
import appeng.tile.storage.TileDrive;
public class GuiPriority extends AEBaseGui
{
@@ -65,7 +67,8 @@ public class GuiPriority extends AEBaseGui
GuiBridge OriginalGui;
public GuiPriority(InventoryPlayer inventoryPlayer, IPriorityHost te) {
public GuiPriority( InventoryPlayer inventoryPlayer, IPriorityHost te )
{
super( new ContainerPriority( inventoryPlayer, te ) );
}
@@ -90,32 +93,32 @@ public class GuiPriority extends AEBaseGui
this.buttonList.add( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 69, 38, 20, "-" + d ) );
ItemStack myIcon = null;
Object target = ((AEBaseContainer) this.inventorySlots).getTarget();
Object target = ( (AEBaseContainer) this.inventorySlots ).getTarget();
final IDefinitions definitions = AEApi.instance().definitions();
final IParts parts = definitions.parts();
final IBlocks blocks = definitions.blocks();
if ( target instanceof PartStorageBus )
if( target instanceof PartStorageBus )
{
for ( ItemStack storageBusStack :parts.storageBus().maybeStack( 1 ).asSet() )
for( ItemStack storageBusStack : parts.storageBus().maybeStack( 1 ).asSet() )
{
myIcon = storageBusStack;
}
this.OriginalGui = GuiBridge.GUI_STORAGEBUS;
}
if ( target instanceof PartFormationPlane )
if( target instanceof PartFormationPlane )
{
for ( ItemStack formationPlaneStack : parts.formationPlane().maybeStack( 1 ).asSet() )
for( ItemStack formationPlaneStack : parts.formationPlane().maybeStack( 1 ).asSet() )
{
myIcon = formationPlaneStack;
}
this.OriginalGui = GuiBridge.GUI_FORMATION_PLANE;
}
if ( target instanceof TileDrive )
if( target instanceof TileDrive )
{
for ( ItemStack driveStack : blocks.drive().maybeStack( 1 ).asSet() )
for( ItemStack driveStack : blocks.drive().maybeStack( 1 ).asSet() )
{
myIcon = driveStack;
}
@@ -123,9 +126,9 @@ public class GuiPriority extends AEBaseGui
this.OriginalGui = GuiBridge.GUI_DRIVE;
}
if ( target instanceof TileChest )
if( target instanceof TileChest )
{
for ( ItemStack chestStack : blocks.chest().maybeStack( 1 ).asSet() )
for( ItemStack chestStack : blocks.chest().maybeStack( 1 ).asSet() )
{
myIcon = chestStack;
}
@@ -133,9 +136,9 @@ public class GuiPriority extends AEBaseGui
this.OriginalGui = GuiBridge.GUI_CHEST;
}
if ( target instanceof TileInterface )
if( target instanceof TileInterface )
{
for ( ItemStack interfaceStack : blocks.iface().maybeStack( 1 ).asSet() )
for( ItemStack interfaceStack : blocks.iface().maybeStack( 1 ).asSet() )
{
myIcon = interfaceStack;
}
@@ -143,16 +146,16 @@ public class GuiPriority extends AEBaseGui
this.OriginalGui = GuiBridge.GUI_INTERFACE;
}
if ( target instanceof PartInterface )
if( target instanceof PartInterface )
{
for ( ItemStack interfaceStack : parts.iface().maybeStack( 1 ).asSet() )
for( ItemStack interfaceStack : parts.iface().maybeStack( 1 ).asSet() )
{
myIcon = interfaceStack;
}
this.OriginalGui = GuiBridge.GUI_INTERFACE;
}
if ( this.OriginalGui != null && myIcon != null )
if( this.OriginalGui != null && myIcon != null )
this.buttonList.add( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), itemRender ) );
this.priority = new GuiNumberBox( this.fontRendererObj, this.guiLeft + 62, this.guiTop + 57, 59, this.fontRendererObj.FONT_HEIGHT, Long.class );
@@ -161,15 +164,30 @@ public class GuiPriority extends AEBaseGui
this.priority.setTextColor( 0xFFFFFF );
this.priority.setVisible( true );
this.priority.setFocused( true );
((ContainerPriority) this.inventorySlots).setTextField( this.priority );
( (ContainerPriority) this.inventorySlots ).setTextField( this.priority );
}
@Override
protected void actionPerformed(GuiButton btn)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( GuiText.Priority.getLocal(), 8, 6, 4210752 );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/priority.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
this.priority.drawTextBox();
}
@Override
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
if ( btn == this.originalGuiBtn )
if( btn == this.originalGuiBtn )
{
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( this.OriginalGui ) );
}
@@ -177,27 +195,27 @@ public class GuiPriority extends AEBaseGui
boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
boolean isMinus = btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
if ( isPlus || isMinus )
if( isPlus || isMinus )
this.addQty( this.getQty( btn ) );
}
private void addQty(int i)
private void addQty( int i )
{
try
{
String out = this.priority.getText();
boolean fixed = false;
while (out.startsWith( "0" ) && out.length() > 1)
while( out.startsWith( "0" ) && out.length() > 1 )
{
out = out.substring( 1 );
fixed = true;
}
if ( fixed )
if( fixed )
this.priority.setText( out );
if ( out.length() == 0 )
if( out.length() == 0 )
out = "0";
long result = Long.parseLong( out );
@@ -207,45 +225,44 @@ public class GuiPriority extends AEBaseGui
NetworkHandler.instance.sendToServer( new PacketValueConfig( "PriorityHost.Priority", out ) );
}
catch(NumberFormatException e )
catch( NumberFormatException e )
{
// nope..
this.priority.setText( "0" );
}
catch (IOException e)
catch( IOException e )
{
AELog.error( e );
}
}
@Override
protected void keyTyped(char character, int key)
protected void keyTyped( char character, int key )
{
if ( !this.checkHotbarKeys( key ) )
if( !this.checkHotbarKeys( key ) )
{
if ( (key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit( character ))
&& this.priority.textboxKeyTyped( character, key ) )
if( ( key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit( character ) ) && this.priority.textboxKeyTyped( character, key ) )
{
try
{
String out = this.priority.getText();
boolean fixed = false;
while (out.startsWith( "0" ) && out.length() > 1)
while( out.startsWith( "0" ) && out.length() > 1 )
{
out = out.substring( 1 );
fixed = true;
}
if ( fixed )
if( fixed )
this.priority.setText( out );
if ( out.length() == 0 )
if( out.length() == 0 )
out = "0";
NetworkHandler.instance.sendToServer( new PacketValueConfig( "PriorityHost.Priority", out ) );
}
catch (IOException e)
catch( IOException e )
{
AELog.error( e );
}
@@ -257,23 +274,8 @@ public class GuiPriority extends AEBaseGui
}
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.bindTexture( "guis/priority.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
this.priority.drawTextBox();
}
protected String getBackground()
{
return "guis/priority.png";
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.fontRendererObj.drawString( GuiText.Priority.getLocal(), 8, 6, 4210752 );
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.client.gui.AEBaseGui;
@@ -25,26 +26,27 @@ 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) {
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)
{
this.bindTexture( "guis/chest.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.QuantumLinkChamber.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/chest.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.client.gui.GuiTextField;
@@ -31,12 +32,14 @@ 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) {
public GuiQuartzKnife( InventoryPlayer inventoryPlayer, QuartzKnifeObj te )
{
super( new ContainerQuartzKnife( inventoryPlayer, te ) );
this.ySize = 184;
}
@@ -55,7 +58,14 @@ public class GuiQuartzKnife extends AEBaseGui
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.QuartzCuttingKnife.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/quartzknife.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
@@ -63,17 +73,17 @@ public class GuiQuartzKnife extends AEBaseGui
}
@Override
protected void keyTyped(char character, int key)
protected void keyTyped( char character, int key )
{
if ( this.name.textboxKeyTyped( character, key ) )
if( this.name.textboxKeyTyped( character, key ) )
{
try
{
String Out = this.name.getText();
((ContainerQuartzKnife) this.inventorySlots).setName( Out );
( (ContainerQuartzKnife) this.inventorySlots ).setName( Out );
NetworkHandler.instance.sendToServer( new PacketValueConfig( "QuartzKnife.Name", Out ) );
}
catch (IOException e)
catch( IOException e )
{
AELog.error( e );
}
@@ -83,12 +93,4 @@ public class GuiQuartzKnife extends AEBaseGui
super.keyTyped( character, key );
}
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.QuartzCuttingKnife.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
}
}
@@ -33,10 +33,18 @@ 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) {
GuiToggleButton inject;
GuiToggleButton extract;
GuiToggleButton craft;
GuiToggleButton build;
GuiToggleButton security;
public GuiSecurity( InventoryPlayer inventoryPlayer, ITerminalHost te )
{
super( inventoryPlayer, te, new ContainerSecurity( inventoryPlayer, te ) );
this.customSortOrder = false;
this.reservedSpace = 33;
@@ -46,11 +54,36 @@ public class GuiSecurity extends GuiMEMonitorable
this.standardSize = this.xSize;
}
GuiToggleButton inject;
GuiToggleButton extract;
GuiToggleButton craft;
GuiToggleButton build;
GuiToggleButton security;
@Override
protected void actionPerformed( net.minecraft.client.gui.GuiButton btn )
{
super.actionPerformed( btn );
SecurityPermissions toggleSetting = null;
if( btn == this.inject )
toggleSetting = SecurityPermissions.INJECT;
if( btn == this.extract )
toggleSetting = SecurityPermissions.EXTRACT;
if( btn == this.craft )
toggleSetting = SecurityPermissions.CRAFT;
if( btn == this.build )
toggleSetting = SecurityPermissions.BUILD;
if( btn == this.security )
toggleSetting = SecurityPermissions.SECURITY;
if( toggleSetting != null )
{
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "TileSecurity.ToggleOption", toggleSetting.name() ) );
}
catch( IOException e )
{
AELog.error( e );
}
}
}
@Override
public void initGui()
@@ -58,52 +91,22 @@ public class GuiSecurity extends GuiMEMonitorable
super.initGui();
int top = this.guiTop + this.ySize - 116;
this.buttonList.add( this.inject = new GuiToggleButton( this.guiLeft + 56, top, 11 * 16, 12 * 16, SecurityPermissions.INJECT
.getUnlocalizedName(), SecurityPermissions.INJECT.getUnlocalizedTip() ) );
this.buttonList.add( this.inject = new GuiToggleButton( this.guiLeft + 56, top, 11 * 16, 12 * 16, SecurityPermissions.INJECT.getUnlocalizedName(), SecurityPermissions.INJECT.getUnlocalizedTip() ) );
this.buttonList.add( this.extract = new GuiToggleButton( this.guiLeft + 56 + 18, top, 11 * 16 + 1, 12 * 16 + 1, SecurityPermissions.EXTRACT
.getUnlocalizedName(), SecurityPermissions.EXTRACT.getUnlocalizedTip() ) );
this.buttonList.add( this.extract = new GuiToggleButton( this.guiLeft + 56 + 18, top, 11 * 16 + 1, 12 * 16 + 1, SecurityPermissions.EXTRACT.getUnlocalizedName(), SecurityPermissions.EXTRACT.getUnlocalizedTip() ) );
this.buttonList.add( this.craft = new GuiToggleButton( this.guiLeft + 56 + 18 * 2, top, 11 * 16 + 2, 12 * 16 + 2, SecurityPermissions.CRAFT.getUnlocalizedName(),
SecurityPermissions.CRAFT.getUnlocalizedTip() ) );
this.buttonList.add( this.craft = new GuiToggleButton( this.guiLeft + 56 + 18 * 2, top, 11 * 16 + 2, 12 * 16 + 2, SecurityPermissions.CRAFT.getUnlocalizedName(), SecurityPermissions.CRAFT.getUnlocalizedTip() ) );
this.buttonList.add( this.build = new GuiToggleButton( this.guiLeft + 56 + 18 * 3, top, 11 * 16 + 3, 12 * 16 + 3, SecurityPermissions.BUILD.getUnlocalizedName(),
SecurityPermissions.BUILD.getUnlocalizedTip() ) );
this.buttonList.add( this.build = new GuiToggleButton( this.guiLeft + 56 + 18 * 3, top, 11 * 16 + 3, 12 * 16 + 3, SecurityPermissions.BUILD.getUnlocalizedName(), SecurityPermissions.BUILD.getUnlocalizedTip() ) );
this.buttonList.add( this.security = new GuiToggleButton( this.guiLeft + 56 + 18 * 4, top, 11 * 16 + 4, 12 * 16 + 4, SecurityPermissions.SECURITY
.getUnlocalizedName(), SecurityPermissions.SECURITY.getUnlocalizedTip() ) );
this.buttonList.add( this.security = new GuiToggleButton( this.guiLeft + 56 + 18 * 4, top, 11 * 16 + 4, 12 * 16 + 4, SecurityPermissions.SECURITY.getUnlocalizedName(), SecurityPermissions.SECURITY.getUnlocalizedTip() ) );
}
@Override
protected void actionPerformed(net.minecraft.client.gui.GuiButton btn)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
super.actionPerformed( btn );
SecurityPermissions toggleSetting = null;
if ( btn == this.inject )
toggleSetting = SecurityPermissions.INJECT;
if ( btn == this.extract )
toggleSetting = SecurityPermissions.EXTRACT;
if ( btn == this.craft )
toggleSetting = SecurityPermissions.CRAFT;
if ( btn == this.build )
toggleSetting = SecurityPermissions.BUILD;
if ( btn == this.security )
toggleSetting = SecurityPermissions.SECURITY;
if ( toggleSetting != null )
{
try
{
NetworkHandler.instance.sendToServer( new PacketValueConfig( "TileSecurity.ToggleOption", toggleSetting.name() ) );
}
catch (IOException e)
{
AELog.error( e );
}
}
super.drawFG( offsetX, offsetY, mouseX, mouseY );
this.fontRendererObj.drawString( GuiText.SecurityCardEditor.getLocal(), 8, this.ySize - 96 + 1 - this.reservedSpace, 4210752 );
}
@Override
@@ -111,26 +114,18 @@ public class GuiSecurity extends GuiMEMonitorable
{
ContainerSecurity cs = (ContainerSecurity) this.inventorySlots;
this.inject.setState( (cs.security & (1 << SecurityPermissions.INJECT.ordinal())) > 0 );
this.extract.setState( (cs.security & (1 << SecurityPermissions.EXTRACT.ordinal())) > 0 );
this.craft.setState( (cs.security & (1 << SecurityPermissions.CRAFT.ordinal())) > 0 );
this.build.setState( (cs.security & (1 << SecurityPermissions.BUILD.ordinal())) > 0 );
this.security.setState( (cs.security & (1 << SecurityPermissions.SECURITY.ordinal())) > 0 );
this.inject.setState( ( cs.security & ( 1 << SecurityPermissions.INJECT.ordinal() ) ) > 0 );
this.extract.setState( ( cs.security & ( 1 << SecurityPermissions.EXTRACT.ordinal() ) ) > 0 );
this.craft.setState( ( cs.security & ( 1 << SecurityPermissions.CRAFT.ordinal() ) ) > 0 );
this.build.setState( ( cs.security & ( 1 << SecurityPermissions.BUILD.ordinal() ) ) > 0 );
this.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 );
this.fontRendererObj.drawString( GuiText.SecurityCardEditor.getLocal(), 8, this.ySize - 96 + 1 - this.reservedSpace, 4210752 );
}
@Override
public Enum getSortBy()
{
return SortOrder.NAME;
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.client.gui.AEBaseGui;
@@ -27,32 +28,33 @@ 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) {
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)
{
this.bindTexture( "guis/skychest.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.SkyChest.getLocal() ), 8, 8, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 2, 4210752 );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/skychest.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
@Override
protected boolean enableSpaceClicking()
{
return !AppEng.instance.isIntegrationEnabled( IntegrationType.InvTweaks );
}
}
@@ -33,26 +33,28 @@ import appeng.core.localization.GuiText;
import appeng.tile.spatial.TileSpatialIOPort;
import appeng.util.Platform;
public class GuiSpatialIOPort extends AEBaseGui
{
final ContainerSpatialIOPort container;
GuiImgButton units;
public GuiSpatialIOPort(InventoryPlayer inventoryPlayer, TileSpatialIOPort te) {
public GuiSpatialIOPort( InventoryPlayer inventoryPlayer, TileSpatialIOPort te )
{
super( new ContainerSpatialIOPort( inventoryPlayer, te ) );
this.ySize = 199;
this.container = (ContainerSpatialIOPort) this.inventorySlots;
}
@Override
protected void actionPerformed(GuiButton btn)
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if ( btn == this.units )
if( btn == this.units )
{
AEConfig.instance.nextPowerUnit( backwards );
this.units.set( AEConfig.instance.selectedPowerUnit() );
@@ -69,22 +71,21 @@ public class GuiSpatialIOPort extends AEBaseGui
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.bindTexture( "guis/spatialio.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.currentPower, false ), 13, 21, 4210752 );
this.fontRendererObj.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( this.container.maxPower, false ), 13, 31, 4210752 );
this.fontRendererObj.drawString( GuiText.RequiredPower.getLocal() + ": " + Platform.formatPowerLong( this.container.reqPower, false ), 13, 78, 4210752 );
this.fontRendererObj.drawString( GuiText.Efficiency.getLocal() + ": " + (((float) this.container.eff) / 100) + '%', 13, 88, 4210752 );
this.fontRendererObj.drawString( GuiText.Efficiency.getLocal() + ": " + ( ( (float) this.container.eff ) / 100 ) + '%', 13, 88, 4210752 );
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.SpatialIOPort.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96, 4210752 );
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/spatialio.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import org.lwjgl.input.Mouse;
@@ -42,6 +43,7 @@ import appeng.core.sync.packets.PacketSwitchGuis;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.parts.misc.PartStorageBus;
public class GuiStorageBus extends GuiUpgradeable
{
@@ -51,27 +53,12 @@ public class GuiStorageBus extends GuiUpgradeable
GuiImgButton partition;
GuiImgButton clear;
public GuiStorageBus(InventoryPlayer inventoryPlayer, PartStorageBus te) {
public GuiStorageBus( InventoryPlayer inventoryPlayer, PartStorageBus te )
{
super( new ContainerStorageBus( inventoryPlayer, te ) );
this.ySize = 251;
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.StorageBus.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
if ( this.fuzzyMode != null )
this.fuzzyMode.set( this.cvb.fzMode );
if ( this.storageFilter != null )
this.storageFilter.set( ((ContainerStorageBus) this.cvb).storageFilter );
if ( this.rwMode != null )
this.rwMode.set( ((ContainerStorageBus) this.cvb).rwMode );
}
@Override
protected void addButtons()
{
@@ -91,34 +78,19 @@ public class GuiStorageBus extends GuiUpgradeable
}
@Override
protected void actionPerformed(GuiButton btn)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
super.actionPerformed( btn );
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.StorageBus.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
boolean backwards = Mouse.isButtonDown( 1 );
if( this.fuzzyMode != null )
this.fuzzyMode.set( this.cvb.fzMode );
try
{
if ( btn == this.partition )
NetworkHandler.instance.sendToServer( new PacketValueConfig( "StorageBus.Action", "Partition" ) );
if( this.storageFilter != null )
this.storageFilter.set( ( (ContainerStorageBus) this.cvb ).storageFilter );
else if ( btn == this.clear )
NetworkHandler.instance.sendToServer( new PacketValueConfig( "StorageBus.Action", "Clear" ) );
else if ( btn == this.priority )
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
else if ( btn == this.rwMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.rwMode.getSetting(), backwards ) );
else if ( btn == this.storageFilter )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.storageFilter.getSetting(), backwards ) );
}
catch (IOException e)
{
AELog.error( e );
}
if( this.rwMode != null )
this.rwMode.set( ( (ContainerStorageBus) this.cvb ).rwMode );
}
@Override
@@ -127,4 +99,33 @@ public class GuiStorageBus extends GuiUpgradeable
return "guis/storagebus.png";
}
@Override
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
try
{
if( btn == this.partition )
NetworkHandler.instance.sendToServer( new PacketValueConfig( "StorageBus.Action", "Partition" ) );
else if( btn == this.clear )
NetworkHandler.instance.sendToServer( new PacketValueConfig( "StorageBus.Action", "Clear" ) );
else if( btn == this.priority )
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
else if( btn == this.rwMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.rwMode.getSetting(), backwards ) );
else if( btn == this.storageFilter )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.storageFilter.getSetting(), backwards ) );
}
catch( IOException e )
{
AELog.error( e );
}
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
@@ -37,6 +38,7 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.parts.automation.PartImportBus;
public class GuiUpgradeable extends AEBaseGui
{
@@ -47,11 +49,13 @@ public class GuiUpgradeable extends AEBaseGui
GuiImgButton fuzzyMode;
GuiImgButton craftMode;
public GuiUpgradeable(InventoryPlayer inventoryPlayer, IUpgradeableHost te) {
public GuiUpgradeable( InventoryPlayer inventoryPlayer, IUpgradeableHost te )
{
this( new ContainerUpgradeable( inventoryPlayer, te ) );
}
public GuiUpgradeable(ContainerUpgradeable te) {
public GuiUpgradeable( ContainerUpgradeable te )
{
super( te );
this.cvb = te;
@@ -60,6 +64,11 @@ public class GuiUpgradeable extends AEBaseGui
this.ySize = 184;
}
protected boolean hasToolbox()
{
return ( (ContainerUpgradeable) this.inventorySlots ).hasToolbox();
}
@Override
public void initGui()
{
@@ -79,43 +88,42 @@ public class GuiUpgradeable extends AEBaseGui
}
@Override
protected void actionPerformed(GuiButton btn)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
super.actionPerformed( btn );
this.fontRendererObj.drawString( this.getGuiDisplayName( this.getName().getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
boolean backwards = Mouse.isButtonDown( 1 );
if( this.redstoneMode != null )
this.redstoneMode.set( this.cvb.rsMode );
if ( btn == this.redstoneMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.redstoneMode.getSetting(), backwards ) );
if( this.fuzzyMode != null )
this.fuzzyMode.set( this.cvb.fzMode );
if ( btn == this.craftMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.craftMode.getSetting(), backwards ) );
if ( btn == this.fuzzyMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.fuzzyMode.getSetting(), backwards ) );
}
protected boolean hasToolbox()
{
return ((ContainerUpgradeable) this.inventorySlots).hasToolbox();
if( this.craftMode != null )
this.craftMode.set( this.cvb.cMode );
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.handleButtonVisibility();
this.bindTexture( this.getBackground() );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, 211 - 34, this.ySize );
if ( this.drawUpgrades() )
if( this.drawUpgrades() )
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 14 + this.cvb.availableUpgrades() * 18 );
if ( this.hasToolbox() )
if( this.hasToolbox() )
this.drawTexturedModalRect( offsetX + 178, offsetY + this.ySize - 90, 178, this.ySize - 90, 68, 68 );
}
protected boolean drawUpgrades()
protected void handleButtonVisibility()
{
return true;
if( this.redstoneMode != null )
this.redstoneMode.setVisibility( this.bc.getInstalledUpgrades( Upgrades.REDSTONE ) > 0 );
if( this.fuzzyMode != null )
this.fuzzyMode.setVisibility( this.bc.getInstalledUpgrades( Upgrades.FUZZY ) > 0 );
if( this.craftMode != null )
this.craftMode.setVisibility( this.bc.getInstalledUpgrades( Upgrades.CRAFTING ) > 0 );
}
protected String getBackground()
@@ -123,30 +131,9 @@ public class GuiUpgradeable extends AEBaseGui
return "guis/bus.png";
}
protected void handleButtonVisibility()
protected boolean drawUpgrades()
{
if ( this.redstoneMode != null )
this.redstoneMode.setVisibility( this.bc.getInstalledUpgrades( Upgrades.REDSTONE ) > 0 );
if ( this.fuzzyMode != null )
this.fuzzyMode.setVisibility( this.bc.getInstalledUpgrades( Upgrades.FUZZY ) > 0 );
if ( this.craftMode != null )
this.craftMode.setVisibility( this.bc.getInstalledUpgrades( Upgrades.CRAFTING ) > 0 );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.fontRendererObj.drawString( this.getGuiDisplayName( this.getName().getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
if ( this.redstoneMode != null )
this.redstoneMode.set( this.cvb.rsMode );
if ( this.fuzzyMode != null )
this.fuzzyMode.set( this.cvb.fzMode );
if ( this.craftMode != null )
this.craftMode.set( this.cvb.cMode );
return true;
}
protected GuiText getName()
@@ -154,4 +141,20 @@ public class GuiUpgradeable extends AEBaseGui
return this.bc instanceof PartImportBus ? GuiText.ImportBus : GuiText.ExportBus;
}
@Override
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if( btn == this.redstoneMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.redstoneMode.getSetting(), backwards ) );
if( btn == this.craftMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.craftMode.getSetting(), backwards ) );
if( btn == this.fuzzyMode )
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.fuzzyMode.getSetting(), backwards ) );
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import org.lwjgl.opengl.GL11;
import net.minecraft.entity.player.InventoryPlayer;
@@ -29,13 +30,14 @@ import appeng.container.implementations.ContainerVibrationChamber;
import appeng.core.localization.GuiText;
import appeng.tile.misc.TileVibrationChamber;
public class GuiVibrationChamber extends AEBaseGui
{
final ContainerVibrationChamber cvc;
GuiProgressBar pb;
public GuiVibrationChamber(InventoryPlayer inventoryPlayer, TileVibrationChamber te)
public GuiVibrationChamber( InventoryPlayer inventoryPlayer, TileVibrationChamber te )
{
super( new ContainerVibrationChamber( inventoryPlayer, te ) );
this.cvc = (ContainerVibrationChamber) this.inventorySlots;
@@ -52,16 +54,7 @@ public class GuiVibrationChamber extends AEBaseGui
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
this.bindTexture( "guis/vibchamber.png" );
this.pb.xPosition = 99 + this.guiLeft;
this.pb.yPosition = 36 + this.guiTop;
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.VibrationChamber.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
@@ -71,7 +64,7 @@ public class GuiVibrationChamber extends AEBaseGui
this.pb.setFullMsg( this.cvc.aePerTick * this.cvc.getCurrentProgress() / 100 + " ae/t" );
if ( this.cvc.getCurrentProgress() > 0 )
if( this.cvc.getCurrentProgress() > 0 )
{
int i1 = this.cvc.getCurrentProgress();
this.bindTexture( "guis/vibchamber.png" );
@@ -80,4 +73,12 @@ public class GuiVibrationChamber extends AEBaseGui
}
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/vibchamber.png" );
this.pb.xPosition = 99 + this.guiLeft;
this.pb.yPosition = 36 + this.guiTop;
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
}
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
@@ -32,19 +33,26 @@ import appeng.core.localization.GuiText;
import appeng.tile.networking.TileWireless;
import appeng.util.Platform;
public class GuiWireless extends AEBaseGui
{
GuiImgButton units;
public GuiWireless( InventoryPlayer inventoryPlayer, TileWireless te )
{
super( new ContainerWireless( inventoryPlayer, te ) );
this.ySize = 166;
}
@Override
protected void actionPerformed(GuiButton btn)
protected void actionPerformed( GuiButton btn )
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if ( btn == this.units )
if( btn == this.units )
{
AEConfig.instance.nextPowerUnit( backwards );
this.units.set( AEConfig.instance.selectedPowerUnit() );
@@ -60,36 +68,30 @@ public class GuiWireless extends AEBaseGui
this.buttonList.add( this.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)
{
this.bindTexture( "guis/wireless.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.Wireless.getLocal() ), 8, 6, 4210752 );
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
ContainerWireless cw = (ContainerWireless) this.inventorySlots;
if ( cw.range > 0 )
if( cw.range > 0 )
{
String firstMessage = GuiText.Range.getLocal() + ": " + (cw.range / 10.0) + " m";
String firstMessage = GuiText.Range.getLocal() + ": " + ( cw.range / 10.0 ) + " m";
String secondMessage = GuiText.PowerUsageRate.getLocal() + ": " + Platform.formatPowerLong( cw.drain, true );
int strWidth = Math.max( this.fontRendererObj.getStringWidth( firstMessage ), this.fontRendererObj.getStringWidth( secondMessage ) );
int cOffset = (this.xSize / 2) - (strWidth / 2);
int cOffset = ( this.xSize / 2 ) - ( strWidth / 2 );
this.fontRendererObj.drawString( firstMessage, cOffset, 20, 4210752 );
this.fontRendererObj.drawString( secondMessage, cOffset, 20 + 12, 4210752 );
}
}
@Override
public void drawBG( int offsetX, int offsetY, int mouseX, int mouseY )
{
this.bindTexture( "guis/wireless.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
}
}
@@ -18,14 +18,17 @@
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) {
public GuiWirelessTerm( InventoryPlayer inventoryPlayer, IPortableCell te )
{
super( inventoryPlayer, te );
this.maxRows = Integer.MAX_VALUE;
}
@@ -72,7 +72,7 @@ public class GuiImgButton extends GuiButton implements ITooltip
this.width = 16;
this.height = 16;
if ( appearances == null )
if( appearances == null )
{
appearances = new HashMap<EnumPair, ButtonAppearance>();
this.registerApp( 16 * 7, Settings.CONDENSER_OUTPUT, CondenserOutput.TRASH, ButtonToolTips.CondenserOutput, ButtonToolTips.Trash );
@@ -165,7 +165,7 @@ public class GuiImgButton extends GuiButton implements ITooltip
{
ButtonAppearance a = new ButtonAppearance();
a.displayName = title.getUnlocalized();
a.displayValue = ( String ) ( hint instanceof String ? hint : ( ( ButtonToolTips ) hint ).getUnlocalized() );
a.displayValue = (String) ( hint instanceof String ? hint : ( (ButtonToolTips) hint ).getUnlocalized() );
a.index = iconIndex;
appearances.put( new EnumPair( setting, val ), a );
}
@@ -179,11 +179,11 @@ public class GuiImgButton extends GuiButton implements ITooltip
@Override
public void drawButton( Minecraft par1Minecraft, int par2, int par3 )
{
if ( this.visible )
if( this.visible )
{
int iconIndex = this.getIconIndex();
if ( this.halfSize )
if( this.halfSize )
{
this.width = 8;
this.height = 8;
@@ -192,7 +192,7 @@ public class GuiImgButton extends GuiButton implements ITooltip
GL11.glTranslatef( this.xPosition, this.yPosition, 0.0F );
GL11.glScalef( 0.5f, 0.5f, 0.5f );
if ( this.enabled )
if( this.enabled )
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
else
GL11.glColor4f( 0.5f, 0.5f, 0.5f, 1.0f );
@@ -200,7 +200,7 @@ public class GuiImgButton extends GuiButton implements ITooltip
par1Minecraft.renderEngine.bindTexture( ExtraBlockTextures.GuiTexture( "guis/states.png" ) );
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
int uv_y = ( int ) Math.floor( iconIndex / 16 );
int uv_y = (int) Math.floor( iconIndex / 16 );
int uv_x = iconIndex - uv_y * 16;
this.drawTexturedModalRect( 0, 0, 256 - 16, 256 - 16, 16, 16 );
@@ -211,7 +211,7 @@ public class GuiImgButton extends GuiButton implements ITooltip
}
else
{
if ( this.enabled )
if( this.enabled )
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
else
GL11.glColor4f( 0.5f, 0.5f, 0.5f, 1.0f );
@@ -219,7 +219,7 @@ public class GuiImgButton extends GuiButton implements ITooltip
par1Minecraft.renderEngine.bindTexture( ExtraBlockTextures.GuiTexture( "guis/states.png" ) );
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
int uv_y = ( int ) Math.floor( iconIndex / 16 );
int uv_y = (int) Math.floor( iconIndex / 16 );
int uv_x = iconIndex - uv_y * 16;
this.drawTexturedModalRect( this.xPosition, this.yPosition, 256 - 16, 256 - 16, 16, 16 );
@@ -232,10 +232,10 @@ public class GuiImgButton extends GuiButton implements ITooltip
private int getIconIndex()
{
if ( this.buttonSetting != null && this.currentValue != null )
if( this.buttonSetting != null && this.currentValue != null )
{
ButtonAppearance app = appearances.get( new EnumPair( this.buttonSetting, this.currentValue ) );
if ( app == null )
if( app == null )
return 256 - 1;
return app.index;
}
@@ -244,7 +244,7 @@ public class GuiImgButton extends GuiButton implements ITooltip
public Settings getSetting()
{
return ( Settings ) this.buttonSetting;
return (Settings) this.buttonSetting;
}
public Enum getCurrentValue()
@@ -258,36 +258,36 @@ public class GuiImgButton extends GuiButton implements ITooltip
String displayName = null;
String displayValue = null;
if ( this.buttonSetting != null && this.currentValue != null )
if( this.buttonSetting != null && this.currentValue != null )
{
ButtonAppearance buttonAppearance = appearances.get( new EnumPair( this.buttonSetting, this.currentValue ) );
if ( buttonAppearance == null )
if( buttonAppearance == null )
return "No Such Message";
displayName = buttonAppearance.displayName;
displayValue = buttonAppearance.displayValue;
}
if ( displayName != null )
if( displayName != null )
{
String name = StatCollector.translateToLocal( displayName );
String value = StatCollector.translateToLocal( displayValue );
if ( name == null || name.isEmpty() )
if( name == null || name.isEmpty() )
name = displayName;
if ( value == null || value.isEmpty() )
if( value == null || value.isEmpty() )
value = displayValue;
if ( this.fillVar != null )
if( this.fillVar != null )
value = COMPILE.matcher( value ).replaceFirst( this.fillVar );
value = PATTERN_NEW_LINE.matcher( value ).replaceAll( "\n" );
StringBuilder sb = new StringBuilder( value );
int i = sb.lastIndexOf( "\n" );
if ( i <= 0 )
if( i <= 0 )
i = 0;
while ( i + 30 < sb.length() && ( i = sb.lastIndexOf( " ", i + 30 ) ) != -1 )
while( i + 30 < sb.length() && ( i = sb.lastIndexOf( " ", i + 30 ) ) != -1 )
{
sb.replace( i, i + 1, "\n" );
}
@@ -329,7 +329,7 @@ public class GuiImgButton extends GuiButton implements ITooltip
public void set( Enum e )
{
if ( this.currentValue != e )
if( this.currentValue != e )
{
this.currentValue = e;
}
@@ -356,15 +356,16 @@ public class GuiImgButton extends GuiButton implements ITooltip
@Override
public boolean equals( Object obj )
{
if ( obj == null )
if( obj == null )
return false;
if ( this.getClass() != obj.getClass() )
if( this.getClass() != obj.getClass() )
return false;
EnumPair other = ( EnumPair ) obj;
EnumPair other = (EnumPair) obj;
return other.setting == this.setting && other.value == this.value;
}
}
private static class ButtonAppearance
{
public int index;
@@ -18,6 +18,7 @@
package appeng.client.gui.widgets;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiTextField;
@@ -27,31 +28,30 @@ public class GuiNumberBox extends GuiTextField
final Class type;
public GuiNumberBox(FontRenderer p_i1032_1_, int p_i1032_2_, int p_i1032_3_, int p_i1032_4_, int p_i1032_5_,Class type) {
public GuiNumberBox( FontRenderer p_i1032_1_, int p_i1032_2_, int p_i1032_3_, int p_i1032_4_, int p_i1032_5_, Class type )
{
super( p_i1032_1_, p_i1032_2_, p_i1032_3_, p_i1032_4_, p_i1032_5_ );
this.type = type;
}
@Override
public void writeText(String p_146191_1_)
public void writeText( String p_146191_1_ )
{
String original = this.getText();
super.writeText( p_146191_1_ );
try
{
if ( this.type == int.class || this.type == Integer.class )
if( this.type == int.class || this.type == Integer.class )
Integer.parseInt( this.getText() );
else if ( this.type == long.class || this.type == Long.class )
else if( this.type == long.class || this.type == Long.class )
Long.parseLong( this.getText() );
else if ( this.type == double.class || this.type == Double.class )
else if( this.type == double.class || this.type == Double.class )
Double.parseDouble( this.getText() );
}
catch(NumberFormatException e )
catch( NumberFormatException e )
{
this.setText( original );
}
}
}
@@ -26,29 +26,24 @@ import net.minecraft.util.ResourceLocation;
import appeng.container.interfaces.IProgressProvider;
import appeng.core.localization.GuiText;
public class GuiProgressBar extends GuiButton implements ITooltip
{
public enum Direction
{
HORIZONTAL, VERTICAL
}
private final IProgressProvider source;
private final ResourceLocation texture;
private final int fill_u;
private final int fill_v;
private final Direction layout;
private String fullMsg;
private final String titleName;
private String fullMsg;
public GuiProgressBar(IProgressProvider source, String texture, int posX, int posY, int u, int y, int _width, int _height, Direction dir)
public GuiProgressBar( IProgressProvider source, String texture, int posX, int posY, int u, int y, int _width, int _height, Direction dir )
{
this( source, texture, posX, posY, u, y, _width, _height, dir, null );
}
public GuiProgressBar(IProgressProvider source, String texture, int posX, int posY, int u, int y, int _width, int _height, Direction dir, String title)
public GuiProgressBar( IProgressProvider source, String texture, int posX, int posY, int u, int y, int _width, int _height, Direction dir, String title )
{
super( posX, posY, _width, "" );
this.source = source;
@@ -64,22 +59,22 @@ public class GuiProgressBar extends GuiButton implements ITooltip
}
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3)
public void drawButton( Minecraft par1Minecraft, int par2, int par3 )
{
if ( this.visible )
if( this.visible )
{
par1Minecraft.getTextureManager().bindTexture( this.texture );
int max = this.source.getMaxProgress();
int current = this.source.getCurrentProgress();
if ( this.layout == Direction.VERTICAL )
if( this.layout == Direction.VERTICAL )
{
int diff = this.height - (max > 0 ? (this.height * current) / max : 0);
int diff = this.height - ( max > 0 ? ( this.height * current ) / max : 0 );
this.drawTexturedModalRect( this.xPosition, this.yPosition + diff, this.fill_u, this.fill_v + diff, this.width, this.height - diff );
}
else
{
int diff = this.width - (max > 0 ? (this.width * current) / max : 0);
int diff = this.width - ( max > 0 ? ( this.width * current ) / max : 0 );
this.drawTexturedModalRect( this.xPosition, this.yPosition, this.fill_u + diff, this.fill_v, this.width - diff, this.height );
}
@@ -87,7 +82,7 @@ public class GuiProgressBar extends GuiButton implements ITooltip
}
}
public void setFullMsg(String msg)
public void setFullMsg( String msg )
{
this.fullMsg = msg;
}
@@ -95,10 +90,10 @@ public class GuiProgressBar extends GuiButton implements ITooltip
@Override
public String getMessage()
{
if ( this.fullMsg != null )
if( this.fullMsg != null )
return this.fullMsg;
return (this.titleName != null ? this.titleName : "") + '\n' + this.source.getCurrentProgress() + ' ' + GuiText.Of.getLocal() + ' ' + this.source.getMaxProgress();
return ( this.titleName != null ? this.titleName : "" ) + '\n' + this.source.getCurrentProgress() + ' ' + GuiText.Of.getLocal() + ' ' + this.source.getMaxProgress();
}
@Override
@@ -131,4 +126,8 @@ public class GuiProgressBar extends GuiButton implements ITooltip
return true;
}
public enum Direction
{
HORIZONTAL, VERTICAL
}
}
@@ -18,10 +18,12 @@
package appeng.client.gui.widgets;
import org.lwjgl.opengl.GL11;
import appeng.client.gui.AEBaseGui;
public class GuiScrollbar implements IScrollSource
{
@@ -35,23 +37,18 @@ public class GuiScrollbar implements IScrollSource
private int minScroll = 0;
private int currentScroll = 0;
private void applyRange()
{
this.currentScroll = Math.max( Math.min( this.currentScroll, this.maxScroll ), this.minScroll );
}
public void draw(AEBaseGui g)
public void draw( AEBaseGui g )
{
g.bindTexture( "minecraft", "gui/container/creative_inventory/tabs.png" );
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
if ( this.getRange() == 0 )
if( this.getRange() == 0 )
{
g.drawTexturedModalRect( this.displayX, this.displayY, 232 + this.width, 0, this.width, 15 );
}
else
{
int offset = (this.currentScroll - this.minScroll) * (this.height - 15) / this.getRange();
int offset = ( this.currentScroll - this.minScroll ) * ( this.height - 15 ) / this.getRange();
g.drawTexturedModalRect( this.displayX, offset + this.displayY, 232, 0, this.width, 15 );
}
}
@@ -66,85 +63,89 @@ public class GuiScrollbar implements IScrollSource
return this.displayX;
}
public GuiScrollbar setLeft( int v )
{
this.displayX = v;
return this;
}
public int getTop()
{
return this.displayY;
}
public GuiScrollbar setTop( int v )
{
this.displayY = v;
return this;
}
public int getWidth()
{
return this.width;
}
public int getHeight()
{
return this.height;
}
public GuiScrollbar setLeft(int v)
{
this.displayX = v;
return this;
}
public GuiScrollbar setTop(int v)
{
this.displayY = v;
return this;
}
public GuiScrollbar setWidth(int v)
public GuiScrollbar setWidth( int v )
{
this.width = v;
return this;
}
public GuiScrollbar setHeight(int v)
public int getHeight()
{
return this.height;
}
public GuiScrollbar setHeight( int v )
{
this.height = v;
return this;
}
public void setRange(int min, int max, int pageSize)
public void setRange( int min, int max, int pageSize )
{
this.minScroll = min;
this.maxScroll = max;
this.pageSize = pageSize;
if ( this.minScroll > this.maxScroll )
if( this.minScroll > this.maxScroll )
this.maxScroll = this.minScroll;
this.applyRange();
}
private void applyRange()
{
this.currentScroll = Math.max( Math.min( this.currentScroll, this.maxScroll ), this.minScroll );
}
@Override
public int getCurrentScroll()
{
return this.currentScroll;
}
public void click(AEBaseGui aeBaseGui, int x, int y)
public void click( AEBaseGui aeBaseGui, int x, int y )
{
if ( this.getRange() == 0 )
if( this.getRange() == 0 )
return;
if ( x > this.displayX && x <= this.displayX + this.width )
if( x > this.displayX && x <= this.displayX + this.width )
{
if ( y > this.displayY && y <= this.displayY + this.height )
if( y > this.displayY && y <= this.displayY + this.height )
{
this.currentScroll = (y - this.displayY);
this.currentScroll = this.minScroll + ((this.currentScroll * 2 * this.getRange() / this.height));
this.currentScroll = (this.currentScroll + 1) >> 1;
this.currentScroll = ( y - this.displayY );
this.currentScroll = this.minScroll + ( ( this.currentScroll * 2 * this.getRange() / this.height ) );
this.currentScroll = ( this.currentScroll + 1 ) >> 1;
this.applyRange();
}
}
}
public void wheel(int delta)
public void wheel( int delta )
{
delta = Math.max( Math.min( -delta, 1 ), -1 );
this.currentScroll += delta * this.pageSize;
this.applyRange();
}
}
@@ -56,11 +56,11 @@ public class GuiTabButton extends GuiButton implements ITooltip
/**
* Using itemstack as an icon
*
* @param x x pos of button
* @param y y pos of button
* @param ico used icon
* @param x x pos of button
* @param y y pos of button
* @param ico used icon
* @param message mouse over message
* @param ir renderer
* @param ir renderer
*/
public GuiTabButton( int x, int y, ItemStack ico, String message, RenderItem ir )
{
@@ -77,7 +77,7 @@ public class GuiTabButton extends GuiButton implements ITooltip
@Override
public void drawButton( Minecraft minecraft, int x, int y )
{
if ( this.visible )
if( this.visible )
{
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
minecraft.renderEngine.bindTexture( ExtraBlockTextures.GuiTexture( "guis/states.png" ) );
@@ -89,9 +89,9 @@ public class GuiTabButton extends GuiButton implements ITooltip
this.drawTexturedModalRect( this.xPosition, this.yPosition, uv_x * 16, 0, 25, 22 );
if ( this.myIcon >= 0 )
if( this.myIcon >= 0 )
{
int uv_y = ( int ) Math.floor( this.myIcon / 16 );
int uv_y = (int) Math.floor( this.myIcon / 16 );
uv_x = this.myIcon - uv_y * 16;
this.drawTexturedModalRect( offsetX + this.xPosition + 3, this.yPosition + 3, uv_x * 16, uv_y * 16, 16, 16 );
@@ -99,7 +99,7 @@ public class GuiTabButton extends GuiButton implements ITooltip
this.mouseDragged( minecraft, x, y );
if ( this.myItem != null )
if( this.myItem != null )
{
this.zLevel = 100.0F;
this.itemRenderer.zLevel = 100.0F;
@@ -62,7 +62,7 @@ public class GuiToggleButton extends GuiButton implements ITooltip
@Override
public void drawButton( Minecraft par1Minecraft, int par2, int par3 )
{
if ( this.visible )
if( this.visible )
{
int iconIndex = this.getIconIndex();
@@ -70,7 +70,7 @@ public class GuiToggleButton extends GuiButton implements ITooltip
par1Minecraft.renderEngine.bindTexture( ExtraBlockTextures.GuiTexture( "guis/states.png" ) );
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
int uv_y = ( int ) Math.floor( iconIndex / 16 );
int uv_y = (int) Math.floor( iconIndex / 16 );
int uv_x = iconIndex - uv_y * 16;
this.drawTexturedModalRect( this.xPosition, this.yPosition, 256 - 16, 256 - 16, 16, 16 );
@@ -87,23 +87,23 @@ public class GuiToggleButton extends GuiButton implements ITooltip
@Override
public String getMessage()
{
if ( this.displayName != null )
if( this.displayName != null )
{
String name = StatCollector.translateToLocal( this.displayName );
String value = StatCollector.translateToLocal( this.displayHint );
if ( name == null || name.isEmpty() )
if( name == null || name.isEmpty() )
name = this.displayName;
if ( value == null || value.isEmpty() )
if( value == null || value.isEmpty() )
value = this.displayHint;
value = PATTERN_NEW_LINE.matcher( value ).replaceAll( "\n" );
StringBuilder sb = new StringBuilder( value );
int i = sb.lastIndexOf( "\n" );
if ( i <= 0 )
if( i <= 0 )
i = 0;
while ( i + 30 < sb.length() && ( i = sb.lastIndexOf( " ", i + 30 ) ) != -1 )
while( i + 30 < sb.length() && ( i = sb.lastIndexOf( " ", i + 30 ) ) != -1 )
{
sb.replace( i, i + 1, "\n" );
}
@@ -18,9 +18,9 @@
package appeng.client.gui.widgets;
public interface IScrollSource
{
int getCurrentScroll();
}
@@ -18,9 +18,11 @@
package appeng.client.gui.widgets;
import appeng.api.config.SortDir;
import appeng.api.config.ViewItems;
public interface ISortSource
{
@@ -38,5 +40,4 @@ public interface ISortSource
* @return {@link ViewItems}
*/
Enum getSortDisplay();
}
@@ -18,9 +18,9 @@
package appeng.client.gui.widgets;
/**
* AEBaseGui controlled Tooltip Interface.
*
*/
public interface ITooltip
{
@@ -64,5 +64,4 @@ public interface ITooltip
* @return true if button being drawn
*/
boolean isVisible();
}
@@ -22,6 +22,7 @@ package appeng.client.gui.widgets;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiTextField;
/**
* A modified version of the Minecraft text field.
* You can initialize it over the full element span.
@@ -44,10 +45,10 @@ public class MEGuiTextField extends GuiTextField
* Pays attention to the '_' caret.
*
* @param fontRenderer renderer for the strings
* @param xPos absolute left position
* @param yPos absolute top position
* @param width absolute width
* @param height absolute height
* @param xPos absolute left position
* @param yPos absolute top position
* @param width absolute width
* @param height absolute height
*/
public MEGuiTextField( FontRenderer fontRenderer, int xPos, int yPos, int width, int height )
{