diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/energy/IMatteryEnergyStorage.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/energy/IMatteryEnergyStorage.kt index 9f3853a0c..799f0a8ab 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/energy/IMatteryEnergyStorage.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/energy/IMatteryEnergyStorage.kt @@ -52,9 +52,7 @@ interface IMatteryEnergyStorage : IEnergyStorage { * @return energy extracted */ fun extractEnergyChecked(howMuch: Decimal, simulate: Boolean): Decimal { - require(!howMuch.isNegative) { "Negative amount of energy: $howMuch" } - - if (!energyFlow.output) + if (howMuch.isNegative || !energyFlow.output) return Decimal.ZERO return extractEnergy(howMuch, simulate) @@ -86,9 +84,7 @@ interface IMatteryEnergyStorage : IEnergyStorage { * @return energy extracted */ fun receiveEnergyChecked(howMuch: Decimal, simulate: Boolean): Decimal { - require(!howMuch.isNegative) { "Negative amount of energy: $howMuch" } - - if (!energyFlow.input) + if (howMuch.isNegative || !energyFlow.input) return Decimal.ZERO return receiveEnergy(howMuch, simulate)