Fix energy counter setting ioLimit to not null when it is missing from nbt tag

This commit is contained in:
DBotThePony 2023-03-17 22:48:48 +07:00
parent 4c97c99ee6
commit 5b5c4de9f7
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -21,6 +21,7 @@ import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.core.math.getDecimal
import ru.dbotthepony.mc.otm.core.nbt.getByteArrayList
import ru.dbotthepony.mc.otm.core.nbt.map
import ru.dbotthepony.mc.otm.core.nbt.mapPresent
import ru.dbotthepony.mc.otm.core.nbt.set
import ru.dbotthepony.mc.otm.menu.tech.EnergyCounterMenu
import ru.dbotthepony.mc.otm.registry.MBlockEntities
@ -98,7 +99,7 @@ class EnergyCounterBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Mat
super.load(nbt)
passed = nbt.getDecimal(PASSED_ENERGY_KEY)
ioLimit = nbt.map(IO_LIMIT_KEY, Decimal.Companion::deserializeNBT)
ioLimit = nbt.mapPresent(IO_LIMIT_KEY, Decimal.Companion::deserializeNBT)
nbt.map(POWER_HISTORY_POINTER_KEY) { it: IntTag ->
historyTick = it.asInt