From c988c4b86976d11777ceabd4fb73ded186dd7968 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Fri, 12 Jan 2024 16:44:16 +0700 Subject: [PATCH] Fix matter capacitor bank breaking when using creative capacitors --- .../block/entity/matter/MatterCapacitorBankBlockEntity.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterCapacitorBankBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterCapacitorBankBlockEntity.kt index b225e7f1a..c0fa77ad3 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterCapacitorBankBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterCapacitorBankBlockEntity.kt @@ -82,7 +82,7 @@ class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) } if (summ.isPositive && !simulate) { - gaugeLevel = (storedMatter / maxStoredMatter).toFloat() + gaugeLevel = storedMatter.percentage(maxStoredMatter) } return summ @@ -111,7 +111,7 @@ class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) } if (summ.isPositive && !simulate) { - gaugeLevel = (storedMatter / maxStoredMatter).toFloat() + gaugeLevel = storedMatter.percentage(maxStoredMatter) } return summ @@ -124,7 +124,7 @@ class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) override fun setChanged(slot: Int, new: ItemStack, old: ItemStack) { super.setChanged(slot, new, old) capacitorStatus[slot].boolean = new.getCapability(MatteryCapability.MATTER).isPresent - gaugeLevel = (storedMatter / maxStoredMatter).toFloat() + gaugeLevel = storedMatter.percentage(maxStoredMatter) } override fun getMaxStackSize(): Int = 1