From 14aba981b22726df2d646ee2ad1dbb1c12384aa2 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Sat, 7 Jun 2014 19:23:31 -0500 Subject: [PATCH] Tweaked Energy Flow Code for Network Acceptor, should be more what I'm looking for. --- block/grindstone/BlockGrinder.java | 3 ++- block/misc/BlockVibrationChamber.java | 1 + tile/networking/TileEnergyAcceptor.java | 10 ++++------ tile/powersink/IC2.java | 1 - tile/powersink/MinecraftJoules6.java | 4 ++++ 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/block/grindstone/BlockGrinder.java b/block/grindstone/BlockGrinder.java index 5b61ea27..f75cf057 100644 --- a/block/grindstone/BlockGrinder.java +++ b/block/grindstone/BlockGrinder.java @@ -19,6 +19,7 @@ public class BlockGrinder extends AEBaseBlock super( BlockGrinder.class, Material.rock ); setfeature( EnumSet.of( AEFeature.GrindStone ) ); setTileEntiy( TileGrinder.class ); + setHardness( 3.2F ); } @Override @@ -27,7 +28,7 @@ public class BlockGrinder extends AEBaseBlock TileGrinder tg = getTileEntity( w, x, y, z ); if ( tg != null && !p.isSneaking() ) { - Platform.openGUI( p, tg, ForgeDirection.getOrientation(side),GuiBridge.GUI_GRINDER ); + Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_GRINDER ); return true; } return false; diff --git a/block/misc/BlockVibrationChamber.java b/block/misc/BlockVibrationChamber.java index cb0f984a..4ae84a37 100644 --- a/block/misc/BlockVibrationChamber.java +++ b/block/misc/BlockVibrationChamber.java @@ -25,6 +25,7 @@ public class BlockVibrationChamber extends AEBaseBlock super( BlockVibrationChamber.class, Material.iron ); setfeature( EnumSet.of( AEFeature.PowerGen ) ); setTileEntiy( TileVibrationChamber.class ); + setHardness( 4.2F ); } @Override diff --git a/tile/networking/TileEnergyAcceptor.java b/tile/networking/TileEnergyAcceptor.java index 29a262fc..164c5e4e 100644 --- a/tile/networking/TileEnergyAcceptor.java +++ b/tile/networking/TileEnergyAcceptor.java @@ -77,12 +77,10 @@ public class TileEnergyAcceptor extends AENetworkPowerTile try { IEnergyGrid grid = gridProxy.getEnergy(); - double overFlow = grid.injectPower( newPower, Actionable.SIMULATE ); - - if ( mode == Actionable.MODULATE ) - grid.injectPower( Math.max( 0.0, newPower - overFlow ), Actionable.MODULATE ); - - return super.funnelPowerIntoStorage( overFlow, mode ); + double leftOver = grid.injectPower( newPower, mode ); + if ( mode == Actionable.SIMULATE ) + return leftOver; + return 0.0; } catch (GridAccessException e) { diff --git a/tile/powersink/IC2.java b/tile/powersink/IC2.java index 9f92355a..fd8f9e99 100644 --- a/tile/powersink/IC2.java +++ b/tile/powersink/IC2.java @@ -73,7 +73,6 @@ public abstract class IC2 extends MinecraftJoules6 implements IEnergySink super.setPowerSides( sides ); removeFromENet(); addToENet(); - } final private void addToENet() diff --git a/tile/powersink/MinecraftJoules6.java b/tile/powersink/MinecraftJoules6.java index bab841c3..3964b1e6 100644 --- a/tile/powersink/MinecraftJoules6.java +++ b/tile/powersink/MinecraftJoules6.java @@ -30,6 +30,10 @@ public abstract class MinecraftJoules6 extends MinecraftJoules5 implements IBatt @Method(iname = "MJ6") public double addEnergy(double amount) { + double demand = getExternalPowerDemand( PowerUnits.MJ, Double.MAX_VALUE ); + if ( amount > demand ) + amount = demand; + double overflow = injectExternalPower( PowerUnits.MJ, amount ); return amount - overflow; }