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
+36
View File
@@ -1,6 +1,7 @@
package appeng.client.gui;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
@@ -23,6 +24,7 @@ import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import appeng.api.config.PowerUnits;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.widgets.GuiScrollbar;
import appeng.client.gui.widgets.ITooltip;
@@ -39,6 +41,7 @@ import appeng.container.slot.SlotFake;
import appeng.container.slot.SlotInaccessable;
import appeng.container.slot.SlotOutput;
import appeng.container.slot.SlotRestrictedInput;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketInventoryAction;
@@ -51,6 +54,39 @@ public abstract class AEBaseGui extends GuiContainer
protected List<InternalSlotME> meSlots = new LinkedList<InternalSlotME>();
protected GuiScrollbar myScrollBar = null;
protected String formatPowerLong(long n, boolean isRate)
{
double p = ((double) n) / 100;
PowerUnits displayUnits = AEConfig.instance.selectedPowerUnit();
p = PowerUnits.AE.convertTo( displayUnits, p );
int offset = 0;
String Lvl = "";
String preFixes[] = new String[] { "k", "M", "G", "T", "P", "T", "P", "E", "Z", "Y" };
String unitName = displayUnits.name();
if ( displayUnits == PowerUnits.WA )
unitName = "J";
if ( displayUnits == PowerUnits.KJ )
{
Lvl = preFixes[offset];
unitName = "J";
offset++;
}
while (p > 1000 && offset < preFixes.length)
{
p /= 1000;
Lvl = preFixes[offset];
offset++;
}
DecimalFormat df = new DecimalFormat( "#.##" );
return df.format( p ) + " " + Lvl + unitName + (isRate ? "/t" : "");
}
public AEBaseGui(Container container) {
super( container );
}