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:
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -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" ) );
|
||||
}
|
||||
|
||||
@@ -1,17 +1,51 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.container.implementations.ContainerSpatialIOPort;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.tile.spatial.TileSpatialIOPort;
|
||||
|
||||
public class GuiSpatialIOPort extends AEBaseGui
|
||||
{
|
||||
|
||||
ContainerSpatialIOPort csiop;
|
||||
GuiImgButton units;
|
||||
|
||||
public GuiSpatialIOPort(InventoryPlayer inventoryPlayer, TileSpatialIOPort te) {
|
||||
super( new ContainerSpatialIOPort( inventoryPlayer, te ) );
|
||||
this.ySize = 199;
|
||||
csiop = (ContainerSpatialIOPort) inventorySlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
boolean backwards = Mouse.isButtonDown( 1 );
|
||||
|
||||
if ( btn == units )
|
||||
{
|
||||
AEConfig.instance.nextPowerUnit( backwards );
|
||||
units.set( AEConfig.instance.selectedPowerUnit() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
units = new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.POWER_UNITS, AEConfig.instance.selectedPowerUnit() );
|
||||
buttonList.add( units );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -24,6 +58,11 @@ public class GuiSpatialIOPort extends AEBaseGui
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString( GuiText.StoredPower.getLocal() + ": " + formatPowerLong( csiop.currentPower, false ), 13, 21, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.MaxPower.getLocal() + ": " + formatPowerLong( csiop.maxPower, false ), 13, 31, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.RequiredPower.getLocal() + ": " + formatPowerLong( csiop.reqPower, false ), 13, 78, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.Efficiency.getLocal() + ": " + (((float) csiop.eff) / 100) + "%", 13, 88, 4210752 );
|
||||
|
||||
fontRendererObj.drawString( GuiText.SpatialIOPort.getLocal(), 8, 6, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96, 4210752 );
|
||||
}
|
||||
|
||||
@@ -113,6 +113,7 @@ public class GuiImgButton extends GuiButton implements ITooltip
|
||||
registerApp( 16 * 10 + 2, Settings.POWER_UNITS, PowerUnits.MJ, ButtonToolTips.PowerUnits, PowerUnits.MJ.unlocalizedName );
|
||||
registerApp( 16 * 10 + 3, Settings.POWER_UNITS, PowerUnits.KJ, ButtonToolTips.PowerUnits, PowerUnits.KJ.unlocalizedName );
|
||||
registerApp( 16 * 10 + 4, Settings.POWER_UNITS, PowerUnits.WA, ButtonToolTips.PowerUnits, PowerUnits.WA.unlocalizedName );
|
||||
registerApp( 16 * 10 + 5, Settings.POWER_UNITS, PowerUnits.RF, ButtonToolTips.PowerUnits, PowerUnits.RF.unlocalizedName );
|
||||
|
||||
registerApp( 3, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE, ButtonToolTips.RedstoneMode, ButtonToolTips.AlwaysActive );
|
||||
registerApp( 0, Settings.REDSTONE_CONTROLLED, RedstoneMode.LOW_SIGNAL, ButtonToolTips.RedstoneMode, ButtonToolTips.ActiveWithoutSignal );
|
||||
|
||||
@@ -24,8 +24,6 @@ import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
||||
import appeng.core.sync.packets.PacketProgressBar;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ContainerNetworkStatus extends AEBaseContainer
|
||||
{
|
||||
@@ -61,32 +59,23 @@ public class ContainerNetworkStatus extends AEBaseContainer
|
||||
|
||||
public long avgAddition;
|
||||
public long powerUsage;
|
||||
|
||||
int lo_avgAddition, hi_avgAddition;
|
||||
int lo_powerUsage, hi_powerUsage;
|
||||
public long currentPower;
|
||||
public long maxPower;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateProgressBar(int idx, int value)
|
||||
public void updateFullProgressBar(int id, long value)
|
||||
{
|
||||
switch (idx)
|
||||
{
|
||||
case 0:
|
||||
lo_avgAddition = value;
|
||||
break;
|
||||
case 1:
|
||||
hi_avgAddition = value;
|
||||
break;
|
||||
case 2:
|
||||
lo_powerUsage = value;
|
||||
break;
|
||||
case 3:
|
||||
hi_powerUsage = value;
|
||||
break;
|
||||
}
|
||||
if ( id == 0 )
|
||||
avgAddition = value;
|
||||
|
||||
avgAddition = ((long) hi_avgAddition) << 32 | lo_avgAddition;
|
||||
powerUsage = ((long) hi_powerUsage) << 32 | lo_powerUsage;
|
||||
if ( id == 1 )
|
||||
powerUsage = value;
|
||||
|
||||
if ( id == 2 )
|
||||
currentPower = value;
|
||||
|
||||
if ( id == 3 )
|
||||
maxPower = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -102,22 +91,18 @@ public class ContainerNetworkStatus extends AEBaseContainer
|
||||
{
|
||||
avgAddition = (long) (100.0 * eg.getAvgPowerInjection());
|
||||
powerUsage = (long) (100.0 * eg.getAvgPowerUsage());
|
||||
|
||||
lo_avgAddition = (int) (avgAddition & 0xffffffffL);
|
||||
hi_avgAddition = (int) (avgAddition >> 32L);
|
||||
|
||||
lo_powerUsage = (int) (powerUsage & 0xffffffffL);
|
||||
hi_powerUsage = (int) (powerUsage >> 32L);
|
||||
currentPower = (long) (100.0 * eg.getStoredPower());
|
||||
maxPower = (long) (100.0 * eg.getMaxStoredPower());
|
||||
|
||||
for (Object c : this.crafters)
|
||||
{
|
||||
ICrafting icrafting = (ICrafting) c;
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( 0, (int) lo_avgAddition ), (EntityPlayerMP) icrafting );
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( 1, (int) hi_avgAddition ), (EntityPlayerMP) icrafting );
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( 2, (int) lo_powerUsage ), (EntityPlayerMP) icrafting );
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( 3, (int) hi_powerUsage ), (EntityPlayerMP) icrafting );
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( 0, avgAddition ), (EntityPlayerMP) icrafting );
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( 1, powerUsage ), (EntityPlayerMP) icrafting );
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( 2, currentPower ), (EntityPlayerMP) icrafting );
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( 3, maxPower ), (EntityPlayerMP) icrafting );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
||||
@@ -1,24 +1,64 @@
|
||||
package appeng.container.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.spatial.ISpatialCache;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotOutput;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketProgressBar;
|
||||
import appeng.tile.spatial.TileSpatialIOPort;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ContainerSpatialIOPort extends AEBaseContainer
|
||||
{
|
||||
|
||||
TileSpatialIOPort myte;
|
||||
|
||||
IGrid network;
|
||||
|
||||
public long reqPower;
|
||||
public long currentPower;
|
||||
public long maxPower;
|
||||
public long eff;
|
||||
|
||||
int delay = 40;
|
||||
|
||||
@Override
|
||||
public void updateFullProgressBar(int id, long value)
|
||||
{
|
||||
if ( id == 0 )
|
||||
currentPower = value;
|
||||
|
||||
if ( id == 1 )
|
||||
maxPower = value;
|
||||
|
||||
if ( id == 2 )
|
||||
reqPower = value;
|
||||
|
||||
if ( id == 3 )
|
||||
eff = value;
|
||||
}
|
||||
|
||||
public ContainerSpatialIOPort(InventoryPlayer ip, TileSpatialIOPort te) {
|
||||
super( ip, te, null );
|
||||
myte = te;
|
||||
|
||||
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.SPATIAL_STORAGE_CELLS, te, 0, 52, 53 ) );
|
||||
addSlotToContainer( new SlotOutput( te, 1, 113, 53, PlaceableItemType.SPATIAL_STORAGE_CELLS.IIcon ) );
|
||||
if ( Platform.isServer() )
|
||||
network = te.getGridNode( ForgeDirection.UNKNOWN ).getGrid();
|
||||
|
||||
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.SPATIAL_STORAGE_CELLS, te, 0, 52, 48 ) );
|
||||
addSlotToContainer( new SlotOutput( te, 1, 113, 48, PlaceableItemType.SPATIAL_STORAGE_CELLS.IIcon ) );
|
||||
|
||||
bindPlayerInventory( ip, 0, 197 - /* height of playerinventory */82 );
|
||||
}
|
||||
@@ -28,7 +68,41 @@ public class ContainerSpatialIOPort extends AEBaseContainer
|
||||
{
|
||||
verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
delay++;
|
||||
if ( delay > 15 && network != null )
|
||||
{
|
||||
delay = 0;
|
||||
|
||||
IEnergyGrid eg = network.getCache( IEnergyGrid.class );
|
||||
ISpatialCache sc = network.getCache( ISpatialCache.class );
|
||||
if ( eg != null )
|
||||
{
|
||||
currentPower = (long) (100.0 * eg.getStoredPower());
|
||||
maxPower = (long) (100.0 * eg.getMaxStoredPower());
|
||||
reqPower = (long) (100.0 * sc.requiredPower());
|
||||
eff = (long) (100.0f * sc.currentEffiency());
|
||||
|
||||
for (Object c : this.crafters)
|
||||
{
|
||||
ICrafting icrafting = (ICrafting) c;
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( 0, currentPower ), (EntityPlayerMP) icrafting );
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( 1, maxPower ), (EntityPlayerMP) icrafting );
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( 2, reqPower ), (EntityPlayerMP) icrafting );
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( 3, eff ), (EntityPlayerMP) icrafting );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import appeng.api.util.IConfigureableObject;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.util.ConfigManager;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class AEConfig extends Configuration implements IConfigureableObject, IConfigManagerHost
|
||||
{
|
||||
@@ -34,6 +35,7 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
||||
|
||||
public IConfigManager settings = new ConfigManager( this );
|
||||
public EnumSet<AEFeature> featureFlags = EnumSet.noneOf( AEFeature.class );
|
||||
PowerUnits selectedPowerUnit = PowerUnits.AE;
|
||||
|
||||
public int storageBiomeID = -1;
|
||||
public int storageProviderID = -1;
|
||||
@@ -152,6 +154,15 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
||||
this.get( Category, e.name(), settings.getSetting( e ).name() );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
selectedPowerUnit = PowerUnits.valueOf( get( "Client", "PowerUnit", selectedPowerUnit.name() ).getString() );
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
selectedPowerUnit = PowerUnits.AE;
|
||||
}
|
||||
|
||||
if ( isFeatureEnabled( AEFeature.SpatialIO ) )
|
||||
{
|
||||
storageBiomeID = get( "spatialio", "storageBiomeID", storageBiomeID ).getInt( storageBiomeID );
|
||||
@@ -199,6 +210,8 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
||||
get( "spatialio", "storageProviderID", storageProviderID ).set( storageProviderID );
|
||||
}
|
||||
|
||||
get( "Client", "PowerUnit", selectedPowerUnit.name() ).set( selectedPowerUnit.name() );
|
||||
|
||||
if ( hasChanged() )
|
||||
super.save();
|
||||
}
|
||||
@@ -270,4 +283,15 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
||||
get( Category, name, s.name() ).set( s.name() );
|
||||
save();
|
||||
}
|
||||
|
||||
public PowerUnits selectedPowerUnit()
|
||||
{
|
||||
return selectedPowerUnit;
|
||||
}
|
||||
|
||||
public void nextPowerUnit(boolean backwards)
|
||||
{
|
||||
selectedPowerUnit = Platform.rotateEnum( selectedPowerUnit, backwards, Settings.POWER_UNITS.getPossibleValues() );
|
||||
save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,9 @@ public enum GuiText
|
||||
|
||||
CraftingTerminal, FormationPlane, Inscriber, QuartzCuttingKnife,
|
||||
|
||||
METunnel, ItemTunnel, RedstoneTunnel, MJTunnel, EUTunnel, FluidTunnel, StoredSize;
|
||||
METunnel, ItemTunnel, RedstoneTunnel, MJTunnel, EUTunnel, FluidTunnel, StoredSize,
|
||||
|
||||
StoredPower, MaxPower, RequiredPower, Efficiency;
|
||||
|
||||
String root;
|
||||
|
||||
|
||||
@@ -169,8 +169,8 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
if ( dest == null )
|
||||
dest = createNewWorld( is );
|
||||
|
||||
StorageHelper.getInstance().swapRegions( w, dest, min.x + 1, min.y + 1, min.z + 1, 1, floorBuffer + 1, 1, targetX - 1,
|
||||
floorBuffer + targetY - 1, targetZ - 1 );
|
||||
StorageHelper.getInstance()
|
||||
.swapRegions( w, dest, min.x + 1, min.y + 1, min.z + 1, 1, floorBuffer + 1, 1, targetX - 1, targetY - 1, targetZ - 1 );
|
||||
setStoredSize( is, targetX, targetY, targetZ );
|
||||
|
||||
return new TransitionResult( true, 0 );
|
||||
|
||||
Vendored
+11
-3
@@ -25,7 +25,6 @@ import appeng.api.networking.events.MENetworkPowerIdleChange;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
import appeng.api.networking.events.MENetworkPowerStorage;
|
||||
import appeng.api.networking.storage.IStackWatcherHost;
|
||||
import appeng.core.AELog;
|
||||
import appeng.me.GridNode;
|
||||
import appeng.me.energy.EnergyThreshold;
|
||||
import appeng.me.energy.EnergyWatcher;
|
||||
@@ -38,6 +37,7 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
*/
|
||||
int availableTicksSinceUpdate = 0;
|
||||
double globalAvailablePower = 0;
|
||||
double globalMaxPower = 0;
|
||||
|
||||
/**
|
||||
* idle draw.
|
||||
@@ -232,6 +232,8 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
double max = ps.getAEMaxPower();
|
||||
double current = ps.getAECurrentPower();
|
||||
|
||||
globalMaxPower += ps.getAEMaxPower();
|
||||
|
||||
if ( current > 0 && ps.getPowerFlow() != AccessRestriction.WRITE )
|
||||
{
|
||||
globalAvailablePower += ((IAEPowerStorage) machine).getAECurrentPower();
|
||||
@@ -277,6 +279,8 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
if ( lastRequestor == machine )
|
||||
lastRequestor = null;
|
||||
|
||||
globalMaxPower -= ps.getAEMaxPower();
|
||||
|
||||
providers.remove( machine );
|
||||
requesters.remove( machine );
|
||||
}
|
||||
@@ -303,8 +307,6 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
double oldPower = lastStoredPower;
|
||||
lastStoredPower = getStoredPower();
|
||||
|
||||
if ( Math.abs( oldPower - lastStoredPower ) > 1000 )
|
||||
AELog.info( "Hi" );
|
||||
EnergyThreshold low = new EnergyThreshold( Math.min( oldPower, lastStoredPower ), null );
|
||||
EnergyThreshold high = new EnergyThreshold( Math.max( oldPower, lastStoredPower ), null );
|
||||
for (EnergyThreshold th : interests.subSet( low, true, high, true ))
|
||||
@@ -384,6 +386,12 @@ public class EnergyGridCache implements IEnergyGrid
|
||||
return globalAvailablePower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxStoredPower()
|
||||
{
|
||||
return globalMaxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double extractAEPower(double amt, Actionable mode, Set<IEnergyGrid> seen)
|
||||
{
|
||||
|
||||
Vendored
+7
-1
@@ -23,6 +23,7 @@ public class SpatialPylonCache implements IGridCache, ISpatialCache
|
||||
{
|
||||
|
||||
long powerRequired = 0;
|
||||
double effiency = 0.0;
|
||||
|
||||
DimensionalCoord captureMin;
|
||||
DimensionalCoord captureMax;
|
||||
@@ -76,7 +77,6 @@ public class SpatialPylonCache implements IGridCache, ISpatialCache
|
||||
int reqZ = 0;
|
||||
int requirePylongBlocks = 1;
|
||||
|
||||
double effiency = 0.0;
|
||||
double minPower = 0;
|
||||
double maxPower = 0;
|
||||
|
||||
@@ -181,6 +181,12 @@ public class SpatialPylonCache implements IGridCache, ISpatialCache
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float currentEffiency()
|
||||
{
|
||||
return (float) effiency * 100;
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void bootingRender(MENetworkBootingStatusChange c)
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ import appeng.api.movable.IMovableHandler;
|
||||
import appeng.api.movable.IMovableRegistry;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.WorldSettings;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
@@ -379,11 +380,6 @@ public class CachedPlane
|
||||
for (int z = 0; z < cz_size; z++)
|
||||
{
|
||||
Chunk c = myChunks[x][z];
|
||||
for (Method m : c.getClass().getMethods())
|
||||
{
|
||||
AELog.severe( "Chunk." + m.getName() );
|
||||
}
|
||||
|
||||
c.resetRelightChecks();
|
||||
c.generateSkylightMap();
|
||||
c.isModified = true;
|
||||
@@ -396,6 +392,9 @@ public class CachedPlane
|
||||
|
||||
Chunk c = myChunks[x][z];
|
||||
|
||||
for (int y = 1; y < 255; y += 32)
|
||||
WorldSettings.getInstance().getCompass().updateArea( wrld, c.xPosition << 4, y, c.zPosition << 4 );
|
||||
|
||||
try
|
||||
{
|
||||
WorldServer ws = (WorldServer) c.worldObj;
|
||||
|
||||
@@ -36,13 +36,13 @@ public class TileCreativeEnergyCell extends AENetworkTile implements IAEPowerSto
|
||||
@Override
|
||||
public double getAEMaxPower()
|
||||
{
|
||||
return Integer.MAX_VALUE;
|
||||
return Long.MAX_VALUE / 10000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAECurrentPower()
|
||||
{
|
||||
return Integer.MAX_VALUE - 32;
|
||||
return Long.MAX_VALUE / 10000;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user