Compare commits

...

5 Commits

7 changed files with 55 additions and 26 deletions

View File

@ -1,19 +1,17 @@
# Overdrive That Matters
Minecraft mod with science fiction style, about matter, and energy, combined.
Minecraft tech-oriented mod with science fiction style, about matter, and energy, combined.
### Required mods
* [Kotlin for Forge](https://www.curseforge.com/minecraft/mc-mods/kotlin-for-forge) or have Kotlin standard library in classpath (at least 1.8.0 is required)
* [Kotlin for Forge](https://www.curseforge.com/minecraft/mc-mods/kotlin-for-forge) or have Kotlin standard library in classpath (at least 2.0.0 is required)
### Recommended mods
* [Ferrite Core](https://www.curseforge.com/minecraft/mc-mods/ferritecore), reduces memory usage
* In case of Overdrive That Matters, ***greatly*** reduces JVM heap bloat caused by model data being duplicated
* Particle Collider, reduces world join time
### Mods with special compatibility code
* [JEI](https://www.curseforge.com/minecraft/mc-mods/jei)
@ -45,9 +43,9 @@ to avoid bloating git history with generated blobs.
## License
Unless otherwise stated in [NOTICE](NOTICE.md), material in mod is licensed under **2-Clause BSD**
Unless otherwise stated in [NOTICE](NOTICE.md), assets in mod are licensed under **2-Clause BSD**
Copyright 2021-Present DBotThePony, GearShocky, Overdrive That Matters Contributors
Copyright 2021-Present DBotThePony, GearShocky, YuRaNnNzZZ, Overdrive That Matters Contributors
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

View File

@ -362,6 +362,8 @@ private fun misc(provider: MatteryLanguageProvider) {
gui("progress_widget_stuck", "The machine can not work, check configuration")
gui("total_raw", "Total:")
gui("total", "Total: %s")
gui("total_approx", "Total: ~%s")
gui("matter.percentage_level", "Matter level: %s%%")
gui("matter.format", "Matter: %s")
@ -829,6 +831,13 @@ private fun gui(provider: MatteryLanguageProvider) {
with(provider.english) {
gui("ago", "%s ago")
gui("time.short.5s", "5s")
gui("time.short.15s", "15s")
gui("time.short.1m", "1m")
gui("time.short.1h", "1h")
gui("time.short.6h", "6h")
gui("time.short.24h", "24h")
gui("part_of_multiblock", "Part of multiblock structure, useless on its own")
gui("quicksearch", "Quick search...")

View File

@ -367,6 +367,8 @@ private fun misc(provider: MatteryLanguageProvider) {
gui("progress_widget_stuck", "Это устройство не может продолжить работу, проверьте конфигурацию")
gui("total_raw", "Всего:")
gui("total", "Всего: %s")
gui("total_approx", "Всего примерно: %s")
gui("matter.percentage_level", "Уровень материи: %s%%")
gui("matter.format", "Материя: %s")
@ -834,6 +836,13 @@ private fun gui(provider: MatteryLanguageProvider) {
with(provider.russian) {
gui("ago", "%s тому назад")
gui("time.short.5s", "5с")
gui("time.short.15s", "15с")
gui("time.short.1m", "")
gui("time.short.1h", "")
gui("time.short.6h", "")
gui("time.short.24h", "24ч")
gui("part_of_multiblock", "Часть мультиблока, бесполезен сам по себе")
gui("quicksearch", "Быстрый поиск...")

View File

@ -79,8 +79,8 @@ public final class OverdriveThatMatters {
}
private static void checkIfKotlinIsInstalled() {
if (!KotlinVersion.CURRENT.isAtLeast(1, 9, 0)) {
throw new UnsupportedClassVersionError("Installed kotlin version is " + KotlinVersion.CURRENT + ", when at least 1.9.0 is required.");
if (!KotlinVersion.CURRENT.isAtLeast(2, 0, 0)) {
throw new UnsupportedClassVersionError("Installed kotlin version is " + KotlinVersion.CURRENT + ", when at least 2.0.0 is required.");
}
}

View File

@ -17,7 +17,7 @@ import ru.dbotthepony.mc.otm.core.util.formatTickDuration
open class DecimalHistoryChartPanel<out S : MatteryScreen<*>>(
screen: S,
parent: EditablePanel<*>,
val graph: DecimalHistoryChart,
val chart: DecimalHistoryChart,
val formatText: (Decimal) -> Component = { TextComponent(it.toString(2)) },
x: Float = 0f,
y: Float = 0f,
@ -25,13 +25,13 @@ open class DecimalHistoryChartPanel<out S : MatteryScreen<*>>(
height: Float = 10f
) : EditablePanel<S>(screen, parent, x, y, width, height) {
override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
val maximum = graph.max()
val maximum = chart.max()
val normalized: FloatArray
val levelLabels: ChartLevelLabels
if (maximum.isZero || maximum.isInfinite) {
normalized = FloatArray(graph.width) {
if (graph[it].isInfinite) 0.8f else 0.0f
normalized = FloatArray(chart.width) {
if (chart[it].isInfinite) 0.8f else 0.0f
}
levelLabels = ChartLevelLabels(
@ -39,7 +39,7 @@ open class DecimalHistoryChartPanel<out S : MatteryScreen<*>>(
font = font
)
} else {
normalized = FloatArray(graph.width) { (graph[it] / maximum).toFloat() * 0.9f }
normalized = FloatArray(chart.width) { (chart[it] / maximum).toFloat() * 0.9f }
val map = Float2ObjectArrayMap<Component>()
@ -65,11 +65,24 @@ open class DecimalHistoryChartPanel<out S : MatteryScreen<*>>(
mouseX - absoluteX,
mouseY - absoluteY,
{
listOf(
formatText(graph[it]),
TextComponent(""),
TranslatableComponent("otm.gui.ago", formatTickDuration(it * graph.resolution, true))
)
val result = ArrayList<Component>()
result.add(formatText(chart[it]))
if (chart.resolution != 1 && chart[it].isFinite && chart[it].isNotZero) {
result.add(TranslatableComponent("otm.gui.total_approx", formatText(chart[it] * chart.resolution)))
}
result.add(TextComponent(""))
if (chart.resolution <= 20) {
result.add(TranslatableComponent("otm.gui.ago", formatTickDuration(it * chart.resolution, false)))
} else {
val useLongFormat = chart.resolution * chart.width / 20 > 99 * 60
result.add(TranslatableComponent("otm.gui.ago", formatTickDuration(it * chart.resolution, useLongFormat) + "-" + formatTickDuration((it + 1) * chart.resolution, useLongFormat)))
result.add(TextComponent("(${formatTickDuration(chart.resolution, useLongFormat)})"))
}
result
},
font,
),

View File

@ -12,7 +12,6 @@ import ru.dbotthepony.mc.otm.client.screen.panels.*
import ru.dbotthepony.mc.otm.client.screen.panels.button.ButtonPanel
import ru.dbotthepony.mc.otm.client.screen.panels.button.makeDeviceControls
import ru.dbotthepony.mc.otm.client.screen.panels.input.NetworkNumberInputPanel
import ru.dbotthepony.mc.otm.core.TextComponent
import ru.dbotthepony.mc.otm.core.util.formatPower
import ru.dbotthepony.mc.otm.menu.tech.EnergyCounterMenu
@ -24,16 +23,16 @@ class EnergyCounterScreen(menu: EnergyCounterMenu, inventory: Inventory, title:
frame.width += 60f
val graphs = linkedMapOf(
menu.history5s to "5s",
menu.history15s to "15s",
menu.history1m to "1m",
menu.history1h to "1h",
menu.history6h to "6h",
menu.history24h to "24h",
menu.history5s to "otm.gui.time.short.5s",
menu.history15s to "otm.gui.time.short.15s",
menu.history1m to "otm.gui.time.short.1m",
menu.history1h to "otm.gui.time.short.1h",
menu.history6h to "otm.gui.time.short.6h",
menu.history24h to "otm.gui.time.short.24h",
)
for ((graph, text) in graphs) {
val tab = frame.Tab(activeIcon = TextIcon(color = RGBAColor.BLACK, font = font, text = TextComponent(text)))
val tab = frame.Tab(activeIcon = TextIcon(color = RGBAColor.BLACK, font = font, text = TranslatableComponent(text)))
val panel = DecimalHistoryChartPanel(this, tab.canvas, graph, formatText = { it.formatPower(formatAsReadable = ShiftPressedCond) })
panel.dock = Dock.FILL
}

View File

@ -120,6 +120,7 @@ sealed class Decimal : Number(), Comparable<Decimal> {
* Whenever this Decimal is zero
*/
inline val isZero get() = signum() == 0
inline val isNotZero get() = signum() != 0
abstract val isInfinite: Boolean
abstract val isFinite: Boolean