From 5b5c4de9f7bfd8952a2040f2bbb21a2ad7597b36 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Fri, 17 Mar 2023 22:48:48 +0700 Subject: [PATCH] Fix energy counter setting ioLimit to not null when it is missing from nbt tag --- .../mc/otm/block/entity/tech/EnergyCounterBlockEntity.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/EnergyCounterBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/EnergyCounterBlockEntity.kt index 3819c32bb..189ac1b99 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/EnergyCounterBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/EnergyCounterBlockEntity.kt @@ -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