diff --git a/me/cache/EnergyGridCache.java b/me/cache/EnergyGridCache.java index 3d2d7288..8561dcbd 100644 --- a/me/cache/EnergyGridCache.java +++ b/me/cache/EnergyGridCache.java @@ -21,9 +21,11 @@ import appeng.api.networking.energy.IEnergyGridProvider; import appeng.api.networking.energy.IEnergyWatcher; import appeng.api.networking.energy.IEnergyWatcherHost; import appeng.api.networking.events.MENetworkEventSubscribe; +import appeng.api.networking.events.MENetworkPostCacheConstruction; import appeng.api.networking.events.MENetworkPowerIdleChange; import appeng.api.networking.events.MENetworkPowerStatusChange; import appeng.api.networking.events.MENetworkPowerStorage; +import appeng.api.networking.pathing.IPathingGrid; import appeng.api.networking.storage.IStackWatcherHost; import appeng.me.GridNode; import appeng.me.energy.EnergyThreshold; @@ -108,11 +110,18 @@ public class EnergyGridCache implements IEnergyGrid Set gproviders = new LinkedHashSet(); final IGrid myGrid; + PathGridCache pgc; public EnergyGridCache(IGrid g) { myGrid = g; } + @MENetworkEventSubscribe + public void postInit(MENetworkPostCacheConstruction pcc) + { + pgc = myGrid.getCache( IPathingGrid.class ); + } + @MENetworkEventSubscribe public void EnergyNodeChanges(MENetworkPowerIdleChange ev) { @@ -491,7 +500,7 @@ public class EnergyGridCache implements IEnergyGrid @Override public double getIdlePowerUsage() { - return drainPerTick; + return drainPerTick + pgc.channelPowerUsage; } @Override diff --git a/me/cache/PathGridCache.java b/me/cache/PathGridCache.java index eac9cb7f..a444992e 100644 --- a/me/cache/PathGridCache.java +++ b/me/cache/PathGridCache.java @@ -52,6 +52,9 @@ public class PathGridCache implements IPathingGrid private HashSet semiOpen = new HashSet(); private HashSet closedList = new HashSet(); + public int channelsByBlocks = 0; + public double channelPowerUsage = 0.0; + public PathGridCache(IGrid g) { myGrid = g; } @@ -82,6 +85,8 @@ public class PathGridCache implements IPathingGrid int nodes = myGrid.getNodes().size(); ticksUntilReady = 20 + (nodes / 10); + channelsByBlocks = nodes * used; + channelPowerUsage = (double) channelsByBlocks / 128.0; myGrid.getPivot().beginVisition( new AdHocChannelUpdater( used ) ); } @@ -111,7 +116,7 @@ public class PathGridCache implements IPathingGrid closedList.add( gc ); open.add( gc ); 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; + channelPowerUsage = (double) channelsByBlocks / 128.0; myGrid.postEvent( new MENetworkBootingStatusChange() ); } } @@ -181,6 +187,7 @@ public class PathGridCache implements IPathingGrid // clean up... active.clear(); + channelsByBlocks = 0; updateNetwork = true; } diff --git a/me/pathfinding/PathSegment.java b/me/pathfinding/PathSegment.java index ad7d44c2..fa812eca 100644 --- a/me/pathfinding/PathSegment.java +++ b/me/pathfinding/PathSegment.java @@ -9,6 +9,7 @@ import java.util.Set; import appeng.api.networking.GridFlags; import appeng.api.networking.IGridMultiblock; import appeng.api.networking.IGridNode; +import appeng.me.cache.PathGridCache; 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.semiopen = semiopen; this.closed = closed; + pgc = myPGC; isDead = false; } @@ -101,6 +105,7 @@ public class PathSegment pi = start; while (pi != null) { + pgc.channelsByBlocks++; pi.incrementChannelCount( 1 ); pi = pi.getControllerRoute(); } @@ -122,6 +127,7 @@ public class PathSegment pi = start; while (pi != null) { + pgc.channelsByBlocks++; pi.incrementChannelCount( 1 ); pi = pi.getControllerRoute(); } diff --git a/parts/networking/PartCable.java b/parts/networking/PartCable.java index 78beea7e..6fde9f8a 100644 --- a/parts/networking/PartCable.java +++ b/parts/networking/PartCable.java @@ -50,7 +50,7 @@ public class PartCable extends AEBasePart implements IPartCable public PartCable(Class c, ItemStack is) { super( c, is ); - proxy.setIdlePowerUsage( 1.0 / 16.0 ); + proxy.setIdlePowerUsage( 0.0 ); proxy.myColor = AEColor.values()[((ItemPart) is.getItem()).varientOf( is.getItemDamage() )]; } diff --git a/recipes/handlers/Macerator.java b/recipes/handlers/Macerator.java index 5aaaafc7..d66b480d 100644 --- a/recipes/handlers/Macerator.java +++ b/recipes/handlers/Macerator.java @@ -8,6 +8,7 @@ import appeng.api.exceptions.RecipeError; import appeng.api.exceptions.RegistrationError; import appeng.api.recipes.ICraftHandler; import appeng.api.recipes.IIngredient; +import appeng.core.AELog; import appeng.core.AppEng; import appeng.integration.abstraction.IIC2; import appeng.recipes.RecipeHandler; @@ -42,20 +43,29 @@ public class Macerator implements ICraftHandler, IWebsiteSeralizer { IIC2 ic2 = (IIC2) AppEng.instance.getIntegration( "IC2" ); 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 - public boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError { - return Platform.isSameItemPrecise( pro_output[0].getItemStack(),output ); + public boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError + { + return Platform.isSameItemPrecise( pro_output[0].getItemStack(), output ); } @Override - public String getPattern( RecipeHandler h ) { - return "macerator\n"+ - h.getName(pro_input)+"\n"+ - h.getName(pro_output[0]); + public String getPattern(RecipeHandler h) + { + return null; } - + } diff --git a/recipes/handlers/Pulverizer.java b/recipes/handlers/Pulverizer.java index a6bf127f..fe749176 100644 --- a/recipes/handlers/Pulverizer.java +++ b/recipes/handlers/Pulverizer.java @@ -53,15 +53,15 @@ public class Pulverizer implements ICraftHandler, IWebsiteSeralizer } @Override - public boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError { - return Platform.isSameItemPrecise( pro_output[0].getItemStack(),output ); + public boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError + { + return Platform.isSameItemPrecise( pro_output[0].getItemStack(), output ); } @Override - public String getPattern( RecipeHandler h ) { - return "pulverizer\n"+ - h.getName(pro_input)+"\n"+ - h.getName(pro_output[0]); + public String getPattern(RecipeHandler h) + { + return null; } - + }