From 7c60db4fbf6b67dc5144436d2387331219128d3c Mon Sep 17 00:00:00 2001 From: nea Date: Thu, 1 Jun 2023 23:10:09 +0200 Subject: Profile Viewer Skill Page v1 --- src/main/kotlin/moe/nea/firmament/gui/WBar.kt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/main/kotlin/moe/nea/firmament/gui/WBar.kt') diff --git a/src/main/kotlin/moe/nea/firmament/gui/WBar.kt b/src/main/kotlin/moe/nea/firmament/gui/WBar.kt index 879805d..04c5e3d 100644 --- a/src/main/kotlin/moe/nea/firmament/gui/WBar.kt +++ b/src/main/kotlin/moe/nea/firmament/gui/WBar.kt @@ -1,5 +1,6 @@ package moe.nea.firmament.gui +import com.mojang.blaze3d.systems.RenderSystem import io.github.cottonmc.cotton.gui.client.ScreenDrawing import io.github.cottonmc.cotton.gui.widget.WWidget import io.github.cottonmc.cotton.gui.widget.data.Texture @@ -7,17 +8,19 @@ import me.shedaniel.math.Color import net.minecraft.client.util.math.MatrixStack import moe.nea.firmament.Firmament -data class WBar( +open class WBar( var progress: Double, val total: Double, val fillColor: Color, val emptyColor: Color, ) : WWidget() { - val resource = Firmament.identifier("textures/gui/bar.png") - val left = Texture(resource, 0 / 64F, 0 / 64F, 4 / 64F, 8 / 64F) - val middle = Texture(resource, 4 / 64F, 0 / 64F, 4 / 64F, 8 / 64F) - val right = Texture(resource, 8 / 64F, 0 / 64F, 4 / 64F, 8 / 64F) - val segmentOverlay = Texture(resource, 12 / 64F, 0 / 64F, 15 / 64F, 8 / 64F) + companion object { + val resource = Firmament.identifier("textures/gui/bar.png") + val left = Texture(resource, 0 / 64F, 0 / 64F, 4 / 64F, 8 / 64F) + val middle = Texture(resource, 4 / 64F, 0 / 64F, 8 / 64F, 8 / 64F) + val right = Texture(resource, 8 / 64F, 0 / 64F, 12 / 64F, 8 / 64F) + val segmentOverlay = Texture(resource, 12 / 64F, 0 / 64F, 15 / 64F, 8 / 64F) + } override fun canResize(): Boolean { return true @@ -65,5 +68,6 @@ data class WBar( i += 4 } drawSection(matrices, right, x + width - 4, y, 4, (width - 4) * total / width, total) + RenderSystem.setShaderColor(1F, 1F, 1F, 1F) } } -- cgit