Allow setting energy of itemenergystorageimpl

This commit is contained in:
DBotThePony 2023-05-06 13:18:36 +07:00
parent 82448924be
commit 1a7f88211b
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -37,9 +37,7 @@ abstract class ItemEnergyStorageImpl(val itemStack: ItemStack) : IMatteryEnergyS
override var batteryLevel: Decimal
get() = itemStack.tag?.map(ENERGY_KEY, Decimal.Companion::deserializeNBT) ?: initialBatteryLevel
set(value) {
itemStack.tagNotNull[ENERGY_KEY] = value.serializeNBT()
}
set(value) { itemStack.tagNotNull[ENERGY_KEY] = value.serializeNBT() }
override fun extractEnergy(howMuch: Decimal, simulate: Boolean): Decimal {
if (!howMuch.isPositive || itemStack.count != 1)