Allow setting energy of itemenergystorageimpl
This commit is contained in:
parent
82448924be
commit
1a7f88211b
@ -37,9 +37,7 @@ abstract class ItemEnergyStorageImpl(val itemStack: ItemStack) : IMatteryEnergyS
|
|||||||
|
|
||||||
override var batteryLevel: Decimal
|
override var batteryLevel: Decimal
|
||||||
get() = itemStack.tag?.map(ENERGY_KEY, Decimal.Companion::deserializeNBT) ?: initialBatteryLevel
|
get() = itemStack.tag?.map(ENERGY_KEY, Decimal.Companion::deserializeNBT) ?: initialBatteryLevel
|
||||||
set(value) {
|
set(value) { itemStack.tagNotNull[ENERGY_KEY] = value.serializeNBT() }
|
||||||
itemStack.tagNotNull[ENERGY_KEY] = value.serializeNBT()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun extractEnergy(howMuch: Decimal, simulate: Boolean): Decimal {
|
override fun extractEnergy(howMuch: Decimal, simulate: Boolean): Decimal {
|
||||||
if (!howMuch.isPositive || itemStack.count != 1)
|
if (!howMuch.isPositive || itemStack.count != 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user