More renames of element to sprite

This commit is contained in:
DBotThePony 2023-01-13 16:38:49 +07:00
parent ada06bda05
commit 6305886775
Signed by: DBot
GPG Key ID: DCC23B5715498507
27 changed files with 117 additions and 133 deletions

View File

@ -22,7 +22,7 @@ import net.minecraft.world.item.crafting.Ingredient
import net.minecraft.world.level.ItemLike
import net.minecraftforge.registries.ForgeRegistries
import ru.dbotthepony.mc.otm.client.render.AbstractMatterySprite
import ru.dbotthepony.mc.otm.client.render.SkinElementType
import ru.dbotthepony.mc.otm.client.render.SpriteType
import ru.dbotthepony.mc.otm.core.ListSet
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.core.isActuallyEmpty
@ -102,7 +102,7 @@ class AndroidResearchType(
val resolvedSkinIcon by lazy {
check(isClient) { "Invalid realm" }
if (skinIcon != null)
SkinElementType.fromJson(skinIcon)
SpriteType.fromJson(skinIcon)
else
null
}

View File

@ -34,7 +34,7 @@ import ru.dbotthepony.mc.otm.capability.extractEnergyInnerExact
import ru.dbotthepony.mc.otm.capability.matteryPlayer
import ru.dbotthepony.mc.otm.client.render.DynamicBufferSource
import ru.dbotthepony.mc.otm.client.render.ResearchIcons
import ru.dbotthepony.mc.otm.client.render.element
import ru.dbotthepony.mc.otm.client.render.sprite
import ru.dbotthepony.mc.otm.client.render.linesIgnoreZRenderType
import ru.dbotthepony.mc.otm.core.Vector
import ru.dbotthepony.mc.otm.core.asVector
@ -394,7 +394,7 @@ class EnderTeleporterFeature(capability: MatteryPlayerCapability) : AndroidActiv
private val SHAPE_CHECK_NOT_FENCE = Block.box(6.0, 17.0, 6.0, 10.0, 31.0, 10.0)
private val SHAPE_CHECK_SUPPORT_PLAYER = Block.box(6.0, 0.0, 6.0, 10.0, 16.0, 10.0)
val SPRITE = ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/item/black_hole.png").element(0f, 0f, 16f, 16f, 16f, 16f)
val SPRITE = ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/item/black_hole.png").sprite(0f, 0f, 16f, 16f, 16f, 16f)
val POWER_COST_DESCRIPTION =
AndroidResearchManager.descriptionFunc(

View File

@ -29,11 +29,11 @@ import kotlin.math.ceil
object MatteryGUI {
private val BARS = MatteryAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/player_bars.png"), 80f, 35f)
val CHARGE = BARS.subElement(height = 9f)
val CHARGE_BG = BARS.subElement(y = 9f, height = 9f)
val CHARGE = BARS.sprite(height = 9f)
val CHARGE_BG = BARS.sprite(y = 9f, height = 9f)
val CHARGE_HUNGER = BARS.subElement(y = 18f, height = 9f)
val CHARGE_HUNGER_BG = BARS.subElement(y = 27f, height = 9f)
val CHARGE_HUNGER = BARS.sprite(y = 18f, height = 9f)
val CHARGE_HUNGER_BG = BARS.sprite(y = 27f, height = 9f)
private var originalBedButtonX = -1
private var originalBedButtonY = -1

View File

@ -14,7 +14,6 @@ import net.minecraft.resources.ResourceLocation
import org.lwjgl.opengl.GL11.GL_ALWAYS
import ru.dbotthepony.mc.otm.core.RGBAColor
import ru.dbotthepony.mc.otm.core.linearInterpolation
import java.lang.ref.WeakReference
import java.util.concurrent.ConcurrentHashMap
sealed class AbstractMatterySprite {
@ -43,7 +42,7 @@ sealed class AbstractMatterySprite {
return v0 + (offset / height) * (v1 - v0)
}
abstract val type: SkinElementType
abstract val type: SpriteType
open val winding: UVWindingOrder get() = UVWindingOrder.NORMAL

View File

@ -8,7 +8,7 @@ data class MatteryAtlas(
val height: Float,
val winding: UVWindingOrder = UVWindingOrder.NORMAL,
) {
fun subElement(
fun sprite(
x: Float = 0f,
y: Float = 0f,
width: Float = this.width,
@ -17,8 +17,8 @@ data class MatteryAtlas(
) = MatterySprite(texture, x = x, y = y, width = width, height = height, atlasHeight = this.height, atlasWidth = this.width, winding = winding)
@Deprecated("Construct grid directly instead")
fun subGrid(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 / rows, this.height / columns, rows = rows, columns = columns)
@Deprecated("Construct grid directly instead")
fun subGrid(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

@ -2,7 +2,7 @@ package ru.dbotthepony.mc.otm.client.render
import net.minecraft.resources.ResourceLocation
fun ResourceLocation.element(
fun ResourceLocation.sprite(
x: Float,
y: Float,
width: Float,
@ -62,7 +62,7 @@ data class MatterySprite @JvmOverloads constructor(
override val u1 = (this.x + width) / atlasWidth
override val v1 = (this.y + height) / atlasHeight
override val type: SkinElementType
get() = SkinElementType.SINGLE
override val type: SpriteType
get() = SpriteType.SINGLE
}

View File

@ -31,7 +31,7 @@ object ResearchIcons {
val ICON_EXTENDED_REACH: AbstractMatterySprite
val ICON_PHANTOM_ATTRACTOR: AbstractMatterySprite
val KOT = ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/block/ph_kitty.png").element(0f, 0f, 32f, 32f, 32f, 32f)
val KOT = ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/block/ph_kitty.png").sprite(0f, 0f, 32f, 32f, 32f, 32f)
init {
val grid = GridAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/android_upgrades.png"), 18f, 18f, 7, 7)

View File

@ -7,7 +7,7 @@ import net.minecraft.network.FriendlyByteBuf
import net.minecraft.resources.ResourceLocation
import ru.dbotthepony.mc.otm.core.set
enum class SkinElementType {
enum class SpriteType {
SINGLE {
override fun toJson(value: AbstractMatterySprite): JsonObject {
require(value is MatterySprite) { "Invalid skin element provided, expected SkinElement, got ${value::class.qualifiedName}" }
@ -63,7 +63,7 @@ enum class SkinElementType {
return MatterySprite(ResourceLocation.tryParse(texture) ?: throw JsonSyntaxException("Invalid resource location: $texture"), x, y, width, height, imageWidth, imageHeight, UVWindingOrder.valueOf(winding))
}
},
SUBELEMENT {
SUBSPRITE {
override fun toJson(value: AbstractMatterySprite): JsonObject {
require(value is SubMatterySprite) { "Invalid skin element provided, expected SubSkinElement, got ${value::class.qualifiedName}" }
@ -125,12 +125,12 @@ enum class SkinElementType {
companion object {
fun fromNetwork(buff: FriendlyByteBuf): AbstractMatterySprite {
val type = buff.readEnum(SkinElementType::class.java)
val type = buff.readEnum(SpriteType::class.java)
return type.fromNetwork(buff)
}
fun fromJson(element: JsonObject): AbstractMatterySprite {
val type = SkinElementType.valueOf(element["type"].asString)
val type = SpriteType.valueOf(element["type"].asString)
return type.fromJson(element)
}
}

View File

@ -60,8 +60,8 @@ data class StretchingRectangleElement(
val padding = sideThickness - innerThickness
return StretchingRectangleElement(
topLeft = texture.element(x, y, cornerWidth, cornerHeight, imageWidth, imageHeight),
topRight = texture.element(
topLeft = texture.sprite(x, y, cornerWidth, cornerHeight, imageWidth, imageHeight),
topRight = texture.sprite(
x + width - cornerWidth,
y,
cornerWidth,
@ -69,7 +69,7 @@ data class StretchingRectangleElement(
imageWidth,
imageHeight
),
bottomLeft = texture.element(
bottomLeft = texture.sprite(
x,
y + height - cornerHeight,
cornerWidth,
@ -77,7 +77,7 @@ data class StretchingRectangleElement(
imageWidth,
imageHeight
),
bottomRight = texture.element(
bottomRight = texture.sprite(
x + width - cornerWidth,
y + height - cornerHeight,
cornerWidth,
@ -86,7 +86,7 @@ data class StretchingRectangleElement(
imageHeight
),
top = texture.element(
top = texture.sprite(
x + cornerWidth,
y,
width - cornerWidth * 2f,
@ -94,7 +94,7 @@ data class StretchingRectangleElement(
imageWidth,
imageHeight
),
bottom = texture.element(
bottom = texture.sprite(
x + cornerWidth,
y + height - sideThickness,
width - cornerWidth * 2f,
@ -102,8 +102,8 @@ data class StretchingRectangleElement(
imageWidth,
imageHeight
),
left = texture.element(x, y, sideThickness, height - cornerHeight * 2f, imageWidth, imageHeight),
right = texture.element(
left = texture.sprite(x, y, sideThickness, height - cornerHeight * 2f, imageWidth, imageHeight),
right = texture.sprite(
x,
y + width - sideThickness,
sideThickness,
@ -112,7 +112,7 @@ data class StretchingRectangleElement(
imageHeight
),
middle = texture.element(
middle = texture.sprite(
x + innerThickness,
y + innerThickness,
width - innerThickness * 2f,

View File

@ -18,8 +18,8 @@ class SubMatterySprite(
override val texture: ResourceLocation
get() = parent.texture
override val type: SkinElementType
get() = SkinElementType.SUBELEMENT
override val type: SpriteType
get() = SpriteType.SUBSPRITE
override val winding: UVWindingOrder
get() = overrideWinding ?: parent.winding
@ -33,7 +33,7 @@ class SubMatterySprite(
) = SubMatterySprite(parent, xOffset, yOffset, width, height, overrideWinding)
}
fun AbstractMatterySprite.subElement(
fun AbstractMatterySprite.sprite(
x: Float = 0f,
y: Float = 0f,
width: Float = this.width,

View File

@ -1,12 +1,12 @@
package ru.dbotthepony.mc.otm.client.render
object Widgets {
val SLOT = WidgetLocation.MISC.subElement(0f, 0f, 18f, 18f)
val SLOT = WidgetLocation.MISC.sprite(0f, 0f, 18f, 18f)
val ARROW_UP_BUTTON_IDLE = WidgetLocation.MISC.subElement(0f, 18f, 18f, 6f)
val ARROW_UP_BUTTON_HOVERED = WidgetLocation.MISC.subElement(0f, 18f + 6f, 18f, 6f)
val ARROW_UP_BUTTON_PRESSED = WidgetLocation.MISC.subElement(0f, 18f + 6f * 2f, 18f, 6f)
val ARROW_UP_BUTTON_DISABLED = WidgetLocation.MISC.subElement(0f, 18f + 6f * 3f, 18f, 6f)
val ARROW_UP_BUTTON_IDLE = WidgetLocation.MISC.sprite(0f, 18f, 18f, 6f)
val ARROW_UP_BUTTON_HOVERED = WidgetLocation.MISC.sprite(0f, 18f + 6f, 18f, 6f)
val ARROW_UP_BUTTON_PRESSED = WidgetLocation.MISC.sprite(0f, 18f + 6f * 2f, 18f, 6f)
val ARROW_UP_BUTTON_DISABLED = WidgetLocation.MISC.sprite(0f, 18f + 6f * 3f, 18f, 6f)
val ARROW_DOWN_BUTTON_IDLE = ARROW_UP_BUTTON_IDLE.copy(winding = UVWindingOrder.FLIP)
val ARROW_DOWN_BUTTON_HOVERED = ARROW_UP_BUTTON_HOVERED.copy(winding = UVWindingOrder.FLIP)

View File

@ -5,15 +5,15 @@ private fun makeButton(grid: GridAtlas): StretchingRectangleElement {
val y = grid.currentY
return StretchingRectangleElement(
topLeft = WidgetLocation.WIDGETS_18.element(x, y, 2f, 2f, grid.atlasWidth, grid.atlasHeight),
topRight = WidgetLocation.WIDGETS_18.element(x + 16f, y, 2f, 2f, grid.atlasWidth, grid.atlasHeight),
bottomLeft = WidgetLocation.WIDGETS_18.element(x, y + 16f, 2f, 2f, grid.atlasWidth, grid.atlasHeight),
bottomRight = WidgetLocation.WIDGETS_18.element(x + 16f, y + 16f, 2f, 2f, grid.atlasWidth, grid.atlasHeight),
middle = WidgetLocation.WIDGETS_18.element(x + 2f, y + 2f, 14f, 14f, grid.atlasWidth, grid.atlasHeight),
top = WidgetLocation.WIDGETS_18.element(x + 2f, y, 14f, 2f, grid.atlasWidth, grid.atlasHeight),
left = WidgetLocation.WIDGETS_18.element(x, y + 2f, 2f, 14f, grid.atlasWidth, grid.atlasHeight),
right = WidgetLocation.WIDGETS_18.element(x + 16f, y + 2f, 2f, 14f, grid.atlasWidth, grid.atlasHeight),
bottom = WidgetLocation.WIDGETS_18.element(x + 2f, y + 16f, 14f, 2f, grid.atlasWidth, grid.atlasHeight),
topLeft = WidgetLocation.WIDGETS_18.sprite(x, y, 2f, 2f, grid.atlasWidth, grid.atlasHeight),
topRight = WidgetLocation.WIDGETS_18.sprite(x + 16f, y, 2f, 2f, grid.atlasWidth, grid.atlasHeight),
bottomLeft = WidgetLocation.WIDGETS_18.sprite(x, y + 16f, 2f, 2f, grid.atlasWidth, grid.atlasHeight),
bottomRight = WidgetLocation.WIDGETS_18.sprite(x + 16f, y + 16f, 2f, 2f, grid.atlasWidth, grid.atlasHeight),
middle = WidgetLocation.WIDGETS_18.sprite(x + 2f, y + 2f, 14f, 14f, grid.atlasWidth, grid.atlasHeight),
top = WidgetLocation.WIDGETS_18.sprite(x + 2f, y, 14f, 2f, grid.atlasWidth, grid.atlasHeight),
left = WidgetLocation.WIDGETS_18.sprite(x, y + 2f, 2f, 14f, grid.atlasWidth, grid.atlasHeight),
right = WidgetLocation.WIDGETS_18.sprite(x + 16f, y + 2f, 2f, 14f, grid.atlasWidth, grid.atlasHeight),
bottom = WidgetLocation.WIDGETS_18.sprite(x + 2f, y + 16f, 14f, 2f, grid.atlasWidth, grid.atlasHeight),
)
}

View File

@ -6,7 +6,7 @@ import ru.dbotthepony.mc.otm.client.mousePos
import ru.dbotthepony.mc.otm.client.moveMousePosScaled
import ru.dbotthepony.mc.otm.client.render.Widgets18
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.client.render.element
import ru.dbotthepony.mc.otm.client.render.sprite
import ru.dbotthepony.mc.otm.client.screen.panels.*
import ru.dbotthepony.mc.otm.client.screen.panels.buttons.LargeRectangleButtonPanel
import ru.dbotthepony.mc.otm.client.setMousePos
@ -206,8 +206,8 @@ class ExoPackInventoryScreen(menu: ExoPackInventoryMenu) : MatteryScreen<ExoPack
}
companion object {
val ENTITY_RECTANGLE = INVENTORY_LOCATION.element(25f, 7f, 51f, 72f)
val CRAFT_ARROW = INVENTORY_LOCATION.element(135f, 29f, 16f, 13f)
val ENTITY_RECTANGLE = INVENTORY_LOCATION.sprite(25f, 7f, 51f, 72f)
val CRAFT_ARROW = INVENTORY_LOCATION.sprite(135f, 29f, 16f, 13f)
const val FRAME_BASE_HEIGHT = 126f
}

View File

@ -8,7 +8,6 @@ import net.minecraft.world.item.ItemStack
import ru.dbotthepony.mc.otm.capability.matter.IPatternState
import ru.dbotthepony.mc.otm.capability.matter.IReplicationTask
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
import ru.dbotthepony.mc.otm.client.render.subElement
import ru.dbotthepony.mc.otm.client.screen.panels.*
import ru.dbotthepony.mc.otm.client.screen.panels.buttons.ButtonPanel
import ru.dbotthepony.mc.otm.core.TranslatableComponent
@ -305,9 +304,9 @@ class MatterPanelScreen(
const val GRID_HEIGHT = 8
const val GRID_WIDTH = 9
val PATTERN_LIST_ACTIVE = WidgetLocation.PATTERN_PANEL_TABS.subElement(0f, 0f, 14f, 23f)
val TASK_LIST_ACTIVE = WidgetLocation.PATTERN_PANEL_TABS.subElement(28f, 0f, 16f, 16f)
val PATTERN_LIST_INACTIVE = WidgetLocation.PATTERN_PANEL_TABS.subElement(14f, 0f, 14f, 23f)
val TASK_LIST_INACTIVE = WidgetLocation.PATTERN_PANEL_TABS.subElement(44f, 0f, 16f, 16f)
val PATTERN_LIST_ACTIVE = WidgetLocation.PATTERN_PANEL_TABS.sprite(0f, 0f, 14f, 23f)
val TASK_LIST_ACTIVE = WidgetLocation.PATTERN_PANEL_TABS.sprite(28f, 0f, 16f, 16f)
val PATTERN_LIST_INACTIVE = WidgetLocation.PATTERN_PANEL_TABS.sprite(14f, 0f, 14f, 23f)
val TASK_LIST_INACTIVE = WidgetLocation.PATTERN_PANEL_TABS.sprite(44f, 0f, 16f, 16f)
}
}

View File

@ -112,6 +112,6 @@ abstract class AbstractSlotPanel<out S : MatteryScreen<*>> @JvmOverloads constru
val SLOT_HIGHLIGHT = RGBAColor(255, 255, 255, 100)
val SLOT_HIGHLIGHT_DRAG = RGBAColor(200, 200, 200, 150)
const val SIZE = 18f
val SLOT_BACKGROUND = WidgetLocation.MISC.subElement(0f, 0f, SIZE, SIZE)
val SLOT_BACKGROUND = WidgetLocation.MISC.sprite(0f, 0f, SIZE, SIZE)
}
}

View File

@ -2,12 +2,8 @@ package ru.dbotthepony.mc.otm.client.screen.panels
import com.mojang.blaze3d.vertex.PoseStack
import net.minecraft.client.gui.screens.Screen
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
import ru.dbotthepony.mc.otm.client.render.StretchingRectangleElement
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
import ru.dbotthepony.mc.otm.client.render.element
import ru.dbotthepony.mc.otm.client.render.subElement
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
open class BackgroundPanel<out S : Screen>(
screen: S,
@ -45,15 +41,15 @@ open class BackgroundPanel<out S : Screen>(
) = BackgroundPanel(screen, parent, x - 3f, y - 3f, width + 6f, height + 6f)
val RECTANGLE = StretchingRectangleElement(
topLeft = WidgetLocation.MISC.subElement(18f, 24f, 3f, 3f),
topRight = WidgetLocation.MISC.subElement(27f, 24f, 3f, 3f),
bottomLeft = WidgetLocation.MISC.subElement(18f, 33f, 3f, 3f),
bottomRight = WidgetLocation.MISC.subElement(27f, 33f, 3f, 3f),
top = WidgetLocation.MISC.subElement(21f, 24f, 6f, 2f),
bottom = WidgetLocation.MISC.subElement(21f, 34f, 6f, 2f),
left = WidgetLocation.MISC.subElement(18f, 27f, 2f, 6f),
right = WidgetLocation.MISC.subElement(28f, 27f, 2f, 6f),
middle = WidgetLocation.MISC.subElement(30f, 12f, 6f, 6f),
topLeft = WidgetLocation.MISC.sprite(18f, 24f, 3f, 3f),
topRight = WidgetLocation.MISC.sprite(27f, 24f, 3f, 3f),
bottomLeft = WidgetLocation.MISC.sprite(18f, 33f, 3f, 3f),
bottomRight = WidgetLocation.MISC.sprite(27f, 33f, 3f, 3f),
top = WidgetLocation.MISC.sprite(21f, 24f, 6f, 2f),
bottom = WidgetLocation.MISC.sprite(21f, 34f, 6f, 2f),
left = WidgetLocation.MISC.sprite(18f, 27f, 2f, 6f),
right = WidgetLocation.MISC.sprite(28f, 27f, 2f, 6f),
middle = WidgetLocation.MISC.sprite(30f, 12f, 6f, 6f),
padding = DockProperty(-1f, -1f, -1f, -1f)
)
}

View File

@ -14,7 +14,7 @@ import ru.dbotthepony.mc.otm.client.render.TextAlign
import ru.dbotthepony.mc.otm.client.render.determineTooltipPosition
import ru.dbotthepony.mc.otm.client.render.drawAligned
import ru.dbotthepony.mc.otm.client.render.drawScaledAligned
import ru.dbotthepony.mc.otm.client.render.element
import ru.dbotthepony.mc.otm.client.render.sprite
import ru.dbotthepony.mc.otm.client.render.render
import ru.dbotthepony.mc.otm.core.RGBAColor
import ru.dbotthepony.mc.otm.core.TranslatableComponent
@ -266,9 +266,9 @@ open class EffectListPanel<out S : Screen> @JvmOverloads constructor(
}
companion object {
val BAR = AbstractContainerScreen.INVENTORY_LOCATION.element(0f, 166f, 120f, 32f)
val SQUARE = AbstractContainerScreen.INVENTORY_LOCATION.element(0f, 198f, 32f, 32f)
val SQUARE_THIN = AbstractContainerScreen.INVENTORY_LOCATION.element(141f, 166f, 24f, 24f)
val SQUARE_THIN_HIGHLIGHT = AbstractContainerScreen.INVENTORY_LOCATION.element(165f, 166f, 24f, 24f)
val BAR = AbstractContainerScreen.INVENTORY_LOCATION.sprite(0f, 166f, 120f, 32f)
val SQUARE = AbstractContainerScreen.INVENTORY_LOCATION.sprite(0f, 198f, 32f, 32f)
val SQUARE_THIN = AbstractContainerScreen.INVENTORY_LOCATION.sprite(141f, 166f, 24f, 24f)
val SQUARE_THIN_HIGHLIGHT = AbstractContainerScreen.INVENTORY_LOCATION.sprite(165f, 166f, 24f, 24f)
}
}

View File

@ -8,7 +8,7 @@ import net.minecraft.world.entity.LivingEntity
import net.minecraft.world.entity.player.Player
import ru.dbotthepony.mc.otm.capability.matteryPlayer
import ru.dbotthepony.mc.otm.client.render.Widgets8
import ru.dbotthepony.mc.otm.client.render.element
import ru.dbotthepony.mc.otm.client.render.sprite
import ru.dbotthepony.mc.otm.client.screen.ExoPackInventoryScreen
import ru.dbotthepony.mc.otm.client.screen.panels.buttons.SmallBooleanRectangleButtonPanel
import ru.dbotthepony.mc.otm.compat.cos.CosmeticToggleRenderButton
@ -127,6 +127,6 @@ class EntityRendererPanel<out S : Screen> @JvmOverloads constructor(
}
companion object {
val ENTITY_RECTANGLE = AbstractContainerScreen.INVENTORY_LOCATION.element(25f, 7f, 51f, 72f)
val ENTITY_RECTANGLE = AbstractContainerScreen.INVENTORY_LOCATION.sprite(25f, 7f, 51f, 72f)
}
}

View File

@ -232,21 +232,21 @@ open class FramePanel<out S : Screen>(
const val PADDING_TOP = 14f
val RECTANGLE = StretchingRectangleElement(
topLeft = WidgetLocation.MISC.subElement(x = 18f, y = 0f, width = 6f, height = 6f),
topRight = WidgetLocation.MISC.subElement(x = 24f, y = 0f, width = 6f, height = 6f),
left = WidgetLocation.MISC.subElement(x = 18f, y = 4f, width = 3f, height = 5f),
right = WidgetLocation.MISC.subElement(x = 25f, y = 3f, width = 5f, height = 5f),
top = WidgetLocation.MISC.subElement(x = 22f, y = 0f, width = 5f, height = 3f),
bottomLeft = WidgetLocation.MISC.subElement(x = 18f, y = 6f, width = 6f, height = 6f),
bottomRight = WidgetLocation.MISC.subElement(x = 24f, y = 6f, width = 6f, height = 6f),
bottom = WidgetLocation.MISC.subElement(x = 21f, y = 9f, width = 5f, height = 3f),
middle = WidgetLocation.MISC.subElement(x = 30f, y = 12f, width = 6f, height = 6f),
topLeft = WidgetLocation.MISC.sprite(x = 18f, y = 0f, width = 6f, height = 6f),
topRight = WidgetLocation.MISC.sprite(x = 24f, y = 0f, width = 6f, height = 6f),
left = WidgetLocation.MISC.sprite(x = 18f, y = 4f, width = 3f, height = 5f),
right = WidgetLocation.MISC.sprite(x = 25f, y = 3f, width = 5f, height = 5f),
top = WidgetLocation.MISC.sprite(x = 22f, y = 0f, width = 5f, height = 3f),
bottomLeft = WidgetLocation.MISC.sprite(x = 18f, y = 6f, width = 6f, height = 6f),
bottomRight = WidgetLocation.MISC.sprite(x = 24f, y = 6f, width = 6f, height = 6f),
bottom = WidgetLocation.MISC.sprite(x = 21f, y = 9f, width = 5f, height = 3f),
middle = WidgetLocation.MISC.sprite(x = 30f, y = 12f, width = 6f, height = 6f),
padding = DockProperty(-3f, -3f, -3f, -3f)
)
val TAB_RIGHT_CONNECTION = WidgetLocation.MISC.subElement(x = 30f, y = 0f, width = 3f, height = 5f)
val TAB_LEFT_CONNECTION = WidgetLocation.MISC.subElement(x = 33f, y = 0f, width = 3f, height = 5f)
val TAB_BACKGROUND = WidgetLocation.MISC.subElement(x = 30f, y = 6f, width = 6f, height = 6f)
val TAB_RIGHT_CONNECTION = WidgetLocation.MISC.sprite(x = 30f, y = 0f, width = 3f, height = 5f)
val TAB_LEFT_CONNECTION = WidgetLocation.MISC.sprite(x = 33f, y = 0f, width = 3f, height = 5f)
val TAB_BACKGROUND = WidgetLocation.MISC.sprite(x = 30f, y = 6f, width = 6f, height = 6f)
const val TAB_HEIGHT = 28f
const val TAB_WIDTH = 28f

View File

@ -3,7 +3,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels
import net.minecraft.resources.ResourceLocation
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.client.render.MatteryAtlas
import ru.dbotthepony.mc.otm.client.render.subElement
import ru.dbotthepony.mc.otm.client.render.sprite
object ScrollBarConstants {
const val WIDTH = 14f
@ -12,24 +12,24 @@ object ScrollBarConstants {
val NORMAL_ATLAS = MatteryAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets/scrollbar.png"), 62f, 15f)
val SLIM_ATLAS = MatteryAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets/scrollbar_slim.png"), 32f, 15f)
val BACKGROUND = NORMAL_ATLAS.subElement(width = 14f, height = 8f)
val BACKGROUND_SLIM = SLIM_ATLAS.subElement(width = 8f, height = 8f)
val BACKGROUND = NORMAL_ATLAS.sprite(width = 14f, height = 8f)
val BACKGROUND_SLIM = SLIM_ATLAS.sprite(width = 8f, height = 8f)
val TOP = BACKGROUND.subElement(height = 2f)
val BODY = BACKGROUND.subElement(y = 2f, height = 5f)
val BOTTOM = BACKGROUND.subElement(y = 6f, height = 2f)
val TOP = BACKGROUND.sprite(height = 2f)
val BODY = BACKGROUND.sprite(y = 2f, height = 5f)
val BOTTOM = BACKGROUND.sprite(y = 6f, height = 2f)
val BUTTON = NORMAL_ATLAS.subElement(x = 15f, width = 12f)
val BUTTON_HOVER = NORMAL_ATLAS.subElement(x = 15f + 12f, width = 12f)
val BUTTON_PRESS = NORMAL_ATLAS.subElement(x = 15f + 12f * 2f, width = 12f)
val BUTTON_DISABLED = NORMAL_ATLAS.subElement(x = 15f + 12f * 3f, width = 12f)
val BUTTON = NORMAL_ATLAS.sprite(x = 15f, width = 12f)
val BUTTON_HOVER = NORMAL_ATLAS.sprite(x = 15f + 12f, width = 12f)
val BUTTON_PRESS = NORMAL_ATLAS.sprite(x = 15f + 12f * 2f, width = 12f)
val BUTTON_DISABLED = NORMAL_ATLAS.sprite(x = 15f + 12f * 3f, width = 12f)
val SLIM_TOP = BACKGROUND_SLIM.subElement(height = 2f)
val SLIM_BODY = BACKGROUND_SLIM.subElement(y = 2f, height = 5f)
val SLIM_BOTTOM = BACKGROUND_SLIM.subElement(y = 6f, height = 2f)
val SLIM_TOP = BACKGROUND_SLIM.sprite(height = 2f)
val SLIM_BODY = BACKGROUND_SLIM.sprite(y = 2f, height = 5f)
val SLIM_BOTTOM = BACKGROUND_SLIM.sprite(y = 6f, height = 2f)
val SLIM_BUTTON = SLIM_ATLAS.subElement(x = 9f, width = 6f)
val SLIM_BUTTON_HOVER = SLIM_ATLAS.subElement(x = 9f + 6f, width = 6f)
val SLIM_BUTTON_PRESS = SLIM_ATLAS.subElement(x = 9f + 6f * 2f, width = 6f)
val SLIM_BUTTON_DISABLED = SLIM_ATLAS.subElement(x = 9f + 6f * 3f, width = 6f)
val SLIM_BUTTON = SLIM_ATLAS.sprite(x = 9f, width = 6f)
val SLIM_BUTTON_HOVER = SLIM_ATLAS.sprite(x = 9f + 6f, width = 6f)
val SLIM_BUTTON_PRESS = SLIM_ATLAS.sprite(x = 9f + 6f * 2f, width = 6f)
val SLIM_BUTTON_DISABLED = SLIM_ATLAS.sprite(x = 9f + 6f * 3f, width = 6f)
}

View File

@ -6,7 +6,6 @@ import net.minecraft.client.gui.screens.Screen
import ru.dbotthepony.mc.otm.client.playGuiClickSound
import ru.dbotthepony.mc.otm.client.render.AbstractMatterySprite
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
import ru.dbotthepony.mc.otm.client.render.subGrid
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
open class CheckBoxPanel<out S : Screen> @JvmOverloads constructor(
@ -91,7 +90,7 @@ open class CheckBoxPanel<out S : Screen> @JvmOverloads constructor(
val DISABLED_CHECKED: AbstractMatterySprite
init {
val grid = WidgetLocation.CHECKBOX.subGrid(columns = 2, rows = 4)
val grid = WidgetLocation.CHECKBOX.grid(columns = 2, rows = 4)
IDLE_UNCHECKED = grid.next()
IDLE_CHECKED = grid.next()

View File

@ -4,8 +4,6 @@ import com.mojang.blaze3d.vertex.PoseStack
import net.minecraft.client.gui.screens.Screen
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
import ru.dbotthepony.mc.otm.client.render.element
import ru.dbotthepony.mc.otm.client.render.subElement
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
@ -45,11 +43,11 @@ open class HorizontalPowerGaugePanel<out S : Screen>(
}
companion object {
val GAUGE_BACKGROUND_TALL = WidgetLocation.HORIZONTAL_GAUGES.subElement(width = 96f, height = 18f)
val GAUGE_FOREGROUND_TALL = WidgetLocation.HORIZONTAL_GAUGES.subElement(y = 18f, width = 96f, height = 18f)
val GAUGE_BACKGROUND_TALL = WidgetLocation.HORIZONTAL_GAUGES.sprite(width = 96f, height = 18f)
val GAUGE_FOREGROUND_TALL = WidgetLocation.HORIZONTAL_GAUGES.sprite(y = 18f, width = 96f, height = 18f)
val GAUGE_BACKGROUND = WidgetLocation.HORIZONTAL_GAUGES.subElement(y = 36f, width = 96f, height = 9f)
val GAUGE_FOREGROUND = WidgetLocation.HORIZONTAL_GAUGES.subElement(y = 45f, width = 96f, height = 9f)
val GAUGE_BACKGROUND = WidgetLocation.HORIZONTAL_GAUGES.sprite(y = 36f, width = 96f, height = 9f)
val GAUGE_FOREGROUND = WidgetLocation.HORIZONTAL_GAUGES.sprite(y = 45f, width = 96f, height = 9f)
}
}

View File

@ -10,8 +10,6 @@ import net.minecraft.client.renderer.GameRenderer
import net.minecraft.network.chat.Component
import org.lwjgl.opengl.GL11
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
import ru.dbotthepony.mc.otm.client.render.element
import ru.dbotthepony.mc.otm.client.render.subElement
import ru.dbotthepony.mc.otm.client.render.tesselator
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
import ru.dbotthepony.mc.otm.core.TranslatableComponent
@ -118,7 +116,7 @@ open class MatterGaugePanel<S : Screen> @JvmOverloads constructor(
}
companion object {
val GAUGE_BACKGROUND = WidgetLocation.VERTICAL_GAUGES.subElement(x = 18f, width = 9f)
val GAUGE_FOREGROUND = WidgetLocation.VERTICAL_GAUGES.subElement(x = 27f, width = 9f)
val GAUGE_BACKGROUND = WidgetLocation.VERTICAL_GAUGES.sprite(x = 18f, width = 9f)
val GAUGE_FOREGROUND = WidgetLocation.VERTICAL_GAUGES.sprite(x = 27f, width = 9f)
}
}

View File

@ -3,10 +3,7 @@ package ru.dbotthepony.mc.otm.client.screen.widget
import com.mojang.blaze3d.vertex.PoseStack
import net.minecraft.client.gui.screens.Screen
import net.minecraft.network.chat.Component
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
import ru.dbotthepony.mc.otm.client.render.element
import ru.dbotthepony.mc.otm.client.render.subElement
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
@ -48,7 +45,7 @@ open class PatternGaugePanel<S : Screen> @JvmOverloads constructor(
}
companion object {
val GAUGE_BACKGROUND = WidgetLocation.VERTICAL_GAUGES.subElement(width = 9f)
val GAUGE_FOREGROUND = WidgetLocation.VERTICAL_GAUGES.subElement(x = 9f, width = 9f)
val GAUGE_BACKGROUND = WidgetLocation.VERTICAL_GAUGES.sprite(width = 9f)
val GAUGE_FOREGROUND = WidgetLocation.VERTICAL_GAUGES.sprite(x = 9f, width = 9f)
}
}

View File

@ -61,11 +61,11 @@ open class PowerGaugePanel<out S : Screen> @JvmOverloads constructor(
}
companion object {
val GAUGE_BACKGROUND = WidgetLocation.VERTICAL_GAUGES.subElement(x = 36f, width = 9f)
val GAUGE_FOREGROUND = WidgetLocation.VERTICAL_GAUGES.subElement(x = 45f, width = 9f)
val GAUGE_BACKGROUND = WidgetLocation.VERTICAL_GAUGES.sprite(x = 36f, width = 9f)
val GAUGE_FOREGROUND = WidgetLocation.VERTICAL_GAUGES.sprite(x = 45f, width = 9f)
val GAUGE_BACKGROUND_WIDE = WidgetLocation.VERTICAL_GAUGES.subElement(x = 54f, width = 18f)
val GAUGE_FOREGROUND_WIDE = WidgetLocation.VERTICAL_GAUGES.subElement(x = 72f, width = 18f)
val GAUGE_BACKGROUND_WIDE = WidgetLocation.VERTICAL_GAUGES.sprite(x = 54f, width = 18f)
val GAUGE_FOREGROUND_WIDE = WidgetLocation.VERTICAL_GAUGES.sprite(x = 72f, width = 18f)
}
}

View File

@ -7,8 +7,6 @@ import net.minecraft.client.gui.screens.Screen
import net.minecraft.network.chat.Component
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
import ru.dbotthepony.mc.otm.client.render.element
import ru.dbotthepony.mc.otm.client.render.subElement
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget
@ -80,7 +78,7 @@ open class ProgressGaugePanel<S : Screen> @JvmOverloads constructor(
}
companion object {
val GAUGE_BACKGROUND = WidgetLocation.PROGRESS_ARROWS.subElement(y = 0f, width = 22f, height = 15f)
val GAUGE_FOREGROUND = WidgetLocation.PROGRESS_ARROWS.subElement(y = 15f, width = 22f, height = 15f)
val GAUGE_BACKGROUND = WidgetLocation.PROGRESS_ARROWS.sprite(y = 0f, width = 22f, height = 15f)
val GAUGE_FOREGROUND = WidgetLocation.PROGRESS_ARROWS.sprite(y = 15f, width = 22f, height = 15f)
}
}

View File

@ -18,7 +18,7 @@ import net.minecraft.world.item.ItemStack
import net.minecraftforge.fml.ModList
import ru.dbotthepony.mc.otm.client.minecraft
import ru.dbotthepony.mc.otm.client.render.MatterySprite
import ru.dbotthepony.mc.otm.client.render.element
import ru.dbotthepony.mc.otm.client.render.sprite
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
import ru.dbotthepony.mc.otm.client.screen.panels.buttons.RectangleButtonPanel
import ru.dbotthepony.mc.otm.compat.cos.CosmeticToggleButton.Companion.BUTTON_ACTIVE
@ -185,8 +185,8 @@ class CosmeticToggleButton<out S : Screen>(
}
companion object {
val BUTTON_INACTIVE = GuiCosArmorInventory.TEXTURE.element(0f, 176f, 5f, 5f)
val BUTTON_ACTIVE = GuiCosArmorInventory.TEXTURE.element(5f, 176f, 5f, 5f)
val BUTTON_INACTIVE = GuiCosArmorInventory.TEXTURE.sprite(0f, 176f, 5f, 5f)
val BUTTON_ACTIVE = GuiCosArmorInventory.TEXTURE.sprite(5f, 176f, 5f, 5f)
}
}