From cd5f9dff2e9da7e04a6bdc7145402c524acf7937 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sun, 28 Jan 2024 23:23:21 +0700 Subject: [PATCH] Un-seal BlockEnergyStorageImpl --- .../capability/energy/BlockEnergyStorageImpl.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/energy/BlockEnergyStorageImpl.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/energy/BlockEnergyStorageImpl.kt index 997474504..a798bb3f6 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/capability/energy/BlockEnergyStorageImpl.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/capability/energy/BlockEnergyStorageImpl.kt @@ -13,13 +13,25 @@ import ru.dbotthepony.mc.otm.core.math.Decimal import ru.dbotthepony.mc.otm.core.nbt.mapPresent import ru.dbotthepony.mc.otm.core.nbt.set -sealed class BlockEnergyStorageImpl( +open class BlockEnergyStorageImpl( protected val listener: () -> Unit, final override val energyFlow: FlowDirection, private val maxBatteryLevelProvider: () -> Decimal, private val maxInputProvider: () -> Decimal?, private val maxOutputProvider: () -> Decimal?, ) : IMatteryEnergyStorage, INBTSerializable, IEnergyStorageImpl { + constructor( + listener: () -> Unit, + energyFlow: FlowDirection, + values: EnergyBalanceValues + ) : this(listener, energyFlow, values::energyCapacity, values::energyThroughput, values::energyThroughput) + + constructor( + listener: () -> Unit, + energyFlow: FlowDirection, + values: VerboseEnergyBalanceValues + ) : this(listener, energyFlow, values::energyCapacity, values::maxEnergyReceive, values::maxEnergyExtract) + private var maxInputStorage: Decimal? = null private var maxOutputStorage: Decimal? = null private var maxBatteryLevelStorage: Decimal? = null