From e83121c77a908046d3a0bb84cf923e223043c48b Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Tue, 20 Jun 2023 19:23:53 +0700 Subject: [PATCH] a --- .../mc/otm/block/entity/tech/BatteryBankBlockEntity.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/BatteryBankBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/BatteryBankBlockEntity.kt index ec8a38a77..f444512cd 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/BatteryBankBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/BatteryBankBlockEntity.kt @@ -33,7 +33,7 @@ class BatteryBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Matte override fun setChanged(slot: Int, new: ItemStack, old: ItemStack) { super.setChanged(slot, new, old) batteryStatus[slot].boolean = new.getCapability(ForgeCapabilities.ENERGY).isPresent - gaugeLevel = (batteryLevel / maxBatteryLevel).toFloat() + gaugeLevel = batteryLevel.percentage(maxBatteryLevel) } }.also(::addDroppableContainer) @@ -87,9 +87,7 @@ class BatteryBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Matte if (!simulate && !summ.isZero) { setChangedLight() - gaugeLevel = (batteryLevel / maxBatteryLevel).toFloat() - } else if (!simulate && container.isEmpty) { - gaugeLevel = 0f + gaugeLevel = batteryLevel.percentage(maxBatteryLevel) } if (!simulate) {