From e20fc1274cee102d69ce82a78d93ba0b55ab3f72 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Tue, 31 Jan 2023 15:56:46 +0700 Subject: [PATCH] Fix widgets --- .../ru/dbotthepony/mc/otm/client/MatteryGUI.kt | 2 +- .../mc/otm/client/render/MatteryAtlas.kt | 2 +- .../mc/otm/client/render/MatterySprite.kt | 4 ++-- .../mc/otm/client/render/WidgetLocation.kt | 2 +- .../mc/otm/client/render/Widgets8.kt | 2 +- .../textures/gui/player_bars.png | Bin 287 -> 290 bytes 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt index d94391adf..4d0eabd97 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt @@ -28,7 +28,7 @@ import java.util.* import kotlin.math.ceil object MatteryGUI { - private val BARS = MatteryAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/player_bars.png"), 80f, 35f) + private val BARS = MatteryAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/player_bars.png"), 80f, 36f) val CHARGE = BARS.sprite(height = 9f) val CHARGE_BG = BARS.sprite(y = 9f, height = 9f) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MatteryAtlas.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MatteryAtlas.kt index f0b8feab9..c6f0ab4db 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MatteryAtlas.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MatteryAtlas.kt @@ -22,6 +22,6 @@ data class MatteryAtlas( winding: UVWindingOrder = this.winding, ) = MatterySprite(texture, x = x, y = y, width = width, height = height, atlasHeight = this.height, atlasWidth = this.width, winding = winding) - fun grid(rows: Int, columns: Int) = GridAtlas(texture, this.width / rows, this.height / columns, rows = rows, columns = columns) + fun grid(rows: Int, columns: Int) = GridAtlas(texture, this.width / columns, this.height / rows, rows = rows, columns = columns) fun grid(width: Float, height: Float, rows: Int, columns: Int) = GridAtlas(texture, width, height, rows, columns) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MatterySprite.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MatterySprite.kt index 980a6f166..741654d4a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MatterySprite.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MatterySprite.kt @@ -53,8 +53,8 @@ data class MatterySprite @JvmOverloads constructor( require(atlasWidth > 0f) { "Invalid image width $atlasWidth" } require(atlasHeight > 0f) { "Invalid image height $atlasHeight" } - require(width <= atlasWidth) { "$width <= $atlasWidth" } - require(height <= atlasHeight) { "$height <= $atlasHeight" } + require(x + width <= atlasWidth) { "${x + width} <= $atlasWidth" } + require(y + height <= atlasHeight) { "${y + height} <= $atlasHeight" } } override val u0 = this.x / atlasWidth diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/WidgetLocation.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/WidgetLocation.kt index 44502c2a7..6caaabfee 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/WidgetLocation.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/WidgetLocation.kt @@ -6,7 +6,7 @@ import ru.dbotthepony.mc.otm.OverdriveThatMatters object WidgetLocation { val LARGE_BUTTON = MatteryAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets/large_button.png"), 72f, 18f) val STORAGE_CONTROLS = MatteryAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets/storage_controls.png"), 90f, 18f) - val MISC_18 = MatteryAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets/misc_18.png"), 72f, 72f) + val MISC_18 = MatteryAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets/misc18.png"), 72f, 72f) val SLOT_BACKGROUNDS = MatteryAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets/slot_backgrounds.png"), 72f, 72f) val MISC = MatteryAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets/misc.png"), 64f, 64f) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/Widgets8.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/Widgets8.kt index 035e66671..3a8f5ba75 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/Widgets8.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/Widgets8.kt @@ -4,7 +4,7 @@ import net.minecraft.resources.ResourceLocation import ru.dbotthepony.mc.otm.OverdriveThatMatters object Widgets8 { - val GRID = GridAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets_8.png"), 8f, 8f, 64 / 8, 32 / 8) + val GRID = GridAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets_8.png"), 8f, 8f, columns = 64 / 8, rows = 32 / 8) val BUTTON_IDLE = GRID[0, 0] val BUTTON_HOVERED = GRID[0, 1] diff --git a/src/main/resources/assets/overdrive_that_matters/textures/gui/player_bars.png b/src/main/resources/assets/overdrive_that_matters/textures/gui/player_bars.png index 9b2f9356737a3358d6535c530209d3251db056dc..dd0ef990b9d74087e9227312fdb572d697a895f2 100644 GIT binary patch delta 123 zcmbQww1{bfIF||s8v_G_+@ifz6BSJvw@(Z=WzyL^u}|Lcch53S#@pNe&N1=wI%z$@ zNFl}HM8gC|MP{dWjjOVMFh9Oi{`2FWBSri8pTGaS<+b$tiTC8x(A0Sx;a>MU|C!gq S1CN20FnGH9xvX$opqG1A~BD2#y=FsaO*pKae|LJjM=hGVbbN8QTUN?U?@t&NrtcRokOy$H5@fe}J UjvzB7b)XFlp00i_>zopr0F6j3WB>pF