diff options
| author | Linnea Gräf <nea@nea.moe> | 2025-11-17 19:55:02 +0100 |
|---|---|---|
| committer | Linnea Gräf <nea@nea.moe> | 2025-11-17 19:55:02 +0100 |
| commit | c93a04a001b0f66b2724d46b04b6d1ed49a08d07 (patch) | |
| tree | 5869ca70acc482ef0362f27785c3d3f1cbb9ffae /src/main/kotlin/gui/BarComponent.kt | |
| parent | af9893b59407c69d31ebd2ed513f0396ab4d2dc9 (diff) | |
| download | Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.tar.gz Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.tar.bz2 Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.zip | |
refactor: port to mojmaps
Diffstat (limited to 'src/main/kotlin/gui/BarComponent.kt')
| -rw-r--r-- | src/main/kotlin/gui/BarComponent.kt | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/main/kotlin/gui/BarComponent.kt b/src/main/kotlin/gui/BarComponent.kt index b144e0d..4c0a52d 100644 --- a/src/main/kotlin/gui/BarComponent.kt +++ b/src/main/kotlin/gui/BarComponent.kt @@ -6,9 +6,9 @@ import io.github.notenoughupdates.moulconfig.gui.GuiImmediateContext import io.github.notenoughupdates.moulconfig.observer.GetSetter import io.github.notenoughupdates.moulconfig.platform.MoulConfigRenderContext import me.shedaniel.math.Color -import net.minecraft.client.gl.RenderPipelines -import net.minecraft.client.gui.DrawContext -import net.minecraft.util.Identifier +import net.minecraft.client.renderer.RenderPipelines +import net.minecraft.client.gui.GuiGraphics +import net.minecraft.resources.ResourceLocation import moe.nea.firmament.Firmament class BarComponent( @@ -25,12 +25,12 @@ class BarComponent( } data class Texture( - val identifier: Identifier, - val u1: Float, val v1: Float, - val u2: Float, val v2: Float, + val identifier: ResourceLocation, + val u1: Float, val v1: Float, + val u2: Float, val v2: Float, ) { - fun draw(context: DrawContext, x: Int, y: Int, width: Int, height: Int, color: Color) { - context.drawTexturedQuad( + fun draw(context: GuiGraphics, x: Int, y: Int, width: Int, height: Int, color: Color) { + context.innerBlit( RenderPipelines.GUI_TEXTURED, identifier, x, y, x + width, x + height, @@ -49,13 +49,13 @@ class BarComponent( } private fun drawSection( - context: DrawContext, - texture: Texture, - x: Int, - y: Int, - width: Int, - sectionStart: Double, - sectionEnd: Double + context: GuiGraphics, + texture: Texture, + x: Int, + y: Int, + width: Int, + sectionStart: Double, + sectionEnd: Double ) { if (sectionEnd < progress.get() && width == 4) { texture.draw(context, x, y, 4, 8, fillColor) @@ -107,6 +107,6 @@ class BarComponent( } -fun Identifier.toMoulConfig(): MyResourceLocation { +fun ResourceLocation.toMoulConfig(): MyResourceLocation { return MyResourceLocation(this.namespace, this.path) } |
