Merge branch 'master' of https://bitbucket.org/AlgorithmX2/appliedenergistics2 into rv1
This commit is contained in:
@@ -367,6 +367,13 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt
|
|||||||
|
|
||||||
if ( itemStack.getStackSize() > 0 )
|
if ( itemStack.getStackSize() > 0 )
|
||||||
{
|
{
|
||||||
|
// make sure strange things didn't happen...
|
||||||
|
if ( adaptor.simulateAdd( itemStack.getItemStack() ) != null )
|
||||||
|
{
|
||||||
|
changed = true;
|
||||||
|
throw new GridAccessException();
|
||||||
|
}
|
||||||
|
|
||||||
IAEItemStack aquired = Platform.poweredExtraction( src, destination, itemStack, mySrc );
|
IAEItemStack aquired = Platform.poweredExtraction( src, destination, itemStack, mySrc );
|
||||||
if ( aquired != null )
|
if ( aquired != null )
|
||||||
{
|
{
|
||||||
@@ -383,6 +390,14 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt
|
|||||||
|
|
||||||
long diff = toStore.getStackSize();
|
long diff = toStore.getStackSize();
|
||||||
|
|
||||||
|
// make sure strange things didn't happen...
|
||||||
|
ItemStack canExtract = adaptor.simulateRemove( (int) diff, toStore.getItemStack(), null );
|
||||||
|
if ( canExtract == null || canExtract.stackSize != diff )
|
||||||
|
{
|
||||||
|
changed = true;
|
||||||
|
throw new GridAccessException();
|
||||||
|
}
|
||||||
|
|
||||||
toStore = Platform.poweredInsert( src, destination, toStore, mySrc );
|
toStore = Platform.poweredInsert( src, destination, toStore, mySrc );
|
||||||
|
|
||||||
if ( toStore != null )
|
if ( toStore != null )
|
||||||
@@ -394,9 +409,9 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt
|
|||||||
changed = true;
|
changed = true;
|
||||||
ItemStack removed = adaptor.removeItems( (int) diff, null, null );
|
ItemStack removed = adaptor.removeItems( (int) diff, null, null );
|
||||||
if ( removed == null )
|
if ( removed == null )
|
||||||
throw new RuntimeException( "bad attempt at managing inventory. ( addItems )" );
|
throw new RuntimeException( "bad attempt at managing inventory. ( removeItems )" );
|
||||||
else if ( removed.stackSize != diff )
|
else if ( removed.stackSize != diff )
|
||||||
throw new RuntimeException( "bad attempt at managing inventory. ( addItems )" );
|
throw new RuntimeException( "bad attempt at managing inventory. ( removeItems )" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// else wtf?
|
// else wtf?
|
||||||
|
|||||||
@@ -21,10 +21,21 @@ public abstract class RedstoneFlux extends RotaryCraft implements IEnergyHandler
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
double overFlow = injectExternalPower( PowerUnits.RF, maxReceive );
|
int demand = (int) Math.floor( getExternalPowerDemand( PowerUnits.RF ) );
|
||||||
|
|
||||||
|
int ignored = 0;
|
||||||
|
int insertAmt = maxReceive;
|
||||||
|
|
||||||
|
if ( insertAmt > demand )
|
||||||
|
{
|
||||||
|
ignored = insertAmt - demand;
|
||||||
|
insertAmt = demand;
|
||||||
|
}
|
||||||
|
|
||||||
|
double overFlow = injectExternalPower( PowerUnits.RF, insertAmt );
|
||||||
double ox = Math.floor( overFlow );
|
double ox = Math.floor( overFlow );
|
||||||
internalCurrentPower += PowerUnits.RF.convertTo( PowerUnits.AE, overFlow - ox );
|
internalCurrentPower += PowerUnits.RF.convertTo( PowerUnits.AE, overFlow - ox );
|
||||||
return maxReceive - (int) ox;
|
return maxReceive - ((int) ox + ignored);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user