Try to move as much as possible energy between energy storages
This commit is contained in:
parent
a65fb6d829
commit
b7434d632c
@ -351,7 +351,7 @@ fun moveBetweenSlots(source: IItemHandler, sourceSlot: Int, destination: IItemHa
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("name_shadowing")
|
@Suppress("name_shadowing")
|
||||||
fun moveEnergy(source: IEnergyStorage, destination: IEnergyStorage, amount: Decimal = Decimal.LONG_MAX_VALUE, simulate: Boolean, ignoreFlowRestrictions: Boolean = false): Decimal {
|
fun moveEnergy(source: IEnergyStorage, destination: IEnergyStorage, amount: Decimal = Decimal.LONG_MAX_VALUE.coerceAtLeast(source.energyStoredMattery), simulate: Boolean, ignoreFlowRestrictions: Boolean = false): Decimal {
|
||||||
val extracted = if (ignoreFlowRestrictions && source is IMatteryEnergyStorage) source.extractEnergy(amount, true) else source.extractEnergy(amount, true)
|
val extracted = if (ignoreFlowRestrictions && source is IMatteryEnergyStorage) source.extractEnergy(amount, true) else source.extractEnergy(amount, true)
|
||||||
|
|
||||||
if (extracted.isPositive) {
|
if (extracted.isPositive) {
|
||||||
|
Loading…
Reference in New Issue
Block a user