Missing commit due to fail PR/Reset PR/force push
This commit is contained in:
parent
d54cf458b6
commit
fb5764a409
1 changed files with 7 additions and 25 deletions
|
@ -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 networkRFDemand = (int) Math.floor( this.getExternalPowerDemand( PowerUnits.RF, maxReceive ) );
|
||||
final int usedRF = Math.min( maxReceive, networkRFDemand );
|
||||
|
||||
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;
|
||||
|
||||
return Math.max( 0, energyStorageBalance );
|
||||
}
|
||||
else
|
||||
{
|
||||
int demand = (int) Math.floor( this.getExternalPowerDemand( PowerUnits.RF, maxReceive ) );
|
||||
|
||||
int ignored = 0;
|
||||
int insertAmt = maxReceive;
|
||||
|
||||
if ( insertAmt > demand )
|
||||
{
|
||||
ignored = insertAmt - demand;
|
||||
insertAmt = demand;
|
||||
}
|
||||
|
||||
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);
|
||||
this.internalCurrentPower += PowerUnits.RF.convertTo( PowerUnits.AE, usedRF );
|
||||
}
|
||||
|
||||
return usedRF;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue