Err too much.

This commit is contained in:
AlgorithmX2
2014-01-20 10:41:37 -06:00
parent 5652ec30ec
commit 834e9c04c5
159 changed files with 7953 additions and 1541 deletions
@@ -0,0 +1,167 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import org.lwjgl.input.Mouse;
import appeng.api.config.ActionItems;
import appeng.api.config.FuzzyMode;
import appeng.api.config.Settings;
import appeng.api.config.Upgrades;
import appeng.api.implementations.IUpgradeModule;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.container.implementations.ContainerCellWorkbench;
import appeng.core.localization.GuiText;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.tile.misc.TileCellWorkbench;
import appeng.util.Platform;
import cpw.mods.fml.common.network.PacketDispatcher;
public class GuiCellWorkbench extends GuiUpgradeable
{
ContainerCellWorkbench ccwb;
TileCellWorkbench tcw;
GuiImgButton clear;
GuiImgButton partition;
public GuiCellWorkbench(InventoryPlayer inventoryPlayer, TileCellWorkbench te) {
super( new ContainerCellWorkbench( inventoryPlayer, te ) );
ccwb = (ContainerCellWorkbench) inventorySlots;
ySize = 251;
tcw = te;
}
@Override
protected boolean drawUpgrades()
{
return ccwb.availableUpgrades() > 0;
}
@Override
public void initGui()
{
super.initGui();
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
handleButtonVisiblity();
bindTexture( getBackground() );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, 211 - 34, ySize );
if ( drawUpgrades() )
{
if ( ccwb.availableUpgrades() <= 8 )
{
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + ccwb.availableUpgrades() * 18 );
this.drawTexturedModalRect( offsetX + 177, offsetY + (7 + (ccwb.availableUpgrades()) * 18), 177, 151, 35, 7 );
}
else if ( ccwb.availableUpgrades() <= 16 )
{
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + 8 * 18 );
this.drawTexturedModalRect( offsetX + 177, offsetY + (7 + (8) * 18), 177, 151, 35, 7 );
int dx = ccwb.availableUpgrades() - 8;
this.drawTexturedModalRect( offsetX + 177 + 27, offsetY, 186, 0, 35 - 8, 7 + dx * 18 );
if ( dx == 8 )
this.drawTexturedModalRect( offsetX + 177 + 27, offsetY + (7 + (dx) * 18), 186, 151, 35 - 8, 7 );
else
this.drawTexturedModalRect( offsetX + 177 + 27 + 4, offsetY + (7 + (dx) * 18), 186 + 4, 151, 35 - 8, 7 );
}
else
{
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 7 + 8 * 18 );
this.drawTexturedModalRect( offsetX + 177, offsetY + (7 + (8) * 18), 177, 151, 35, 7 );
this.drawTexturedModalRect( offsetX + 177 + 27, offsetY, 186, 0, 35 - 8, 7 + 8 * 18 );
this.drawTexturedModalRect( offsetX + 177 + 27, offsetY + (7 + (8) * 18), 186, 151, 35 - 8, 7 );
int dx = ccwb.availableUpgrades() - 16;
this.drawTexturedModalRect( offsetX + 177 + 27 + 18, offsetY, 186, 0, 35 - 8, 7 + dx * 18 );
if ( dx == 8 )
this.drawTexturedModalRect( offsetX + 177 + 27 + 18, offsetY + (7 + (dx) * 18), 186, 151, 35 - 8, 7 );
else
this.drawTexturedModalRect( offsetX + 177 + 27 + 18 + 4, offsetY + (7 + (dx) * 18), 186 + 4, 151, 35 - 8, 7 );
}
}
if ( hasToolbox() )
this.drawTexturedModalRect( offsetX + 178, offsetY + ySize - 90, 178, 161, 68, 68 );
}
@Override
protected void actionPerformed(GuiButton btn)
{
try
{
if ( btn == partition )
{
PacketDispatcher.sendPacketToServer( (new PacketValueConfig( "CellWorkbench.Action", "Partition" )).getPacket() );
}
else if ( btn == clear )
{
PacketDispatcher.sendPacketToServer( (new PacketValueConfig( "CellWorkbench.Action", "Clear" )).getPacket() );
}
else if ( btn == fuzzyMode )
{
boolean backwards = Mouse.isButtonDown( 1 );
FuzzyMode fz = (FuzzyMode) fuzzyMode.getCurrentValue();
fz = Platform.rotateEnum( fz, backwards, Settings.FUZZY_MODE.getPossibleValues() );
PacketDispatcher.sendPacketToServer( (new PacketValueConfig( "CellWorkbench.Fuzzy", fz.name() )).getPacket() );
}
else
super.actionPerformed( btn );
}
catch (IOException err)
{
}
}
@Override
protected void addButtons()
{
clear = new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.ACTIONS, ActionItems.CLOSE );
partition = new GuiImgButton( this.guiLeft - 18, guiTop + 28, Settings.ACTIONS, ActionItems.WRENCH );
fuzzyMode = new GuiImgButton( this.guiLeft - 18, guiTop + 48, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
buttonList.add( fuzzyMode );
buttonList.add( partition );
buttonList.add( clear );
}
protected void handleButtonVisiblity()
{
boolean hasFuzzy = false;
IInventory inv = ccwb.getCellUpgradeInventory();
for (int x = 0; x < inv.getSizeInventory(); x++)
{
ItemStack is = inv.getStackInSlot( x );
if ( is != null && is.getItem() instanceof IUpgradeModule )
{
if ( ((IUpgradeModule) is.getItem()).getType( is ) == Upgrades.FUZZY )
hasFuzzy = true;
}
}
fuzzyMode.setVisibility( hasFuzzy );
}
protected String getBackground()
{
return "guis/cellworkbench.png";
}
protected GuiText getName()
{
return GuiText.CellWorkbench;
}
}
+95
View File
@@ -0,0 +1,95 @@
package appeng.client.gui.implementations;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import org.lwjgl.input.Mouse;
import appeng.api.AEApi;
import appeng.api.config.FullnessMode;
import appeng.api.config.OperationMode;
import appeng.api.config.RedstoneMode;
import appeng.api.config.Settings;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.container.implementations.ContainerIOPort;
import appeng.core.localization.GuiText;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.tile.storage.TileIOPort;
import cpw.mods.fml.common.network.PacketDispatcher;
public class GuiIOPort extends GuiUpgradeable
{
GuiImgButton fullMode;
GuiImgButton operationMode;
public GuiIOPort(InventoryPlayer inventoryPlayer, TileIOPort te) {
super( new ContainerIOPort( inventoryPlayer, te ) );
this.ySize = 166;
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
super.drawBG( offsetX, offsetY, mouseX, mouseY );
this.drawItem( offsetX + 66 - 8, offsetY + 17, AEApi.instance().items().itemCell1k.stack( 1 ) );
this.drawItem( offsetX + 94 + 8, offsetY + 17, AEApi.instance().blocks().blockDrive.stack( 1 ) );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
fontRenderer.drawString( GuiText.IOPort.getLocal(), 8, 6, 4210752 );
fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
if ( redstoneMode != null )
redstoneMode.set( cvb.rsMode );
if ( operationMode != null )
operationMode.set( ((ContainerIOPort) cvb).opMode );
if ( fullMode != null )
fullMode.set( ((ContainerIOPort) cvb).fMode );
}
@Override
protected void addButtons()
{
redstoneMode = new GuiImgButton( this.guiLeft - 18, guiTop + 28, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
fullMode = new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.FULLNESS_MODE, FullnessMode.EMPTY );
operationMode = new GuiImgButton( this.guiLeft + 80, guiTop + 17, Settings.OPERATION_MODE, OperationMode.EMPTY );
buttonList.add( operationMode );
buttonList.add( redstoneMode );
buttonList.add( fullMode );
}
@Override
protected void actionPerformed(GuiButton btn)
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
try
{
if ( btn == fullMode )
PacketDispatcher.sendPacketToServer( (new PacketConfigButton( fullMode.getSetting(), backwards )).getPacket() );
if ( btn == operationMode )
PacketDispatcher.sendPacketToServer( (new PacketConfigButton( operationMode.getSetting(), backwards )).getPacket() );
}
catch (IOException e)
{
e.printStackTrace();
}
}
protected String getBackground()
{
return "guis/ioport.png";
}
}
@@ -15,7 +15,7 @@ import appeng.core.sync.packets.PacketValueConfig;
import appeng.parts.automation.PartLevelEmitter;
import cpw.mods.fml.common.network.PacketDispatcher;
public class GuiLevelEmitter extends GuiBus
public class GuiLevelEmitter extends GuiUpgradeable
{
GuiTextField level;
@@ -28,7 +28,7 @@ public class GuiLevelEmitter extends GuiBus
public void initGui()
{
super.initGui();
level = new GuiTextField( this.fontRenderer, this.guiLeft + 10, this.guiTop + 43, 59, this.fontRenderer.FONT_HEIGHT );
level = new GuiTextField( this.fontRenderer, this.guiLeft + 44, this.guiTop + 43, 59, this.fontRenderer.FONT_HEIGHT );
level.setEnableBackgroundDrawing( false );
level.setMaxStringLength( 16 );
level.setTextColor( 0xFFFFFF );
@@ -40,8 +40,8 @@ public class GuiLevelEmitter extends GuiBus
@Override
protected void addButtons()
{
redstoneMode = new GuiImgButton( 122 + guiLeft, 31 + guiTop, Settings.REDSTONE_EMITTER, RedstoneMode.IGNORE );
fuzzyMode = new GuiImgButton( 122 + guiLeft, 49 + guiTop, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
redstoneMode = new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.REDSTONE_EMITTER, RedstoneMode.IGNORE );
fuzzyMode = new GuiImgButton( this.guiLeft - 18, guiTop + 28, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
buttonList.add( redstoneMode );
buttonList.add( fuzzyMode );
@@ -18,6 +18,7 @@ import appeng.container.implementations.ContainerMEMonitorable;
import appeng.container.slot.AppEngSlot;
import appeng.core.Configuration;
import appeng.core.localization.GuiText;
import appeng.helpers.ICellItemViewer;
import appeng.parts.reporting.PartTerminal;
import appeng.util.Platform;
@@ -29,6 +30,7 @@ public class GuiMEMonitorable extends AEBaseMEGui
GuiText myName;
int rows = 0;
int maxRows = Integer.MAX_VALUE;
public GuiMEMonitorable(InventoryPlayer inventoryPlayer, IStorageMonitorable te) {
super( new ContainerMEMonitorable( inventoryPlayer, null ) );
@@ -37,6 +39,8 @@ public class GuiMEMonitorable extends AEBaseMEGui
xSize = 195;
ySize = 204;
if ( te instanceof ICellItemViewer )
myName = GuiText.PortableCell;
if ( te instanceof IMEChest )
myName = GuiText.Chest;
else if ( te instanceof PartTerminal )
@@ -65,7 +69,14 @@ public class GuiMEMonitorable extends AEBaseMEGui
int NEI = 0;
int top = 4;
int extraSpace = height - 114 - NEI - top;
int moveDown = 0;
rows = (int) Math.floor( extraSpace / 18 );
if ( rows > maxRows )
{
top += (rows - maxRows) * 18 / 2;
rows = maxRows;
}
meSlots.clear();
for (int y = 0; y < rows; y++)
@@ -101,7 +112,7 @@ public class GuiMEMonitorable extends AEBaseMEGui
{
if ( s instanceof AppEngSlot )
{
((AppEngSlot) s).yDisplayPosition = ((AppEngSlot) s).defY + ySize - 78 - guiTop;
((AppEngSlot) s).yDisplayPosition = ((AppEngSlot) s).defY + ySize - 78 - 4;
}
}
}
@@ -0,0 +1,14 @@
package appeng.client.gui.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.helpers.ICellItemViewer;
public class GuiMEPortableCell extends GuiMEMonitorable
{
public GuiMEPortableCell(InventoryPlayer inventoryPlayer, ICellItemViewer te) {
super( inventoryPlayer, te );
maxRows = 3;
}
}
@@ -24,7 +24,7 @@ public class GuiNetworkStatus extends AEBaseGui
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
fontRenderer.drawString( GuiText.NetworkStatus.getLocal(), 8, 6, 4210752 );
fontRenderer.drawString( GuiText.NetworkDetails.getLocal(), 8, 6, 4210752 );
fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
}
+31
View File
@@ -0,0 +1,31 @@
package appeng.client.gui.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.client.gui.AEBaseGui;
import appeng.container.implementations.ContainerQNB;
import appeng.core.localization.GuiText;
import appeng.tile.qnb.TileQuantumBridge;
public class GuiQNB extends AEBaseGui
{
public GuiQNB(InventoryPlayer inventoryPlayer, TileQuantumBridge te) {
super( new ContainerQNB( inventoryPlayer, te ) );
this.ySize = 166;
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
{
bindTexture( "guis/chest.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
fontRenderer.drawString( GuiText.QuantumLinkChamber.getLocal(), 8, 6, 4210752 );
fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
}
}
@@ -14,28 +14,28 @@ import appeng.api.config.Upgrades;
import appeng.api.implementations.IBusCommon;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.container.implementations.ContainerBus;
import appeng.container.implementations.ContainerUpgradeable;
import appeng.core.localization.GuiText;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.parts.automation.PartImportBus;
import cpw.mods.fml.common.network.PacketDispatcher;
public class GuiBus extends AEBaseGui
public class GuiUpgradeable extends AEBaseGui
{
ContainerBus cvb;
ContainerUpgradeable cvb;
IBusCommon bc;
GuiImgButton redstoneMode;
GuiImgButton fuzzyMode;
public GuiBus(InventoryPlayer inventoryPlayer, IBusCommon te) {
this( new ContainerBus( inventoryPlayer, te ) );
public GuiUpgradeable(InventoryPlayer inventoryPlayer, IBusCommon te) {
this( new ContainerUpgradeable( inventoryPlayer, te ) );
}
public GuiBus(ContainerBus te) {
public GuiUpgradeable(ContainerUpgradeable te) {
super( te );
cvb = (ContainerBus) te;
cvb = (ContainerUpgradeable) te;
bc = (IBusCommon) te.getTarget();
this.xSize = hasToolbox() ? 246 : 211;
@@ -58,12 +58,21 @@ public class GuiBus extends AEBaseGui
buttonList.add( fuzzyMode );
}
protected void mouseClicked(int par1, int par2, int par3)
protected void mouseClicked(int xCoord, int yCoord, int btn)
{
if ( par3 == 1 )
super.mouseClicked( par1, par2, 0 );
else
super.mouseClicked( par1, par2, par3 );
if ( btn == 1 )
{
for (Object o : this.buttonList)
{
GuiButton guibutton = (GuiButton) o;
if ( guibutton.mousePressed( this.mc, xCoord, yCoord ) )
{
super.mouseClicked( xCoord, yCoord, 0 );
return;
}
}
}
super.mouseClicked( xCoord, yCoord, btn );
}
@Override
@@ -88,9 +97,9 @@ public class GuiBus extends AEBaseGui
}
}
private boolean hasToolbox()
protected boolean hasToolbox()
{
return ((ContainerBus) inventorySlots).hasToolbox();
return ((ContainerUpgradeable) inventorySlots).hasToolbox();
}
@Override
@@ -99,10 +108,16 @@ public class GuiBus extends AEBaseGui
handleButtonVisiblity();
bindTexture( getBackground() );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize - 34, ySize );
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 86 );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, 211 - 34, ySize );
if ( drawUpgrades() )
this.drawTexturedModalRect( offsetX + 177, offsetY, 177, 0, 35, 10 + cvb.availableUpgrades() * 18 );
if ( hasToolbox() )
this.drawTexturedModalRect( offsetX + 178, offsetY + 94, 178, 94, 68, 68 );
this.drawTexturedModalRect( offsetX + 178, offsetY + ySize - 90, 178, ySize - 90, 68, 68 );
}
protected boolean drawUpgrades()
{
return true;
}
protected String getBackground()
@@ -112,8 +127,10 @@ public class GuiBus extends AEBaseGui
protected void handleButtonVisiblity()
{
redstoneMode.setVisibility( bc.getInstalledUpgrades( Upgrades.REDSTONE ) > 0 );
fuzzyMode.setVisibility( bc.getInstalledUpgrades( Upgrades.FUZZY ) > 0 );
if ( redstoneMode != null )
redstoneMode.setVisibility( bc.getInstalledUpgrades( Upgrades.REDSTONE ) > 0 );
if ( fuzzyMode != null )
fuzzyMode.setVisibility( bc.getInstalledUpgrades( Upgrades.FUZZY ) > 0 );
}
@Override