aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/gui
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-06-08 00:11:46 +0200
committernea <nea@nea.moe>2023-06-08 00:11:46 +0200
commitf98a1f5d53792c026c3688fa89dea3e69910cb3a (patch)
tree873ee14abe51b1d229149c62f4958252026505fa /src/main/kotlin/moe/nea/firmament/gui
parentb65382a7b74836e13d8d9c9104971737288d1496 (diff)
downloadFirmament-f98a1f5d53792c026c3688fa89dea3e69910cb3a.tar.gz
Firmament-f98a1f5d53792c026c3688fa89dea3e69910cb3a.tar.bz2
Firmament-f98a1f5d53792c026c3688fa89dea3e69910cb3a.zip
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
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/gui')
-rw-r--r--src/main/kotlin/moe/nea/firmament/gui/WBar.kt15
-rw-r--r--src/main/kotlin/moe/nea/firmament/gui/profileviewer/PetsPage.kt8
2 files changed, 12 insertions, 11 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/gui/WBar.kt b/src/main/kotlin/moe/nea/firmament/gui/WBar.kt
index 04c5e3d..ed812ec 100644
--- a/src/main/kotlin/moe/nea/firmament/gui/WBar.kt
+++ b/src/main/kotlin/moe/nea/firmament/gui/WBar.kt
@@ -5,6 +5,7 @@ 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
import me.shedaniel.math.Color
+import net.minecraft.client.gui.DrawContext
import net.minecraft.client.util.math.MatrixStack
import moe.nea.firmament.Firmament
@@ -27,7 +28,7 @@ open class WBar(
}
private fun drawSection(
- matrices: MatrixStack,
+ context: DrawContext,
texture: Texture,
x: Int,
y: Int,
@@ -36,18 +37,18 @@ open class WBar(
sectionEnd: Double
) {
if (sectionEnd < progress && width == 4) {
- ScreenDrawing.texturedRect(matrices, x, y, 4, 8, texture, fillColor.color)
+ ScreenDrawing.texturedRect(context, x, y, 4, 8, texture, fillColor.color)
return
}
if (sectionStart > progress && width == 4) {
- ScreenDrawing.texturedRect(matrices, x, y, 4, 8, texture, emptyColor.color)
+ ScreenDrawing.texturedRect(context, x, y, 4, 8, texture, emptyColor.color)
return
}
val increasePerPixel = (sectionEnd - sectionStart / 4)
var valueAtPixel = sectionStart
for (i in (0 until width)) {
ScreenDrawing.texturedRect(
- matrices, x + i, y, 1, 8,
+ context, x + i, y, 1, 8,
texture.image, texture.u1 + i / 64F, texture.v1, texture.u1 + (i + 1) / 64F, texture.v2,
if (valueAtPixel < progress) fillColor.color else emptyColor.color
)
@@ -55,11 +56,11 @@ open class WBar(
}
}
- override fun paint(matrices: MatrixStack, x: Int, y: Int, mouseX: Int, mouseY: Int) {
+ override fun paint(context: DrawContext, x: Int, y: Int, mouseX: Int, mouseY: Int) {
var i = 0
while (i < width - 4) {
drawSection(
- matrices,
+ context,
if (i == 0) left else middle,
x + i, y,
(width - (i + 4)).coerceAtMost(4),
@@ -67,7 +68,7 @@ open class WBar(
)
i += 4
}
- drawSection(matrices, right, x + width - 4, y, 4, (width - 4) * total / width, total)
+ drawSection(context, right, x + width - 4, y, 4, (width - 4) * total / width, total)
RenderSystem.setShaderColor(1F, 1F, 1F, 1F)
}
}
diff --git a/src/main/kotlin/moe/nea/firmament/gui/profileviewer/PetsPage.kt b/src/main/kotlin/moe/nea/firmament/gui/profileviewer/PetsPage.kt
index 4c669df..62889bd 100644
--- a/src/main/kotlin/moe/nea/firmament/gui/profileviewer/PetsPage.kt
+++ b/src/main/kotlin/moe/nea/firmament/gui/profileviewer/PetsPage.kt
@@ -9,8 +9,8 @@ import io.github.cottonmc.cotton.gui.widget.WWidget
import io.github.cottonmc.cotton.gui.widget.data.Insets
import io.github.cottonmc.cotton.gui.widget.icon.Icon
import io.github.cottonmc.cotton.gui.widget.icon.ItemIcon
+import net.minecraft.client.gui.DrawContext
import net.minecraft.client.item.TooltipContext
-import net.minecraft.client.util.math.MatrixStack
import net.minecraft.item.Items
import net.minecraft.text.Text
import moe.nea.firmament.gui.WTightScrollPanel
@@ -27,9 +27,9 @@ object PetsPage : ProfilePage {
for ((i, pet) in profileViewer.member.pets.withIndex()) {
val stack = SBItemStack(pet.itemId, PetData(pet.tier, pet.type.name, pet.exp)).asItemStack()
it.add(object : WItem(stack) {
- override fun paint(matrices: MatrixStack?, x: Int, y: Int, mouseX: Int, mouseY: Int) {
- BackgroundPainter.SLOT.paintBackground(matrices, x, y, this)
- super.paint(matrices, x, y, mouseX, mouseY)
+ override fun paint(context: DrawContext?, x: Int, y: Int, mouseX: Int, mouseY: Int) {
+ BackgroundPainter.SLOT.paintBackground(context, x, y, this)
+ super.paint(context, x, y, mouseX, mouseY)
}
override fun addTooltip(tooltip: TooltipBuilder) {