Added Current/Max Power to Network Tool.

Added Current/Max Power to Spatial IO Port.
Added Required/Efficiency to Spatial IO Port.
Added Power Unit Button / Setting.
Fixed bug with Meteorite and Spatial IO.
Removed Random Logging in Spatial IO.
This commit is contained in:
AlgorithmX2
2014-03-05 23:45:14 -06:00
parent 040e948d8e
commit adb03c45c6
13 changed files with 262 additions and 62 deletions
@@ -2,23 +2,28 @@ package appeng.client.gui.implementations;
import java.util.List;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import appeng.api.config.Settings;
import appeng.api.config.SortDir;
import appeng.api.config.SortOrder;
import appeng.api.implementations.guiobjects.INetworkTool;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiScrollbar;
import appeng.client.gui.widgets.ISortSource;
import appeng.client.me.ItemRepo;
import appeng.client.me.SlotME;
import appeng.container.implementations.ContainerNetworkStatus;
import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.util.Platform;
@@ -26,18 +31,42 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
{
ItemRepo repo;
GuiImgButton units;
int rows = 4;
public GuiNetworkStatus(InventoryPlayer inventoryPlayer, INetworkTool te) {
super( new ContainerNetworkStatus( inventoryPlayer, te ) );
this.ySize = 125;
this.ySize = 153;
this.xSize = 195;
myScrollBar = new GuiScrollbar();
repo = new ItemRepo( myScrollBar, this );
repo.rowSize = 5;
}
@Override
protected void actionPerformed(GuiButton btn)
{
super.actionPerformed( btn );
boolean backwards = Mouse.isButtonDown( 1 );
if ( btn == units )
{
AEConfig.instance.nextPowerUnit( backwards );
units.set( AEConfig.instance.selectedPowerUnit() );
}
}
@Override
public void initGui()
{
super.initGui();
units = new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.POWER_UNITS, AEConfig.instance.selectedPowerUnit() );
buttonList.add( units );
}
public void postUpdate(List<IAEItemStack> list)
{
repo.clear();
@@ -110,8 +139,11 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
fontRendererObj.drawString( GuiText.NetworkDetails.getLocal(), 8, 6, 4210752 );
fontRendererObj.drawString( GuiText.PowerInputRate.getLocal() + ": " + formatPowerLong( ns.avgAddition ), 8, 16, 4210752 );
fontRendererObj.drawString( GuiText.PowerUsageRate.getLocal() + ": " + formatPowerLong( ns.powerUsage ), 8, 26, 4210752 );
fontRendererObj.drawString( GuiText.StoredPower.getLocal() + ": " + formatPowerLong( ns.currentPower, false ), 13, 16, 4210752 );
fontRendererObj.drawString( GuiText.MaxPower.getLocal() + ": " + formatPowerLong( ns.maxPower, false ), 13, 26, 4210752 );
fontRendererObj.drawString( GuiText.PowerInputRate.getLocal() + ": " + formatPowerLong( ns.avgAddition, true ), 13, 143 - 10, 4210752 );
fontRendererObj.drawString( GuiText.PowerUsageRate.getLocal() + ": " + formatPowerLong( ns.powerUsage, true ), 13, 143 - 20, 4210752 );
int sectionLength = 30;
@@ -152,7 +184,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
ToolTip = ToolTip + ("\n" + GuiText.Installed.getLocal() + ": " + (refStack.getStackSize()));
if ( refStack.getCountRequestable() > 0 )
ToolTip = ToolTip + ("\n" + GuiText.EnergyDrain.getLocal() + ": " + formatPowerLong( refStack.getCountRequestable() ));
ToolTip = ToolTip + ("\n" + GuiText.EnergyDrain.getLocal() + ": " + formatPowerLong( refStack.getCountRequestable(), true ));
toolPosX = x * sectionLength + xo + sectionLength - 8;
toolPosY = y * 18 + yo;
@@ -180,12 +212,6 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
}
private String formatPowerLong(long n)
{
double p = ((double) n) / 100;
return Double.toString( p ) + " ae/t";
}
// @Override - NEI
public List<String> handleItemTooltip(ItemStack stack, int mousex, int mousey, List<String> currenttip)
{
@@ -241,7 +267,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
currenttip.remove( 1 );
currenttip.add( GuiText.Installed.getLocal() + ": " + (myStack.getStackSize()) );
currenttip.add( GuiText.EnergyDrain.getLocal() + ": " + formatPowerLong( myStack.getCountRequestable() ) );
currenttip.add( GuiText.EnergyDrain.getLocal() + ": " + formatPowerLong( myStack.getCountRequestable(), true ) );
drawTooltip( x, y, 0, join( currenttip, "\n" ) );
}