Fix throughput on batteries being wrong if no si prefix is present

This commit is contained in:
DBotThePony 2022-09-04 18:07:12 +07:00
parent 0812ccf379
commit 8eee289020
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -43,7 +43,6 @@ class BatteryItem : Item {
val storage: ImpreciseFraction val storage: ImpreciseFraction
val receive: ImpreciseFraction val receive: ImpreciseFraction
val extract: ImpreciseFraction val extract: ImpreciseFraction
private val throughputText: Component
constructor(storage: ImpreciseFraction, receive: ImpreciseFraction, extract: ImpreciseFraction) : super( constructor(storage: ImpreciseFraction, receive: ImpreciseFraction, extract: ImpreciseFraction) : super(
Properties().stacksTo(1).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB) Properties().stacksTo(1).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)
@ -52,11 +51,6 @@ class BatteryItem : Item {
this.storage = storage this.storage = storage
this.receive = receive this.receive = receive
this.extract = extract 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)) { 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 storage = ImpreciseFraction.LONG_MAX_VALUE
receive = ImpreciseFraction.LONG_MAX_VALUE receive = ImpreciseFraction.LONG_MAX_VALUE
extract = ImpreciseFraction.LONG_MAX_VALUE extract = ImpreciseFraction.LONG_MAX_VALUE
throughputText = TranslatableComponent("otm.item.power.infinite.throughput").withStyle(ChatFormatting.GRAY)
} }
override fun appendHoverText( override fun appendHoverText(
@ -77,7 +70,7 @@ class BatteryItem : Item {
if (isCreative) { if (isCreative) {
p_41423_.add(INFINITE_STORAGE) p_41423_.add(INFINITE_STORAGE)
p_41423_.add(throughputText) p_41423_.add(TranslatableComponent("otm.item.power.infinite.throughput").withStyle(ChatFormatting.GRAY))
} else { } else {
stack.getCapability(MatteryCapability.ENERGY).ifPresentK { stack.getCapability(MatteryCapability.ENERGY).ifPresentK {
p_41423_.add( 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))
} }
} }