@@ -5,12 +5,13 @@ import kotlinx.coroutines.GlobalScope
5
5
import kotlinx.coroutines.delay
6
6
import kotlinx.coroutines.launch
7
7
import net.minecraft.client.MinecraftClient
8
+ import net.minecraft.client.gui.DrawableHelper
8
9
import net.minecraft.client.gui.hud.BackgroundHelper.ColorMixer
9
- import net.minecraft.client.gui.screen.Screen
10
10
import net.minecraft.client.gui.screen.ScreenTexts
11
11
import net.minecraft.client.util.math.MatrixStack
12
12
import net.minecraft.text.LiteralText
13
13
import net.minecraft.text.Text
14
+ import net.minecraft.util.math.MathHelper
14
15
import xyz.deathsgun.modmanager.ModManager
15
16
import xyz.deathsgun.modmanager.api.gui.list.ListWidget
16
17
import xyz.deathsgun.modmanager.update.ProgressListener
@@ -43,13 +44,14 @@ class UpdateProgressListEntry(list: ListWidget<UpdateProgressListEntry>, val upd
43
44
tickDelta : Float
44
45
) {
45
46
val textRenderer = MinecraftClient .getInstance().textRenderer
46
- textRenderer.draw(matrices, update.mod.name, x.toFloat(), y + 1f , 0xFFFFFF )
47
- val nameWidth = textRenderer.getWidth(update.mod.name) + 5
47
+ val infoText = " ${update.mod.name} v${update.installedVersion} to ${update.version.version} "
48
+ textRenderer.draw(matrices, infoText, x.toFloat(), y + 1f , 0xFFFFFF )
49
+ val infoTextWidth = textRenderer.getWidth(infoText) + 5
48
50
if (progress == 1.0 ) {
49
- textRenderer.draw(matrices, ScreenTexts .DONE , (x + nameWidth ).toFloat(), y + 1f , 0xFFFFFF )
51
+ textRenderer.draw(matrices, ScreenTexts .DONE , (x + entryWidth - textRenderer.getWidth( ScreenTexts . DONE ) ).toFloat(), y + 1f , 0xFFFFFF )
50
52
return
51
53
}
52
- renderProgressBar(matrices, entryWidth - nameWidth , x + nameWidth , y, x + entryWidth, y + entryHeight)
54
+ renderProgressBar(matrices, entryWidth - infoTextWidth , x + infoTextWidth , y, x + entryWidth, y + entryHeight)
53
55
}
54
56
55
57
fun tick () {
@@ -70,11 +72,11 @@ class UpdateProgressListEntry(list: ListWidget<UpdateProgressListEntry>, val upd
70
72
if ((minX + pos) - maxX + 2 > 0 ) {
71
73
pos = 0
72
74
}
73
- Screen .fill(matrices, minX + 2 + pos, minY + 2 , minX + pos + barWidth, maxY - 2 , color)
74
- Screen .fill(matrices, minX + 1 , minY, maxX - 1 , minY + 1 , color)
75
- Screen .fill(matrices, minX + 1 , maxY, maxX - 1 , maxY - 1 , color)
76
- Screen .fill(matrices, minX, minY, minX + 1 , maxY, color)
77
- Screen .fill(matrices, maxX, minY, maxX - 1 , maxY, color)
75
+ DrawableHelper .fill(matrices, minX + 2 + pos, minY + 2 , minX + pos + barWidth, maxY - 2 , color)
76
+ DrawableHelper .fill(matrices, minX + 1 , minY, maxX - 1 , minY + 1 , color)
77
+ DrawableHelper .fill(matrices, minX + 1 , maxY, maxX - 1 , maxY - 1 , color)
78
+ DrawableHelper .fill(matrices, minX, minY, minX + 1 , maxY, color)
79
+ DrawableHelper .fill(matrices, maxX, minY, maxX - 1 , maxY, color)
78
80
}
79
81
80
82
override fun getNarration (): Text {
0 commit comments