From 8eee289020b9f9a959ccb1f4e3bd044e5803e8f5 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sun, 4 Sep 2022 18:07:12 +0700 Subject: [PATCH] Fix throughput on batteries being wrong if no si prefix is present --- .../ru/dbotthepony/mc/otm/item/BatteryItem.kt | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/BatteryItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/BatteryItem.kt index 7065ae104..9c758fcab 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/BatteryItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/BatteryItem.kt @@ -43,7 +43,6 @@ class BatteryItem : Item { val storage: ImpreciseFraction val receive: ImpreciseFraction val extract: ImpreciseFraction - private val throughputText: Component constructor(storage: ImpreciseFraction, receive: ImpreciseFraction, extract: ImpreciseFraction) : super( Properties().stacksTo(1).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB) @@ -52,11 +51,6 @@ class BatteryItem : Item { this.storage = storage this.receive = receive this.extract = extract - throughputText = TranslatableComponent( - "otm.item.power.normal.throughput", - receive.formatPower(), - extract.formatPower() - ).withStyle(ChatFormatting.GRAY) } constructor() : super(Properties().stacksTo(1).rarity(Rarity.EPIC).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)) { @@ -64,7 +58,6 @@ class BatteryItem : Item { storage = ImpreciseFraction.LONG_MAX_VALUE receive = ImpreciseFraction.LONG_MAX_VALUE extract = ImpreciseFraction.LONG_MAX_VALUE - throughputText = TranslatableComponent("otm.item.power.infinite.throughput").withStyle(ChatFormatting.GRAY) } override fun appendHoverText( @@ -77,7 +70,7 @@ class BatteryItem : Item { if (isCreative) { p_41423_.add(INFINITE_STORAGE) - p_41423_.add(throughputText) + p_41423_.add(TranslatableComponent("otm.item.power.infinite.throughput").withStyle(ChatFormatting.GRAY)) } else { stack.getCapability(MatteryCapability.ENERGY).ifPresentK { p_41423_.add( @@ -89,7 +82,11 @@ class BatteryItem : Item { ) } - p_41423_.add(throughputText) + p_41423_.add(TranslatableComponent( + "otm.item.power.normal.throughput", + receive.formatPower(), + extract.formatPower() + ).withStyle(ChatFormatting.GRAY)) } }