Mattery atlas, update all atlas assets
@ -28,7 +28,7 @@ import java.util.*
|
||||
import kotlin.math.ceil
|
||||
|
||||
object MatteryGUI {
|
||||
private val BARS = AtlasMatterySprite(ResourceLocation(OverdriveThatMatters.MOD_ID, "player_bars"), 80f, 36f)
|
||||
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)
|
||||
|
||||
|
@ -2,13 +2,20 @@ package ru.dbotthepony.mc.otm.client.render
|
||||
|
||||
import com.google.gson.JsonObject
|
||||
import com.mojang.blaze3d.systems.RenderSystem
|
||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat
|
||||
import com.mojang.blaze3d.vertex.PoseStack
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer
|
||||
import com.mojang.blaze3d.vertex.VertexFormat
|
||||
import net.minecraft.client.renderer.GameRenderer
|
||||
import net.minecraft.client.renderer.RenderStateShard
|
||||
import net.minecraft.client.renderer.RenderType
|
||||
import net.minecraft.network.FriendlyByteBuf
|
||||
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 {
|
||||
/**
|
||||
@ -305,4 +312,84 @@ sealed class AbstractMatterySprite {
|
||||
fun toNetwork(buff: FriendlyByteBuf) {
|
||||
type.toActualNetwork(this, buff)
|
||||
}
|
||||
|
||||
|
||||
val renderTypeNoDepth by lazy {
|
||||
noDepthCache.computeIfAbsent(texture) {
|
||||
val builder = RenderType.CompositeState.builder()
|
||||
|
||||
builder.setTextureState(RenderStateShard.TextureStateShard(it, false, false))
|
||||
builder.setShaderState(RenderStateShard.ShaderStateShard(GameRenderer::getPositionColorTexShader))
|
||||
builder.setDepthTestState(RenderStateShard.DepthTestStateShard("always", GL_ALWAYS))
|
||||
builder.setTransparencyState(RenderStateShard.TransparencyStateShard("normal_blend", {
|
||||
RenderSystem.enableBlend()
|
||||
RenderSystem.defaultBlendFunc()
|
||||
}, {
|
||||
RenderSystem.disableBlend()
|
||||
}))
|
||||
|
||||
@Suppress("INACCESSIBLE_TYPE")
|
||||
RenderType.create("otm_gui_element_no_depth",
|
||||
DefaultVertexFormat.POSITION_COLOR_TEX,
|
||||
VertexFormat.Mode.QUADS,
|
||||
2048,
|
||||
false,
|
||||
false,
|
||||
builder.createCompositeState(false)) as RenderType
|
||||
}
|
||||
}
|
||||
|
||||
val renderTypeDepth by lazy {
|
||||
depthCache.computeIfAbsent(texture) {
|
||||
val builder = RenderType.CompositeState.builder()
|
||||
|
||||
builder.setTextureState(RenderStateShard.TextureStateShard(it, false, false))
|
||||
builder.setShaderState(RenderStateShard.ShaderStateShard(GameRenderer::getPositionColorTexShader))
|
||||
builder.setTransparencyState(RenderStateShard.TransparencyStateShard("normal_blend", {
|
||||
RenderSystem.enableBlend()
|
||||
RenderSystem.defaultBlendFunc()
|
||||
}, {
|
||||
RenderSystem.disableBlend()
|
||||
}))
|
||||
|
||||
@Suppress("INACCESSIBLE_TYPE")
|
||||
RenderType.create("otm_gui_element_depth",
|
||||
DefaultVertexFormat.POSITION_COLOR_TEX,
|
||||
VertexFormat.Mode.QUADS,
|
||||
2048,
|
||||
false,
|
||||
false,
|
||||
builder.createCompositeState(false)) as RenderType
|
||||
}
|
||||
}
|
||||
|
||||
val renderTypeWorld by lazy {
|
||||
worldCache.computeIfAbsent(texture) {
|
||||
val builder = RenderType.CompositeState.builder()
|
||||
|
||||
builder.setTextureState(RenderStateShard.TextureStateShard(it, false, false))
|
||||
builder.setShaderState(RenderStateShard.ShaderStateShard(GameRenderer::getPositionColorTexShader))
|
||||
builder.setTransparencyState(RenderStateShard.TransparencyStateShard("normal_blend", {
|
||||
RenderSystem.enableBlend()
|
||||
RenderSystem.defaultBlendFunc()
|
||||
}, {
|
||||
RenderSystem.disableBlend()
|
||||
}))
|
||||
|
||||
@Suppress("INACCESSIBLE_TYPE")
|
||||
RenderType.create("otm_gui_element_world",
|
||||
DefaultVertexFormat.POSITION_COLOR_TEX,
|
||||
VertexFormat.Mode.QUADS,
|
||||
8192,
|
||||
false,
|
||||
false,
|
||||
builder.createCompositeState(false)) as RenderType
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val noDepthCache = ConcurrentHashMap<ResourceLocation, RenderType>()
|
||||
private val depthCache = ConcurrentHashMap<ResourceLocation, RenderType>()
|
||||
private val worldCache = ConcurrentHashMap<ResourceLocation, RenderType>()
|
||||
}
|
||||
}
|
||||
|
@ -143,9 +143,12 @@ class DynamicBufferSource(val minimalInitialBufferSize: Int = 0, val maximalInit
|
||||
next = State(RenderType.waterMask(), ImmutableList.of(next.type), true, false)
|
||||
it.add(next)
|
||||
|
||||
it.add(State(AtlasMatterySprite.renderTypeDepth, ImmutableList.of(RenderType.waterMask()), true))
|
||||
it.add(State(AtlasMatterySprite.renderTypeNoDepth, ImmutableList.of(RenderType.waterMask()), true))
|
||||
it.add(State(AtlasMatterySprite.renderTypeWorld, ImmutableList.of(Sheets.signSheet()), true))
|
||||
// TODO
|
||||
// it.add(State(AtlasMatterySprite.renderTypeDepth, ImmutableList.of(RenderType.waterMask()), true))
|
||||
// TODO
|
||||
// it.add(State(AtlasMatterySprite.renderTypeNoDepth, ImmutableList.of(RenderType.waterMask()), true))
|
||||
// TODO
|
||||
// it.add(State(AtlasMatterySprite.renderTypeWorld, ImmutableList.of(Sheets.signSheet()), true))
|
||||
}
|
||||
|
||||
private fun determineHeight(input: State, seen: MutableSet<State>) {
|
||||
|
@ -0,0 +1,24 @@
|
||||
package ru.dbotthepony.mc.otm.client.render
|
||||
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
|
||||
data class MatteryAtlas(
|
||||
val texture: ResourceLocation,
|
||||
val width: Float,
|
||||
val height: Float,
|
||||
val winding: UVWindingOrder = UVWindingOrder.NORMAL,
|
||||
) {
|
||||
fun subElement(
|
||||
x: Float = 0f,
|
||||
y: Float = 0f,
|
||||
width: Float = this.width,
|
||||
height: Float = this.height,
|
||||
winding: UVWindingOrder = this.winding,
|
||||
) = 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) = SkinGrid(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) = SkinGrid(texture, width, height, rows, columns)
|
||||
}
|
@ -41,8 +41,8 @@ data class MatterySprite @JvmOverloads constructor(
|
||||
val y: Float,
|
||||
override val width: Float,
|
||||
override val height: Float,
|
||||
val imageWidth: Float = 256f,
|
||||
val imageHeight: Float = 256f,
|
||||
val atlasWidth: Float = 256f,
|
||||
val atlasHeight: Float = 256f,
|
||||
override val winding: UVWindingOrder = UVWindingOrder.NORMAL,
|
||||
) : AbstractMatterySprite() {
|
||||
init {
|
||||
@ -50,18 +50,19 @@ data class MatterySprite @JvmOverloads constructor(
|
||||
require(y >= 0f) { "Invalid y $y" }
|
||||
require(width > 0f) { "Invalid width $width" }
|
||||
require(height > 0f) { "Invalid height $height" }
|
||||
require(imageWidth > 0f) { "Invalid image width $imageWidth" }
|
||||
require(imageHeight > 0f) { "Invalid image height $imageHeight" }
|
||||
require(atlasWidth > 0f) { "Invalid image width $atlasWidth" }
|
||||
require(atlasHeight > 0f) { "Invalid image height $atlasHeight" }
|
||||
|
||||
require(width <= imageWidth) { "$width <= $imageWidth" }
|
||||
require(height <= imageHeight) { "$height <= $imageHeight" }
|
||||
require(width <= atlasWidth) { "$width <= $atlasWidth" }
|
||||
require(height <= atlasHeight) { "$height <= $atlasHeight" }
|
||||
}
|
||||
|
||||
override val u0 = this.x / imageWidth
|
||||
override val v0 = this.y / imageHeight
|
||||
override val u1 = (this.x + width) / imageWidth
|
||||
override val v1 = (this.y + height) / imageHeight
|
||||
override val u0 = this.x / atlasWidth
|
||||
override val v0 = this.y / atlasHeight
|
||||
override val u1 = (this.x + width) / atlasWidth
|
||||
override val v1 = (this.y + height) / atlasHeight
|
||||
|
||||
override val type: SkinElementType
|
||||
get() = SkinElementType.SINGLE
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ object ResearchIcons {
|
||||
val KOT = ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/block/ph_kitty.png").element(0f, 0f, 32f, 32f, 32f, 32f)
|
||||
|
||||
init {
|
||||
val grid = SubSkinGrid(AtlasMatterySprite(ResourceLocation(OverdriveThatMatters.MOD_ID, "android_upgrades"), 126f, 126f), 18f, 18f, 7, 7)
|
||||
val grid = SkinGrid(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/android_upgrades.png"), 18f, 18f, 7, 7)
|
||||
|
||||
ICON_TRANSFER = grid.next()
|
||||
ICON_ATTACK_BOOST = grid.next()
|
||||
|
@ -18,8 +18,8 @@ enum class SkinElementType {
|
||||
it["y"] = JsonPrimitive(value.y)
|
||||
it["width"] = JsonPrimitive(value.width)
|
||||
it["height"] = JsonPrimitive(value.height)
|
||||
it["imageWidth"] = JsonPrimitive(value.imageWidth)
|
||||
it["imageHeight"] = JsonPrimitive(value.imageHeight)
|
||||
it["imageWidth"] = JsonPrimitive(value.atlasWidth)
|
||||
it["imageHeight"] = JsonPrimitive(value.atlasHeight)
|
||||
it["winding"] = JsonPrimitive(value.winding.name)
|
||||
}
|
||||
}
|
||||
@ -32,8 +32,8 @@ enum class SkinElementType {
|
||||
buff.writeFloat(value.y)
|
||||
buff.writeFloat(value.width)
|
||||
buff.writeFloat(value.height)
|
||||
buff.writeFloat(value.imageWidth)
|
||||
buff.writeFloat(value.imageHeight)
|
||||
buff.writeFloat(value.atlasWidth)
|
||||
buff.writeFloat(value.atlasHeight)
|
||||
buff.writeEnum(value.winding)
|
||||
}
|
||||
|
||||
@ -63,41 +63,6 @@ enum class SkinElementType {
|
||||
return MatterySprite(ResourceLocation.tryParse(texture) ?: throw JsonSyntaxException("Invalid resource location: $texture"), x, y, width, height, imageWidth, imageHeight, UVWindingOrder.valueOf(winding))
|
||||
}
|
||||
},
|
||||
ATLAS {
|
||||
override fun toJson(value: AbstractMatterySprite): JsonObject {
|
||||
require(value is AtlasMatterySprite) { "Invalid skin element provided, expected AtlasSkinElement, got ${value::class.qualifiedName}" }
|
||||
|
||||
return JsonObject().also {
|
||||
it["location"] = JsonPrimitive(value.location.toString())
|
||||
it["width"] = JsonPrimitive(value.width)
|
||||
it["height"] = JsonPrimitive(value.height)
|
||||
}
|
||||
}
|
||||
|
||||
override fun toNetwork(value: AbstractMatterySprite, buff: FriendlyByteBuf) {
|
||||
require(value is AtlasMatterySprite) { "Invalid skin element provided, expected AtlasSkinElement, got ${value::class.qualifiedName}" }
|
||||
|
||||
buff.writeResourceLocation(value.location)
|
||||
buff.writeFloat(value.width)
|
||||
buff.writeFloat(value.height)
|
||||
}
|
||||
|
||||
override fun fromNetwork(buff: FriendlyByteBuf): AbstractMatterySprite {
|
||||
val location = ResourceLocation(buff.readUtf())
|
||||
val width = buff.readFloat()
|
||||
val height = buff.readFloat()
|
||||
|
||||
return AtlasMatterySprite(location, width, height)
|
||||
}
|
||||
|
||||
override fun fromJson(element: JsonObject): AbstractMatterySprite {
|
||||
val location = element["location"]?.asString ?: throw JsonSyntaxException("Missing location element")
|
||||
val width = element["width"]?.asFloat ?: throw JsonSyntaxException("Missing width element")
|
||||
val height = element["height"]?.asFloat ?: throw JsonSyntaxException("Missing height element")
|
||||
|
||||
return AtlasMatterySprite(ResourceLocation.tryParse(location) ?: throw JsonSyntaxException("Invalid resource location: $location"), width, height)
|
||||
}
|
||||
},
|
||||
SUBELEMENT {
|
||||
override fun toJson(value: AbstractMatterySprite): JsonObject {
|
||||
require(value is SubMatterySprite) { "Invalid skin element provided, expected SubSkinElement, got ${value::class.qualifiedName}" }
|
||||
|
@ -13,8 +13,8 @@ data class SkinGrid(
|
||||
var row = 0
|
||||
var column = 0
|
||||
|
||||
val imageWidth get() = width * columns
|
||||
val imageHeight get() = height * rows
|
||||
val atlasWidth get() = width * columns
|
||||
val atlasHeight get() = height * rows
|
||||
|
||||
val currentX: Float get() = column * width
|
||||
val currentY: Float get() = row * height
|
||||
@ -36,7 +36,7 @@ data class SkinGrid(
|
||||
}
|
||||
|
||||
fun next(): MatterySprite {
|
||||
val element = MatterySprite(texture, currentX, currentY, width, height, imageWidth, imageHeight)
|
||||
val element = MatterySprite(texture, currentX, currentY, width, height, atlasWidth, atlasHeight)
|
||||
skip()
|
||||
return element
|
||||
}
|
||||
@ -54,5 +54,5 @@ data class SkinGrid(
|
||||
}
|
||||
|
||||
operator fun get(column: Int, row: Int) =
|
||||
MatterySprite(texture, column * width, row * height, width, height, imageWidth, imageHeight)
|
||||
MatterySprite(texture, column * width, row * height, width, height, atlasWidth, atlasHeight)
|
||||
}
|
||||
|
@ -9,34 +9,11 @@ class SubMatterySprite(
|
||||
override val width: Float = parent.width,
|
||||
override val height: Float = parent.height,
|
||||
private val overrideWinding: UVWindingOrder? = null
|
||||
) : AbstractMatterySprite.Mutable() {
|
||||
override var u0: Float = 0f
|
||||
private set
|
||||
override var v0: Float = 0f
|
||||
private set
|
||||
override var u1: Float = 0f
|
||||
private set
|
||||
override var v1: Float = 0f
|
||||
private set
|
||||
|
||||
private fun calculateUVs() {
|
||||
u0 = parent.u0 + (xOffset / parent.width) * (parent.u1 - parent.u0)
|
||||
v0 = parent.v0 + (yOffset / parent.height) * (parent.v1 - parent.v0)
|
||||
u1 = parent.u0 + ((xOffset + width) / parent.width) * (parent.u1 - parent.u0)
|
||||
v1 = parent.v0 + ((yOffset + height) / parent.height) * (parent.v1 - parent.v0)
|
||||
|
||||
notifyListeners()
|
||||
}
|
||||
|
||||
override fun parentChanges(parent: AbstractMatterySprite) = calculateUVs()
|
||||
|
||||
init {
|
||||
parent.addListener(this)
|
||||
}
|
||||
|
||||
init {
|
||||
calculateUVs()
|
||||
}
|
||||
) : AbstractMatterySprite() {
|
||||
override val u0 = parent.u0 + (xOffset / parent.width) * (parent.u1 - parent.u0)
|
||||
override val v0 = parent.v0 + (yOffset / parent.height) * (parent.v1 - parent.v0)
|
||||
override val u1 = parent.u0 + ((xOffset + width) / parent.width) * (parent.u1 - parent.u0)
|
||||
override val v1 = parent.v0 + ((yOffset + height) / parent.height) * (parent.v1 - parent.v0)
|
||||
|
||||
override val texture: ResourceLocation
|
||||
get() = parent.texture
|
||||
|
@ -6,11 +6,11 @@ import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
object WidgetLocation {
|
||||
val WIDGETS_18 = ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets_18.png")
|
||||
|
||||
val MISC = AtlasMatterySprite(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets/misc"), 64f, 64f)
|
||||
val PATTERN_PANEL_TABS = AtlasMatterySprite(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets/pattern_panel_tabs"), 64f, 32f)
|
||||
val MISC = MatteryAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets/misc.png"), 64f, 64f)
|
||||
val PATTERN_PANEL_TABS = MatteryAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets/pattern_panel_tabs.png"), 64f, 32f)
|
||||
|
||||
val CHECKBOX = AtlasMatterySprite(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets/checkbox"), 32f, 64f)
|
||||
val PROGRESS_ARROWS = AtlasMatterySprite(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets/progress_arrows"), 32f, 32f)
|
||||
val HORIZONTAL_GAUGES = AtlasMatterySprite(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets/horizontal_gauges"), 128f, 64f)
|
||||
val VERTICAL_GAUGES = AtlasMatterySprite(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets/vertical_gauges"), 128f, 48f)
|
||||
val CHECKBOX = MatteryAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets/checkbox.png"), 32f, 64f)
|
||||
val PROGRESS_ARROWS = MatteryAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets/progress_arrows.png"), 22f, 31f)
|
||||
val HORIZONTAL_GAUGES = MatteryAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets/horizontal_gauges.png"), 96f, 54f)
|
||||
val VERTICAL_GAUGES = MatteryAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets/vertical_gauges.png"), 90f, 48f)
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ object Widgets {
|
||||
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_DOWN_BUTTON_IDLE = ARROW_UP_BUTTON_IDLE.copy(overrideWinding = UVWindingOrder.FLIP)
|
||||
val ARROW_DOWN_BUTTON_HOVERED = ARROW_UP_BUTTON_HOVERED.copy(overrideWinding = UVWindingOrder.FLIP)
|
||||
val ARROW_DOWN_BUTTON_PRESSED = ARROW_UP_BUTTON_PRESSED.copy(overrideWinding = UVWindingOrder.FLIP)
|
||||
val ARROW_DOWN_BUTTON_DISABLED = ARROW_UP_BUTTON_DISABLED.copy(overrideWinding = UVWindingOrder.FLIP)
|
||||
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)
|
||||
val ARROW_DOWN_BUTTON_PRESSED = ARROW_UP_BUTTON_PRESSED.copy(winding = UVWindingOrder.FLIP)
|
||||
val ARROW_DOWN_BUTTON_DISABLED = ARROW_UP_BUTTON_DISABLED.copy(winding = UVWindingOrder.FLIP)
|
||||
}
|
||||
|
@ -5,15 +5,15 @@ private fun makeButton(grid: SkinGrid): StretchingRectangleElement {
|
||||
val y = grid.currentY
|
||||
|
||||
return StretchingRectangleElement(
|
||||
topLeft = WidgetLocation.WIDGETS_18.element(x, y, 2f, 2f, grid.imageWidth, grid.imageHeight),
|
||||
topRight = WidgetLocation.WIDGETS_18.element(x + 16f, y, 2f, 2f, grid.imageWidth, grid.imageHeight),
|
||||
bottomLeft = WidgetLocation.WIDGETS_18.element(x, y + 16f, 2f, 2f, grid.imageWidth, grid.imageHeight),
|
||||
bottomRight = WidgetLocation.WIDGETS_18.element(x + 16f, y + 16f, 2f, 2f, grid.imageWidth, grid.imageHeight),
|
||||
middle = WidgetLocation.WIDGETS_18.element(x + 2f, y + 2f, 14f, 14f, grid.imageWidth, grid.imageHeight),
|
||||
top = WidgetLocation.WIDGETS_18.element(x + 2f, y, 14f, 2f, grid.imageWidth, grid.imageHeight),
|
||||
left = WidgetLocation.WIDGETS_18.element(x, y + 2f, 2f, 14f, grid.imageWidth, grid.imageHeight),
|
||||
right = WidgetLocation.WIDGETS_18.element(x + 16f, y + 2f, 2f, 14f, grid.imageWidth, grid.imageHeight),
|
||||
bottom = WidgetLocation.WIDGETS_18.element(x + 2f, y + 16f, 14f, 2f, grid.imageWidth, grid.imageHeight),
|
||||
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),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ import net.minecraft.resources.ResourceLocation
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
|
||||
object Widgets8 {
|
||||
val GRID = AtlasMatterySprite(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets_8"), 64f, 32f).subGrid(8f, 8f, 64 / 8, 32 / 8)
|
||||
val GRID = SkinGrid(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets_8.png"), 8f, 8f, 64 / 8, 32 / 8)
|
||||
|
||||
val BUTTON_IDLE = GRID[0, 0]
|
||||
val BUTTON_HOVERED = GRID[0, 1]
|
||||
|
@ -52,7 +52,7 @@ abstract class BankRenderer<T : MatteryBlockEntity>(private val context: BlockEn
|
||||
val width = 9f
|
||||
val heightMax = 39.36f
|
||||
|
||||
val buffer = DynamicBufferSource.WORLD.getBuffer(AtlasMatterySprite.renderTypeWorld)
|
||||
val buffer = DynamicBufferSource.WORLD.getBuffer(texture.renderTypeWorld)
|
||||
|
||||
texture.uploadOntoPartialColor(
|
||||
stack,
|
||||
|
@ -2,30 +2,34 @@ 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
|
||||
|
||||
object ScrollBarConstants {
|
||||
const val WIDTH = 14f
|
||||
const val SLIM_WIDTH = 8f
|
||||
|
||||
val BACKGROUND = AtlasMatterySprite(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets/scrollbar/background"), 14f, 8f)
|
||||
val BACKGROUND_SLIM = AtlasMatterySprite(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets/scrollbar_slim/background"), 8f, 8f)
|
||||
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 TOP = BACKGROUND.subElement(height = 2f)
|
||||
val BODY = BACKGROUND.subElement(y = 2f, height = 5f)
|
||||
val BOTTOM = BACKGROUND.subElement(y = 6f, height = 2f)
|
||||
|
||||
val BUTTON = AtlasMatterySprite(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets/scrollbar/idle"), 12f, 15f)
|
||||
val BUTTON_HOVER = AtlasMatterySprite(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets/scrollbar/hovered"), 12f, 15f)
|
||||
val BUTTON_PRESS = AtlasMatterySprite(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets/scrollbar/pressed"), 12f, 15f)
|
||||
val BUTTON_DISABLED = AtlasMatterySprite(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets/scrollbar/disabled"), 12f, 15f)
|
||||
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 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_BUTTON = AtlasMatterySprite(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets/scrollbar_slim/idle"), 6f, 15f)
|
||||
val SLIM_BUTTON_HOVER = AtlasMatterySprite(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets/scrollbar_slim/hovered"), 6f, 15f)
|
||||
val SLIM_BUTTON_PRESS = AtlasMatterySprite(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets/scrollbar_slim/pressed"), 6f, 15f)
|
||||
val SLIM_BUTTON_DISABLED = AtlasMatterySprite(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets/scrollbar_slim/disabled"), 6f, 15f)
|
||||
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)
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ open class CheckBoxPanel<out S : Screen> @JvmOverloads constructor(
|
||||
val DISABLED_CHECKED: AbstractMatterySprite
|
||||
|
||||
init {
|
||||
val grid = WidgetLocation.CHECKBOX.subGrid(REGULAR_DIMENSIONS, REGULAR_DIMENSIONS, 2, 4)
|
||||
val grid = WidgetLocation.CHECKBOX.subGrid(columns = 2, rows = 4)
|
||||
|
||||
IDLE_UNCHECKED = grid.next()
|
||||
IDLE_CHECKED = grid.next()
|
||||
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 348 B After Width: | Height: | Size: 287 B |
Before Width: | Height: | Size: 838 B After Width: | Height: | Size: 817 B |
Before Width: | Height: | Size: 277 B After Width: | Height: | Size: 326 B |
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 481 B |
Before Width: | Height: | Size: 275 B After Width: | Height: | Size: 291 B |
After Width: | Height: | Size: 330 B |
Before Width: | Height: | Size: 165 B |
Before Width: | Height: | Size: 367 B |
Before Width: | Height: | Size: 373 B |
Before Width: | Height: | Size: 371 B |
Before Width: | Height: | Size: 373 B |
After Width: | Height: | Size: 322 B |
Before Width: | Height: | Size: 357 B |
Before Width: | Height: | Size: 398 B |
Before Width: | Height: | Size: 404 B |
Before Width: | Height: | Size: 403 B |
Before Width: | Height: | Size: 404 B |
Before Width: | Height: | Size: 494 B After Width: | Height: | Size: 887 B |