Display matter value for one item and stack at the same time
This commit is contained in:
parent
4a7fa4c089
commit
5eaa8adc6c
@ -271,6 +271,7 @@ private fun misc(provider: MatteryLanguageProvider) {
|
||||
misc("gui.matter.percentage_level", "Matter level: %s%%")
|
||||
misc("gui.matter.format", "Matter: %s")
|
||||
misc("gui.matter.format_and_complexity", "%s / Complexity: %s")
|
||||
misc("gui.matter.format_and_complexity2", "%s (%s) / Complexity: %s (%s)")
|
||||
misc("gui.matter.name", "MtU")
|
||||
|
||||
misc("gui.filter.is_whitelist", "Is Whitelist")
|
||||
|
@ -61,15 +61,15 @@ import ru.dbotthepony.mc.otm.SystemTime
|
||||
import ru.dbotthepony.mc.otm.capability.MatteryCapability
|
||||
import ru.dbotthepony.mc.otm.capability.drive.IMatteryDrive
|
||||
import ru.dbotthepony.mc.otm.client.minecraft
|
||||
import ru.dbotthepony.mc.otm.container.iterator
|
||||
import ru.dbotthepony.mc.otm.container.spliterator
|
||||
import ru.dbotthepony.mc.otm.container.stream
|
||||
import ru.dbotthepony.mc.otm.core.ImpreciseFraction
|
||||
import ru.dbotthepony.mc.otm.core.TextComponent
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.core.filterNotNull
|
||||
import ru.dbotthepony.mc.otm.core.formatMatter
|
||||
import ru.dbotthepony.mc.otm.core.formatMatterFull
|
||||
import ru.dbotthepony.mc.otm.core.formatSiComponent
|
||||
import ru.dbotthepony.mc.otm.core.formatTickDuration
|
||||
import ru.dbotthepony.mc.otm.core.ifPresentK
|
||||
import ru.dbotthepony.mc.otm.core.isActuallyEmpty
|
||||
import ru.dbotthepony.mc.otm.core.isZero
|
||||
@ -93,6 +93,7 @@ import kotlin.collections.ArrayList
|
||||
import kotlin.collections.HashMap
|
||||
import kotlin.collections.LinkedHashMap
|
||||
import kotlin.math.pow
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
internal sealed class MutableEntry(
|
||||
var matter: ImpreciseFraction,
|
||||
@ -1087,15 +1088,27 @@ object MatterManager {
|
||||
val window = minecraft.window.window
|
||||
|
||||
if (InputConstants.isKeyDown(window, GLFW.GLFW_KEY_LEFT_SHIFT) || InputConstants.isKeyDown(window, GLFW.GLFW_KEY_RIGHT_SHIFT)) {
|
||||
val matter = get(event.itemStack)
|
||||
val matter = get(event.itemStack, accountForStackSize = false)
|
||||
|
||||
if (matter.hasMatterValue) {
|
||||
if (matter.complexity >= 1.0E-3) {
|
||||
val matterSized = get(event.itemStack, accountForStackSize = true)
|
||||
|
||||
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(),
|
||||
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.complexity.formatSiComponent(TranslatableComponent("otm.gui.ticks"))
|
||||
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))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user