Cycle between full and si-prefixed matter values
This commit is contained in:
parent
a9fee2b527
commit
fea86d74ef
@ -79,6 +79,7 @@ import ru.dbotthepony.mc.otm.core.readItemType
|
||||
import ru.dbotthepony.mc.otm.core.registryName
|
||||
import ru.dbotthepony.mc.otm.core.stream
|
||||
import ru.dbotthepony.mc.otm.core.writeItemType
|
||||
import ru.dbotthepony.mc.otm.milliTime
|
||||
import ru.dbotthepony.mc.otm.network.MatteryPacket
|
||||
import ru.dbotthepony.mc.otm.network.RegistryNetworkChannel
|
||||
import ru.dbotthepony.mc.otm.registry.RegistryDelegate
|
||||
@ -86,6 +87,7 @@ import ru.dbotthepony.mc.otm.storage.ItemStackWrapper
|
||||
import java.io.File
|
||||
import java.math.BigInteger
|
||||
import java.util.*
|
||||
import java.util.function.BooleanSupplier
|
||||
import java.util.function.Supplier
|
||||
import java.util.stream.Stream
|
||||
import kotlin.ConcurrentModificationException
|
||||
@ -1085,6 +1087,8 @@ object MatterManager {
|
||||
return getResearchAdvance(this@MatterManager.get(stack.asItem()).complexity)
|
||||
}
|
||||
|
||||
private val formatMatterAsReadable = BooleanSupplier { minecraft.window.isShiftDown && milliTime % 2_000L > 1_000L }
|
||||
|
||||
fun tooltipEvent(event: ItemTooltipEvent) {
|
||||
if (minecraft.window.isShiftDown) {
|
||||
val matter = get(event.itemStack, accountForStackSize = false)
|
||||
@ -1096,20 +1100,20 @@ object MatterManager {
|
||||
if (matter.matter != matterSized.matter || matter.complexity != matterSized.complexity) {
|
||||
event.toolTip.add(
|
||||
TranslatableComponent("otm.gui.matter.format_and_complexity2",
|
||||
matter.matter.formatMatterFull(),
|
||||
matterSized.matter.formatMatter(),
|
||||
matter.matter.formatMatterFull(formatAsReadable = formatMatterAsReadable),
|
||||
matterSized.matter.formatMatter(formatAsReadable = formatMatterAsReadable),
|
||||
if (matter.complexity > 1000.0) formatTickDuration(matter.complexity.roundToInt(), true) else matter.complexity.formatSiComponent(TranslatableComponent("otm.gui.ticks")),
|
||||
if (matterSized.complexity > 1000.0) formatTickDuration(matterSized.complexity.roundToInt(), true) else matterSized.complexity.formatSiComponent(TranslatableComponent("otm.gui.ticks")),
|
||||
).withStyle(ChatFormatting.AQUA))
|
||||
} else {
|
||||
event.toolTip.add(
|
||||
TranslatableComponent("otm.gui.matter.format_and_complexity",
|
||||
matter.matter.formatMatterFull(),
|
||||
matter.matter.formatMatterFull(formatAsReadable = formatMatterAsReadable),
|
||||
if (matter.complexity > 1000.0) formatTickDuration(matter.complexity.roundToInt(), true) else matter.complexity.formatSiComponent(TranslatableComponent("otm.gui.ticks")),
|
||||
).withStyle(ChatFormatting.AQUA))
|
||||
}
|
||||
} else {
|
||||
event.toolTip.add(matter.matter.formatMatterFull().withStyle(ChatFormatting.AQUA))
|
||||
event.toolTip.add(matter.matter.formatMatterFull(formatAsReadable = formatMatterAsReadable).withStyle(ChatFormatting.AQUA))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user