From 8f675a8a021d147e9372e346b750249c066ab952 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Thu, 24 Nov 2022 16:45:40 +0700 Subject: [PATCH] Fix matter capacitor and matter dust having "no" matter value --- src/main/kotlin/ru/dbotthepony/mc/otm/item/MatterDustItem.kt | 2 +- src/main/kotlin/ru/dbotthepony/mc/otm/matter/IMatterItem.kt | 1 - src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterManager.kt | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatterDustItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatterDustItem.kt index 824b59b77..a16a1d1da 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatterDustItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatterDustItem.kt @@ -25,7 +25,7 @@ class MatterDustItem : Item(Properties().tab(OverdriveThatMatters.INSTANCE.CREAT override fun getMatterValue(stack: ItemStack): IMatterValue? { val value = stack.tag?.get("matter") ?: return null - return MatterValue(ImpreciseFraction.deserializeNBT(value), 0.0) + return MatterValue(ImpreciseFraction.deserializeNBT(value), 1.0) } override fun canDecompose(stack: ItemStack) = false diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/IMatterItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/IMatterItem.kt index 5e565891d..7fb79e208 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/IMatterItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/IMatterItem.kt @@ -4,6 +4,5 @@ import net.minecraft.world.item.ItemStack interface IMatterItem { fun getMatterValue(stack: ItemStack): IMatterValue? - fun hasMatterValue(stack: ItemStack) = getMatterValue(stack) != null fun canDecompose(stack: ItemStack): Boolean } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterManager.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterManager.kt index f6bf12a78..be8de7adf 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterManager.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterManager.kt @@ -997,7 +997,7 @@ object MatterManager { val matterCap = value.getCapability(MatteryCapability.MATTER).orNull() if (matterCap != null) { - matter = MatterValue(matter.matter + matterCap.storedMatter, matter.complexity) + matter = MatterValue(matter.matter + matterCap.storedMatter, matter.complexity.coerceAtLeast(1.0)) undamagedMatterValue = MatterValue(undamagedMatterValue.matter + matterCap.storedMatter, undamagedMatterValue.complexity) }