Missing commit due to fail PR/Reset PR/force push

This commit is contained in:
thatsIch 2014-12-05 22:53:34 +01:00
parent d54cf458b6
commit fb5764a409

View file

@ -29,33 +29,15 @@ public abstract class RedstoneFlux extends RotaryCraft implements IEnergyHandler
@Override
final public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate)
{
if ( simulate )
{
final int networkEnergyDemand = (int) Math.floor( this.getExternalPowerDemand( PowerUnits.RF, maxReceive ) );
final int maxEnergyStorage = this.getMaxEnergyStored( from );
final int currentEnergyStorage = this.getEnergyStored( from );
final int energyStorageBalance = maxEnergyStorage - currentEnergyStorage + networkEnergyDemand - maxReceive;
final int networkRFDemand = (int) Math.floor( this.getExternalPowerDemand( PowerUnits.RF, maxReceive ) );
final int usedRF = Math.min( maxReceive, networkRFDemand );
return Math.max( 0, energyStorageBalance );
}
else
if ( !simulate )
{
int demand = (int) Math.floor( this.getExternalPowerDemand( PowerUnits.RF, maxReceive ) );
int ignored = 0;
int insertAmt = maxReceive;
if ( insertAmt > demand )
{
ignored = insertAmt - demand;
insertAmt = demand;
this.internalCurrentPower += PowerUnits.RF.convertTo( PowerUnits.AE, usedRF );
}
double overFlow = this.injectExternalPower( PowerUnits.RF, insertAmt );
double ox = Math.floor( overFlow );
this.internalCurrentPower += PowerUnits.RF.convertTo( PowerUnits.AE, overFlow - ox );
return maxReceive - ((int) ox + ignored);
}
return usedRF;
}
@Override