Resolved #0202 - The question of cable power usage.
Cables no longer use power. Each channel on a block now consumes 1 / 128 AE/t
This commit is contained in:
parent
b226b5bb49
commit
a475a3e91f
6 changed files with 51 additions and 19 deletions
11
me/cache/EnergyGridCache.java
vendored
11
me/cache/EnergyGridCache.java
vendored
|
@ -21,9 +21,11 @@ import appeng.api.networking.energy.IEnergyGridProvider;
|
||||||
import appeng.api.networking.energy.IEnergyWatcher;
|
import appeng.api.networking.energy.IEnergyWatcher;
|
||||||
import appeng.api.networking.energy.IEnergyWatcherHost;
|
import appeng.api.networking.energy.IEnergyWatcherHost;
|
||||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||||
|
import appeng.api.networking.events.MENetworkPostCacheConstruction;
|
||||||
import appeng.api.networking.events.MENetworkPowerIdleChange;
|
import appeng.api.networking.events.MENetworkPowerIdleChange;
|
||||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||||
import appeng.api.networking.events.MENetworkPowerStorage;
|
import appeng.api.networking.events.MENetworkPowerStorage;
|
||||||
|
import appeng.api.networking.pathing.IPathingGrid;
|
||||||
import appeng.api.networking.storage.IStackWatcherHost;
|
import appeng.api.networking.storage.IStackWatcherHost;
|
||||||
import appeng.me.GridNode;
|
import appeng.me.GridNode;
|
||||||
import appeng.me.energy.EnergyThreshold;
|
import appeng.me.energy.EnergyThreshold;
|
||||||
|
@ -108,11 +110,18 @@ public class EnergyGridCache implements IEnergyGrid
|
||||||
Set<IEnergyGridProvider> gproviders = new LinkedHashSet();
|
Set<IEnergyGridProvider> gproviders = new LinkedHashSet();
|
||||||
|
|
||||||
final IGrid myGrid;
|
final IGrid myGrid;
|
||||||
|
PathGridCache pgc;
|
||||||
|
|
||||||
public EnergyGridCache(IGrid g) {
|
public EnergyGridCache(IGrid g) {
|
||||||
myGrid = g;
|
myGrid = g;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@MENetworkEventSubscribe
|
||||||
|
public void postInit(MENetworkPostCacheConstruction pcc)
|
||||||
|
{
|
||||||
|
pgc = myGrid.getCache( IPathingGrid.class );
|
||||||
|
}
|
||||||
|
|
||||||
@MENetworkEventSubscribe
|
@MENetworkEventSubscribe
|
||||||
public void EnergyNodeChanges(MENetworkPowerIdleChange ev)
|
public void EnergyNodeChanges(MENetworkPowerIdleChange ev)
|
||||||
{
|
{
|
||||||
|
@ -491,7 +500,7 @@ public class EnergyGridCache implements IEnergyGrid
|
||||||
@Override
|
@Override
|
||||||
public double getIdlePowerUsage()
|
public double getIdlePowerUsage()
|
||||||
{
|
{
|
||||||
return drainPerTick;
|
return drainPerTick + pgc.channelPowerUsage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
9
me/cache/PathGridCache.java
vendored
9
me/cache/PathGridCache.java
vendored
|
@ -52,6 +52,9 @@ public class PathGridCache implements IPathingGrid
|
||||||
private HashSet<IPathItem> semiOpen = new HashSet();
|
private HashSet<IPathItem> semiOpen = new HashSet();
|
||||||
private HashSet<IPathItem> closedList = new HashSet();
|
private HashSet<IPathItem> closedList = new HashSet();
|
||||||
|
|
||||||
|
public int channelsByBlocks = 0;
|
||||||
|
public double channelPowerUsage = 0.0;
|
||||||
|
|
||||||
public PathGridCache(IGrid g) {
|
public PathGridCache(IGrid g) {
|
||||||
myGrid = g;
|
myGrid = g;
|
||||||
}
|
}
|
||||||
|
@ -82,6 +85,8 @@ public class PathGridCache implements IPathingGrid
|
||||||
|
|
||||||
int nodes = myGrid.getNodes().size();
|
int nodes = myGrid.getNodes().size();
|
||||||
ticksUntilReady = 20 + (nodes / 10);
|
ticksUntilReady = 20 + (nodes / 10);
|
||||||
|
channelsByBlocks = nodes * used;
|
||||||
|
channelPowerUsage = (double) channelsByBlocks / 128.0;
|
||||||
|
|
||||||
myGrid.getPivot().beginVisition( new AdHocChannelUpdater( used ) );
|
myGrid.getPivot().beginVisition( new AdHocChannelUpdater( used ) );
|
||||||
}
|
}
|
||||||
|
@ -111,7 +116,7 @@ public class PathGridCache implements IPathingGrid
|
||||||
closedList.add( gc );
|
closedList.add( gc );
|
||||||
open.add( gc );
|
open.add( gc );
|
||||||
gc.setControllerRoute( (GridNode) node, true );
|
gc.setControllerRoute( (GridNode) node, true );
|
||||||
active.add( new PathSegment( open, semiOpen, closedList ) );
|
active.add( new PathSegment( this, open, semiOpen, closedList ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,6 +150,7 @@ public class PathGridCache implements IPathingGrid
|
||||||
}
|
}
|
||||||
|
|
||||||
booting = false;
|
booting = false;
|
||||||
|
channelPowerUsage = (double) channelsByBlocks / 128.0;
|
||||||
myGrid.postEvent( new MENetworkBootingStatusChange() );
|
myGrid.postEvent( new MENetworkBootingStatusChange() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,6 +187,7 @@ public class PathGridCache implements IPathingGrid
|
||||||
// clean up...
|
// clean up...
|
||||||
active.clear();
|
active.clear();
|
||||||
|
|
||||||
|
channelsByBlocks = 0;
|
||||||
updateNetwork = true;
|
updateNetwork = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import java.util.Set;
|
||||||
import appeng.api.networking.GridFlags;
|
import appeng.api.networking.GridFlags;
|
||||||
import appeng.api.networking.IGridMultiblock;
|
import appeng.api.networking.IGridMultiblock;
|
||||||
import appeng.api.networking.IGridNode;
|
import appeng.api.networking.IGridNode;
|
||||||
|
import appeng.me.cache.PathGridCache;
|
||||||
|
|
||||||
public class PathSegment
|
public class PathSegment
|
||||||
{
|
{
|
||||||
|
@ -22,10 +23,13 @@ public class PathSegment
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public PathSegment(List open, Set semiopen, Set closed) {
|
PathGridCache pgc;
|
||||||
|
|
||||||
|
public PathSegment(PathGridCache myPGC, List open, Set semiopen, Set closed) {
|
||||||
this.open = open;
|
this.open = open;
|
||||||
this.semiopen = semiopen;
|
this.semiopen = semiopen;
|
||||||
this.closed = closed;
|
this.closed = closed;
|
||||||
|
pgc = myPGC;
|
||||||
isDead = false;
|
isDead = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,6 +105,7 @@ public class PathSegment
|
||||||
pi = start;
|
pi = start;
|
||||||
while (pi != null)
|
while (pi != null)
|
||||||
{
|
{
|
||||||
|
pgc.channelsByBlocks++;
|
||||||
pi.incrementChannelCount( 1 );
|
pi.incrementChannelCount( 1 );
|
||||||
pi = pi.getControllerRoute();
|
pi = pi.getControllerRoute();
|
||||||
}
|
}
|
||||||
|
@ -122,6 +127,7 @@ public class PathSegment
|
||||||
pi = start;
|
pi = start;
|
||||||
while (pi != null)
|
while (pi != null)
|
||||||
{
|
{
|
||||||
|
pgc.channelsByBlocks++;
|
||||||
pi.incrementChannelCount( 1 );
|
pi.incrementChannelCount( 1 );
|
||||||
pi = pi.getControllerRoute();
|
pi = pi.getControllerRoute();
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||||
|
|
||||||
public PartCable(Class c, ItemStack is) {
|
public PartCable(Class c, ItemStack is) {
|
||||||
super( c, is );
|
super( c, is );
|
||||||
proxy.setIdlePowerUsage( 1.0 / 16.0 );
|
proxy.setIdlePowerUsage( 0.0 );
|
||||||
proxy.myColor = AEColor.values()[((ItemPart) is.getItem()).varientOf( is.getItemDamage() )];
|
proxy.myColor = AEColor.values()[((ItemPart) is.getItem()).varientOf( is.getItemDamage() )];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import appeng.api.exceptions.RecipeError;
|
||||||
import appeng.api.exceptions.RegistrationError;
|
import appeng.api.exceptions.RegistrationError;
|
||||||
import appeng.api.recipes.ICraftHandler;
|
import appeng.api.recipes.ICraftHandler;
|
||||||
import appeng.api.recipes.IIngredient;
|
import appeng.api.recipes.IIngredient;
|
||||||
|
import appeng.core.AELog;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.integration.abstraction.IIC2;
|
import appeng.integration.abstraction.IIC2;
|
||||||
import appeng.recipes.RecipeHandler;
|
import appeng.recipes.RecipeHandler;
|
||||||
|
@ -42,20 +43,29 @@ public class Macerator implements ICraftHandler, IWebsiteSeralizer
|
||||||
{
|
{
|
||||||
IIC2 ic2 = (IIC2) AppEng.instance.getIntegration( "IC2" );
|
IIC2 ic2 = (IIC2) AppEng.instance.getIntegration( "IC2" );
|
||||||
for (ItemStack is : pro_input.getItemStackSet())
|
for (ItemStack is : pro_input.getItemStackSet())
|
||||||
ic2.maceratorRecipe( is, pro_output[0].getItemStack() );
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ic2.maceratorRecipe( is, pro_output[0].getItemStack() );
|
||||||
|
}
|
||||||
|
catch (java.lang.RuntimeException err)
|
||||||
|
{
|
||||||
|
AELog.info( "IC2 not happy - " + err.getMessage() );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError {
|
public boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError
|
||||||
return Platform.isSameItemPrecise( pro_output[0].getItemStack(),output );
|
{
|
||||||
|
return Platform.isSameItemPrecise( pro_output[0].getItemStack(), output );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPattern( RecipeHandler h ) {
|
public String getPattern(RecipeHandler h)
|
||||||
return "macerator\n"+
|
{
|
||||||
h.getName(pro_input)+"\n"+
|
return null;
|
||||||
h.getName(pro_output[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,15 +53,15 @@ public class Pulverizer implements ICraftHandler, IWebsiteSeralizer
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError {
|
public boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError
|
||||||
return Platform.isSameItemPrecise( pro_output[0].getItemStack(),output );
|
{
|
||||||
|
return Platform.isSameItemPrecise( pro_output[0].getItemStack(), output );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPattern( RecipeHandler h ) {
|
public String getPattern(RecipeHandler h)
|
||||||
return "pulverizer\n"+
|
{
|
||||||
h.getName(pro_input)+"\n"+
|
return null;
|
||||||
h.getName(pro_output[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue