From f98a1f5d53792c026c3688fa89dea3e69910cb3a Mon Sep 17 00:00:00 2001 From: nea Date: Thu, 8 Jun 2023 00:11:46 +0200 Subject: Update to 1.20 - Remove some devenv mods that are not updated yet - Replace lib39 with fletchingtable for automixins - Use non kotlin entrypoints - Make use of DrawContext in a bunch of places --- src/main/kotlin/moe/nea/firmament/hud/RepoDownloadProgress.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/main/kotlin/moe/nea/firmament/hud') diff --git a/src/main/kotlin/moe/nea/firmament/hud/RepoDownloadProgress.kt b/src/main/kotlin/moe/nea/firmament/hud/RepoDownloadProgress.kt index 69e0384..827835a 100644 --- a/src/main/kotlin/moe/nea/firmament/hud/RepoDownloadProgress.kt +++ b/src/main/kotlin/moe/nea/firmament/hud/RepoDownloadProgress.kt @@ -25,6 +25,7 @@ import io.github.cottonmc.cotton.gui.widget.data.Insets import net.minecraft.client.util.math.MatrixStack import kotlin.math.roundToInt import kotlin.math.sin +import net.minecraft.client.gui.DrawContext val Insets.vertical get() = bottom + top @@ -49,8 +50,8 @@ class ProgressBar( } - override fun paint(matrices: MatrixStack, x: Int, y: Int, mouseX: Int, mouseY: Int) { - ScreenDrawing.coloredRect(matrices, x, y, width, height, 0xFF808080.toInt()) + override fun paint(context: DrawContext, x: Int, y: Int, mouseX: Int, mouseY: Int) { + ScreenDrawing.coloredRect(context, x, y, width, height, 0xFF808080.toInt()) val (l, prog) = synchronized(this) { label to (progress to total) } @@ -58,7 +59,7 @@ class ProgressBar( if (t == null) { ScreenDrawing.coloredRect( - matrices, + context, (x + (1 + sin(System.currentTimeMillis().toDouble() / 1000)) * width * 3 / 4 / 2).roundToInt(), y, width / 4, @@ -66,10 +67,10 @@ class ProgressBar( 0xFF00FF00.toInt() ) } else { - ScreenDrawing.coloredRect(matrices, x, y, width * p / t, height, 0xFF00FF00.toInt()) + ScreenDrawing.coloredRect(context, x, y, width * p / t, height, 0xFF00FF00.toInt()) } ScreenDrawing.drawString( - matrices, + context, if (t != null) "$l ($p/$t)" else l, HorizontalAlignment.CENTER, x + insets.left, -- cgit