draw research and replication progress in pattern monitor
This commit is contained in:
parent
3b57dcb599
commit
ab7e416453
@ -1,6 +1,7 @@
|
||||
package ru.dbotthepony.mc.otm.client.screen.matter
|
||||
|
||||
import net.minecraft.ChatFormatting
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.components.EditBox
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.entity.player.Inventory
|
||||
@ -8,8 +9,7 @@ import net.minecraft.world.item.ItemStack
|
||||
import ru.dbotthepony.mc.otm.capability.matter.IPatternState
|
||||
import ru.dbotthepony.mc.otm.capability.matter.IReplicationTask
|
||||
import ru.dbotthepony.mc.otm.client.ShiftPressedCond
|
||||
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
|
||||
import ru.dbotthepony.mc.otm.client.render.Widgets18
|
||||
import ru.dbotthepony.mc.otm.client.render.*
|
||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.*
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.button.ButtonPanel
|
||||
@ -23,6 +23,7 @@ import ru.dbotthepony.mc.otm.client.screen.panels.util.DiscreteScrollBarPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.util.ScrollBarConstants
|
||||
import ru.dbotthepony.mc.otm.core.TextComponent
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.core.math.RGBAColor
|
||||
import ru.dbotthepony.mc.otm.core.math.integerDivisionDown
|
||||
import ru.dbotthepony.mc.otm.core.util.ItemSorter
|
||||
import ru.dbotthepony.mc.otm.core.util.formatMatter
|
||||
@ -177,6 +178,35 @@ class MatterPanelScreen(
|
||||
return list
|
||||
}
|
||||
|
||||
override fun renderRegular(graphics: GuiGraphics, itemstack: ItemStack, countOverride: String?) {
|
||||
if (isPatternView) {
|
||||
super.renderRegular(graphics, itemstack, "")
|
||||
|
||||
menu.patternsFiltered.getOrNull(index)?.let {
|
||||
if (it.researchPercent < 1f) {
|
||||
font.drawScaledAligned(graphics.pose(), graphics.bufferSource(), (it.researchPercent * 100.0).roundToInt().toString() + "%", .5f, RenderGravity.BOTTOM_RIGHT, width - 1f, height - 1f, true, color = RGBAColor.WHITE)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.renderRegular(graphics, itemstack, countOverride)
|
||||
|
||||
menu.tasksFiltered.getOrNull(index)?.let {
|
||||
val progress = it.finished.toFloat() / it.total.toFloat()
|
||||
val processing = it.inProgress.toFloat() / it.total.toFloat()
|
||||
|
||||
val barLeft = 2f
|
||||
val barTop = 2f
|
||||
val barWidth = width - 4f
|
||||
val barHeight = 1f
|
||||
|
||||
graphics.renderRect(barLeft - .5f, barTop - .5f, barWidth + 1f, barHeight + 1f, color = RGBAColor.WHITE)
|
||||
graphics.renderRect(barLeft, barTop, barWidth, barHeight, color = RGBAColor.BLACK)
|
||||
graphics.renderRect(barLeft, barTop, barWidth * progress, barHeight, color = RGBAColor.GREEN)
|
||||
graphics.renderRect(barLeft + barWidth * progress, barTop, barWidth * processing, barHeight, color = RGBAColor.YELLOW)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||
if (isPatternView) {
|
||||
if (minecraft?.player?.isSpectator != true)
|
||||
|
Loading…
Reference in New Issue
Block a user