Tweaked Energy Flow Code for Network Acceptor, should be more what I'm looking for.

This commit is contained in:
AlgorithmX2
2014-06-07 19:23:31 -05:00
parent 9ae4ce54d1
commit 14aba981b2
5 changed files with 11 additions and 8 deletions
+2 -1
View File
@@ -19,6 +19,7 @@ public class BlockGrinder extends AEBaseBlock
super( BlockGrinder.class, Material.rock ); super( BlockGrinder.class, Material.rock );
setfeature( EnumSet.of( AEFeature.GrindStone ) ); setfeature( EnumSet.of( AEFeature.GrindStone ) );
setTileEntiy( TileGrinder.class ); setTileEntiy( TileGrinder.class );
setHardness( 3.2F );
} }
@Override @Override
@@ -27,7 +28,7 @@ public class BlockGrinder extends AEBaseBlock
TileGrinder tg = getTileEntity( w, x, y, z ); TileGrinder tg = getTileEntity( w, x, y, z );
if ( tg != null && !p.isSneaking() ) 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 true;
} }
return false; return false;
+1
View File
@@ -25,6 +25,7 @@ public class BlockVibrationChamber extends AEBaseBlock
super( BlockVibrationChamber.class, Material.iron ); super( BlockVibrationChamber.class, Material.iron );
setfeature( EnumSet.of( AEFeature.PowerGen ) ); setfeature( EnumSet.of( AEFeature.PowerGen ) );
setTileEntiy( TileVibrationChamber.class ); setTileEntiy( TileVibrationChamber.class );
setHardness( 4.2F );
} }
@Override @Override
+4 -6
View File
@@ -77,12 +77,10 @@ public class TileEnergyAcceptor extends AENetworkPowerTile
try try
{ {
IEnergyGrid grid = gridProxy.getEnergy(); IEnergyGrid grid = gridProxy.getEnergy();
double overFlow = grid.injectPower( newPower, Actionable.SIMULATE ); double leftOver = grid.injectPower( newPower, mode );
if ( mode == Actionable.SIMULATE )
if ( mode == Actionable.MODULATE ) return leftOver;
grid.injectPower( Math.max( 0.0, newPower - overFlow ), Actionable.MODULATE ); return 0.0;
return super.funnelPowerIntoStorage( overFlow, mode );
} }
catch (GridAccessException e) catch (GridAccessException e)
{ {
-1
View File
@@ -73,7 +73,6 @@ public abstract class IC2 extends MinecraftJoules6 implements IEnergySink
super.setPowerSides( sides ); super.setPowerSides( sides );
removeFromENet(); removeFromENet();
addToENet(); addToENet();
} }
final private void addToENet() final private void addToENet()
+4
View File
@@ -30,6 +30,10 @@ public abstract class MinecraftJoules6 extends MinecraftJoules5 implements IBatt
@Method(iname = "MJ6") @Method(iname = "MJ6")
public double addEnergy(double amount) public double addEnergy(double amount)
{ {
double demand = getExternalPowerDemand( PowerUnits.MJ, Double.MAX_VALUE );
if ( amount > demand )
amount = demand;
double overflow = injectExternalPower( PowerUnits.MJ, amount ); double overflow = injectExternalPower( PowerUnits.MJ, amount );
return amount - overflow; return amount - overflow;
} }