Fix matter capacitor bank breaking when using creative capacitors

This commit is contained in:
DBotThePony 2024-01-12 16:44:16 +07:00
parent bfd3c89bbf
commit c988c4b869
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -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