Fix widgets

This commit is contained in:
DBotThePony 2023-01-31 15:56:46 +07:00
parent 6390857959
commit e20fc1274c
Signed by: DBot
GPG Key ID: DCC23B5715498507
6 changed files with 6 additions and 6 deletions

View File

@ -28,7 +28,7 @@ import java.util.*
import kotlin.math.ceil import kotlin.math.ceil
object MatteryGUI { 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 = BARS.sprite(height = 9f)
val CHARGE_BG = BARS.sprite(y = 9f, height = 9f) val CHARGE_BG = BARS.sprite(y = 9f, height = 9f)

View File

@ -22,6 +22,6 @@ data class MatteryAtlas(
winding: UVWindingOrder = this.winding, winding: UVWindingOrder = this.winding,
) = MatterySprite(texture, x = x, y = y, width = width, height = height, atlasHeight = this.height, atlasWidth = this.width, winding = 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) fun grid(width: Float, height: Float, rows: Int, columns: Int) = GridAtlas(texture, width, height, rows, columns)
} }

View File

@ -53,8 +53,8 @@ data class MatterySprite @JvmOverloads constructor(
require(atlasWidth > 0f) { "Invalid image width $atlasWidth" } require(atlasWidth > 0f) { "Invalid image width $atlasWidth" }
require(atlasHeight > 0f) { "Invalid image height $atlasHeight" } require(atlasHeight > 0f) { "Invalid image height $atlasHeight" }
require(width <= atlasWidth) { "$width <= $atlasWidth" } require(x + width <= atlasWidth) { "${x + width} <= $atlasWidth" }
require(height <= atlasHeight) { "$height <= $atlasHeight" } require(y + height <= atlasHeight) { "${y + height} <= $atlasHeight" }
} }
override val u0 = this.x / atlasWidth override val u0 = this.x / atlasWidth

View File

@ -6,7 +6,7 @@ import ru.dbotthepony.mc.otm.OverdriveThatMatters
object WidgetLocation { object WidgetLocation {
val LARGE_BUTTON = MatteryAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets/large_button.png"), 72f, 18f) 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 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 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) val MISC = MatteryAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets/misc.png"), 64f, 64f)

View File

@ -4,7 +4,7 @@ import net.minecraft.resources.ResourceLocation
import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.OverdriveThatMatters
object Widgets8 { 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_IDLE = GRID[0, 0]
val BUTTON_HOVERED = GRID[0, 1] val BUTTON_HOVERED = GRID[0, 1]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 287 B

After

Width:  |  Height:  |  Size: 290 B