Rename w, h to width, height in SkinElement

This commit is contained in:
DBotThePony 2022-09-09 15:43:30 +07:00
parent 56ec34097f
commit 53550f31f4
Signed by: DBot
GPG Key ID: DCC23B5715498507
13 changed files with 96 additions and 108 deletions

View File

@ -62,11 +62,11 @@ class SkinGrid(
fun ResourceLocation.element(
x: Float,
y: Float,
w: Float,
h: Float,
width: Float,
height: Float,
textureWidth: Float = 256f,
textureHeight: Float = 256f
) = SkinElement(this, x, y, w, h, textureWidth, textureHeight)
) = SkinElement(this, x, y, width, height, textureWidth, textureHeight)
fun ResourceLocation.pixel(
x: Float,
@ -96,16 +96,16 @@ class SkinElement @JvmOverloads constructor(
val texture: ResourceLocation,
val x: Float,
val y: Float,
val w: Float,
val h: Float,
val width: Float,
val height: Float,
val imageWidth: Float = 256f,
val imageHeight: Float = 256f
) {
init {
require(x >= 0f) { "Invalid x $x" }
require(y >= 0f) { "Invalid y $y" }
require(w > 0f) { "Invalid width $w" }
require(h > 0f) { "Invalid height $h" }
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" }
}
@ -115,8 +115,8 @@ class SkinElement @JvmOverloads constructor(
stack: PoseStack,
x: Float = 0f,
y: Float = 0f,
width: Float = w,
height: Float = h,
width: Float = this.width,
height: Float = this.height,
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1
) {
RenderSystem.setShaderTexture(0, texture)
@ -131,8 +131,8 @@ class SkinElement @JvmOverloads constructor(
stack: PoseStack,
x: Double,
y: Double = 0.0,
width: Double = w.toDouble(),
height: Double = h.toDouble(),
width: Double = this.width.toDouble(),
height: Double = this.height.toDouble(),
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1
) = render(stack, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), winding)
@ -141,8 +141,8 @@ class SkinElement @JvmOverloads constructor(
stack: PoseStack,
x: Float = 0f,
y: Float = 0f,
width: Float = w,
height: Float = h,
width: Float = this.width,
height: Float = this.height,
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1
) {
RenderSystem.setShaderTexture(0, texture)
@ -157,8 +157,8 @@ class SkinElement @JvmOverloads constructor(
stack: PoseStack,
x: Double,
y: Double = 0.0,
width: Double = w.toDouble(),
height: Double = h.toDouble(),
width: Double = this.width.toDouble(),
height: Double = this.height.toDouble(),
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1
) = renderPartial(stack, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), winding)
@ -167,7 +167,7 @@ class SkinElement @JvmOverloads constructor(
stack: PoseStack,
x: Float = 0f,
y: Float = 0f,
width: Float = w,
width: Float = this.width,
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1,
) {
render(stack, x, y, width = width, winding = winding)
@ -178,7 +178,7 @@ class SkinElement @JvmOverloads constructor(
stack: PoseStack,
x: Double,
y: Double = 0.0,
width: Double = w.toDouble(),
width: Double = this.width.toDouble(),
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1,
) = renderW(stack, x.toFloat(), y.toFloat(), width.toFloat(), winding)
@ -187,7 +187,7 @@ class SkinElement @JvmOverloads constructor(
stack: PoseStack,
x: Float = 0f,
y: Float = 0f,
height: Float = h,
height: Float = this.height,
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1,
) {
render(stack, x, y, height = height, winding = winding)
@ -198,22 +198,22 @@ class SkinElement @JvmOverloads constructor(
stack: PoseStack,
x: Double,
y: Double = 0.0,
height: Double = h.toDouble(),
height: Double = this.height.toDouble(),
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1,
) = renderH(stack, x.toFloat(), y.toFloat(), height.toFloat(), winding)
private val u0 = this.x / imageWidth
private val v0 = this.y / imageHeight
private val u1 = (this.x + w) / imageWidth
private val v1 = (this.y + h) / imageHeight
private val u1 = (this.x + width) / imageWidth
private val v1 = (this.y + height) / imageHeight
@JvmOverloads
fun renderRaw(
stack: PoseStack,
x: Float = 0f,
y: Float = 0f,
width: Float = w,
height: Float = h,
width: Float = this.width,
height: Float = this.height,
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1
) {
val winded = winding.translate(u0, v0, u1, v1)
@ -233,8 +233,8 @@ class SkinElement @JvmOverloads constructor(
stack: PoseStack,
x: Double,
y: Double = 0.0,
width: Double = w.toDouble(),
height: Double = h.toDouble(),
width: Double = this.width.toDouble(),
height: Double = this.height.toDouble(),
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1
) = renderRaw(stack, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), winding)
@ -243,8 +243,8 @@ class SkinElement @JvmOverloads constructor(
stack: PoseStack,
x: Float = 0f,
y: Float = 0f,
width: Float = w,
height: Float = h,
width: Float = this.width,
height: Float = this.height,
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1
) {
val u1 = (this.x + width) / imageWidth
@ -267,8 +267,8 @@ class SkinElement @JvmOverloads constructor(
stack: PoseStack,
x: Double,
y: Double = 0.0,
width: Double = w.toDouble(),
height: Double = h.toDouble(),
width: Double = this.width.toDouble(),
height: Double = this.height.toDouble(),
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1
) = renderRawPartial(stack, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), winding)
}
@ -292,24 +292,24 @@ class StretchingRectangleElement(
width: Float,
height: Float,
) {
val bgWidth = width - topLeft.w.coerceAtMost(bottomLeft.w) - topRight.w.coerceAtMost(bottomRight.w) - padding.left - padding.right
val bgHeight = height - topLeft.h.coerceAtMost(bottomLeft.h) - topRight.h.coerceAtMost(bottomRight.h) - padding.top - padding.bottom
val bgWidth = width - topLeft.width.coerceAtMost(bottomLeft.width) - topRight.width.coerceAtMost(bottomRight.width) - padding.left - padding.right
val bgHeight = height - topLeft.height.coerceAtMost(bottomLeft.height) - topRight.height.coerceAtMost(bottomRight.height) - padding.top - padding.bottom
if (bgWidth > 0 && bgHeight > 0) {
middle.render(stack, x + topLeft.w + padding.left, y + topLeft.h + padding.top, bgWidth, bgHeight)
middle.render(stack, x + topLeft.width + padding.left, y + topLeft.height + padding.top, bgWidth, bgHeight)
}
top.render(stack, x + topLeft.w, y, width = width - topLeft.w - topRight.w)
bottom.render(stack, x + bottomLeft.w, y + height - bottom.h, width = width - bottomLeft.w - bottomRight.w)
top.render(stack, x + topLeft.width, y, width = width - topLeft.width - topRight.width)
bottom.render(stack, x + bottomLeft.width, y + height - bottom.height, width = width - bottomLeft.width - bottomRight.width)
left.render(stack, x, y + topLeft.h, height = height - topLeft.h - bottomLeft.h)
right.render(stack, x + width - right.w, y + topRight.h, height = height - topRight.h - bottomRight.h)
left.render(stack, x, y + topLeft.height, height = height - topLeft.height - bottomLeft.height)
right.render(stack, x + width - right.width, y + topRight.height, height = height - topRight.height - bottomRight.height)
topLeft.render(stack, x, y)
topRight.render(stack, x + width - topRight.w, y)
topRight.render(stack, x + width - topRight.width, y)
bottomLeft.render(stack, x, y + height - bottomLeft.h)
bottomRight.render(stack, x + width - bottomRight.w, y + height - bottomLeft.h)
bottomLeft.render(stack, x, y + height - bottomLeft.height)
bottomRight.render(stack, x + width - bottomRight.width, y + height - bottomLeft.height)
}
}

View File

@ -121,7 +121,7 @@ class ExoSuitInventoryScreen(menu: ExoSuitInventoryMenu) : MatteryScreen<ExoSuit
height = topLine.height
) {
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
CRAFT_ARROW.render(stack, x = width / 2f - CRAFT_ARROW.w / 2f, y = height / 2f - CRAFT_ARROW.h / 2f)
CRAFT_ARROW.render(stack, x = width / 2f - CRAFT_ARROW.width / 2f, y = height / 2f - CRAFT_ARROW.height / 2f)
}
}

View File

@ -112,9 +112,9 @@ class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Comp
SlotPanel(this, craftingGrid, menu.craftingSlots[i])
}
val arrowAndButtons = object : EditablePanel<ItemMonitorScreen>(this@ItemMonitorScreen, bottomPanel, width = ProgressGaugePanel.GAUGE_BACKGROUND.w) {
val arrowAndButtons = object : EditablePanel<ItemMonitorScreen>(this@ItemMonitorScreen, bottomPanel, width = ProgressGaugePanel.GAUGE_BACKGROUND.width) {
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
ProgressGaugePanel.GAUGE_BACKGROUND.render(stack, y = height / 2f - ProgressGaugePanel.GAUGE_BACKGROUND.h / 2f)
ProgressGaugePanel.GAUGE_BACKGROUND.render(stack, y = height / 2f - ProgressGaugePanel.GAUGE_BACKGROUND.height / 2f)
}
}

View File

@ -6,7 +6,6 @@ import net.minecraft.network.chat.Component
import ru.dbotthepony.mc.otm.client.playGuiClickSound
import ru.dbotthepony.mc.otm.client.render.SkinElement
import ru.dbotthepony.mc.otm.client.render.WidgetLocation
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
import ru.dbotthepony.mc.otm.client.screen.panels.CheckBoxPanel.Companion.REGULAR_DIMENSIONS
import ru.dbotthepony.mc.otm.menu.widget.BooleanPlayerInputWidget
@ -41,16 +40,16 @@ open class CheckBoxPanel<out S : Screen> @JvmOverloads constructor(
WidgetLocation.WIDGETS,
x = 59f,
y = 241f,
w = REGULAR_DIMENSIONS,
h = REGULAR_DIMENSIONS,
width = REGULAR_DIMENSIONS,
height = REGULAR_DIMENSIONS,
)
val CHECKBOX_CHECKED = SkinElement(
WidgetLocation.WIDGETS,
x = 44f,
y = 241f,
w = REGULAR_DIMENSIONS,
h = REGULAR_DIMENSIONS,
width = REGULAR_DIMENSIONS,
height = REGULAR_DIMENSIONS,
)
}
}

View File

@ -7,7 +7,6 @@ import net.minecraft.client.gui.screens.inventory.InventoryScreen
import net.minecraft.world.entity.LivingEntity
import ru.dbotthepony.mc.otm.client.render.element
import ru.dbotthepony.mc.otm.client.screen.ExoSuitInventoryScreen
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
private fun calculateScale(width: Float, height: Float): Int {
val aspectRatio = width / height
@ -29,8 +28,8 @@ class EntityRendererPanel<out S : Screen> @JvmOverloads constructor(
val entity: LivingEntity,
x: Float = 0f,
y: Float = 0f,
width: Float = ENTITY_RECTANGLE.w,
height: Float = ENTITY_RECTANGLE.h,
width: Float = ENTITY_RECTANGLE.width,
height: Float = ENTITY_RECTANGLE.height,
var renderScale: Int = calculateScale(width, height)
) : EditablePanel<S>(screen, parent, x, y, width, height) {
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {

View File

@ -6,12 +6,10 @@ import net.minecraft.client.gui.narration.NarratableEntry
import net.minecraft.client.gui.narration.NarratableEntry.NarrationPriority
import net.minecraft.client.gui.narration.NarrationElementOutput
import net.minecraft.client.gui.screens.Screen
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
import net.minecraft.network.chat.Component
import org.lwjgl.opengl.GL30
import ru.dbotthepony.mc.otm.client.playGuiClickSound
import ru.dbotthepony.mc.otm.client.render.*
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
open class FramePanel<out S : Screen>(
screen: S,
@ -68,27 +66,27 @@ open class FramePanel<out S : Screen>(
RECTANGLE.top.renderW(stack, 3f, 0f, width - 6)
RECTANGLE.left.renderH(stack, 0f, 3f, (height - if (isActive) if (initial) 2 else 4 else 3))
RECTANGLE.right.renderH(stack, width - RECTANGLE.right.w, 3f, (height - if (isActive) 4 else 3))
RECTANGLE.right.renderH(stack, width - RECTANGLE.right.width, 3f, (height - if (isActive) 4 else 3))
RECTANGLE.topLeft.render(stack, 0f, 0f)
RECTANGLE.topRight.render(stack, width - RECTANGLE.topRight.w, 0f)
RECTANGLE.topRight.render(stack, width - RECTANGLE.topRight.width, 0f)
if (isActive) {
if (!initial) {
TAB_LEFT_CONNECTION.render(stack, 0f, height - TAB_LEFT_CONNECTION.h - 1)
TAB_LEFT_CONNECTION.render(stack, 0f, height - TAB_LEFT_CONNECTION.height - 1)
}
TAB_RIGHT_CONNECTION.render(
stack,
width - TAB_RIGHT_CONNECTION.w,
height - TAB_LEFT_CONNECTION.h - 1
width - TAB_RIGHT_CONNECTION.width,
height - TAB_LEFT_CONNECTION.height - 1
)
val skinActive = activeIcon ?: return
skinActive.render(stack, TAB_WIDTH_ACTIVE / 2f - skinActive.w / 2f, TAB_HEIGHT_ACTIVE / 2f - skinActive.h / 2f)
skinActive.render(stack, TAB_WIDTH_ACTIVE / 2f - skinActive.width / 2f, TAB_HEIGHT_ACTIVE / 2f - skinActive.height / 2f)
} else {
val skinInactive = inactiveIcon ?: return
skinInactive.render(stack, width / 2f - skinInactive.w / 2f, TAB_HEIGHT_ACTIVE / 2f - skinInactive.h / 2f)
skinInactive.render(stack, width / 2f - skinInactive.width / 2f, TAB_HEIGHT_ACTIVE / 2f - skinInactive.height / 2f)
}
}
@ -212,21 +210,21 @@ open class FramePanel<out S : Screen>(
const val PADDING_TOP = 14f
val RECTANGLE = StretchingRectangleElement(
topLeft = WidgetLocation.WIDGETS.element(x = 18f, y = 0f, w = 6f, h = 6f),
topRight = WidgetLocation.WIDGETS.element(x = 24f, y = 0f, w = 6f, h = 6f),
left = WidgetLocation.WIDGETS.element(x = 18f, y = 4f, w = 3f, h = 5f),
right = WidgetLocation.WIDGETS.element(x = 25f, y = 3f, w = 5f, h = 5f),
top = WidgetLocation.WIDGETS.element(x = 22f, y = 0f, w = 5f, h = 3f),
bottomLeft = WidgetLocation.WIDGETS.element(x = 18f, y = 6f, w = 6f, h = 6f),
bottomRight = WidgetLocation.WIDGETS.element(x = 24f, y = 6f, w = 6f, h = 6f),
bottom = WidgetLocation.WIDGETS.element(x = 21f, y = 9f, w = 5f, h = 3f),
middle = WidgetLocation.WIDGETS.element(x = 30f, y = 12f, w = 6f, h = 6f),
topLeft = WidgetLocation.WIDGETS.element(x = 18f, y = 0f, width = 6f, height = 6f),
topRight = WidgetLocation.WIDGETS.element(x = 24f, y = 0f, width = 6f, height = 6f),
left = WidgetLocation.WIDGETS.element(x = 18f, y = 4f, width = 3f, height = 5f),
right = WidgetLocation.WIDGETS.element(x = 25f, y = 3f, width = 5f, height = 5f),
top = WidgetLocation.WIDGETS.element(x = 22f, y = 0f, width = 5f, height = 3f),
bottomLeft = WidgetLocation.WIDGETS.element(x = 18f, y = 6f, width = 6f, height = 6f),
bottomRight = WidgetLocation.WIDGETS.element(x = 24f, y = 6f, width = 6f, height = 6f),
bottom = WidgetLocation.WIDGETS.element(x = 21f, y = 9f, width = 5f, height = 3f),
middle = WidgetLocation.WIDGETS.element(x = 30f, y = 12f, width = 6f, height = 6f),
padding = DockProperty(-3f, -3f, -3f, -3f)
)
val TAB_RIGHT_CONNECTION = WidgetLocation.WIDGETS.element(x = 30f, y = 0f, w = 3f, h = 5f)
val TAB_LEFT_CONNECTION = WidgetLocation.WIDGETS.element(x = 33f, y = 0f, w = 3f, h = 5f)
val TAB_BACKGROUND = WidgetLocation.WIDGETS.element(x = 30f, y = 6f, w = 6f, h = 6f)
val TAB_RIGHT_CONNECTION = WidgetLocation.WIDGETS.element(x = 30f, y = 0f, width = 3f, height = 5f)
val TAB_LEFT_CONNECTION = WidgetLocation.WIDGETS.element(x = 33f, y = 0f, width = 3f, height = 5f)
val TAB_BACKGROUND = WidgetLocation.WIDGETS.element(x = 30f, y = 6f, width = 6f, height = 6f)
const val TAB_HEIGHT = 28f
const val TAB_WIDTH = 28f

View File

@ -5,7 +5,6 @@ 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.screen.MatteryScreen
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
@ -15,8 +14,8 @@ open class HorizontalPowerGaugePanel<out S : Screen>(
widget: LevelGaugeWidget,
x: Float = 0f,
y: Float = 0f,
width: Float = GAUGE_BACKGROUND.w,
height: Float = GAUGE_BACKGROUND.h
width: Float = GAUGE_BACKGROUND.width,
height: Float = GAUGE_BACKGROUND.height
) : PowerGaugePanel<S>(screen, parent, widget, x, y, width, height) {
var flop = false
@ -45,11 +44,11 @@ open class HorizontalPowerGaugePanel<out S : Screen>(
}
companion object {
val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 160f, y = 238f, w = 96f, h = 9f)
val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 160f, y = 247f, w = 96f, h = 9f)
val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 160f, y = 238f, width = 96f, height = 9f)
val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 160f, y = 247f, width = 96f, height = 9f)
val GAUGE_BACKGROUND_TALL = WidgetLocation.WIDGETS.element(x = 160f, y = 202f, w = 96f, h = 18f)
val GAUGE_FOREGROUND_TALL = WidgetLocation.WIDGETS.element(x = 160f, y = 220f, w = 96f, h = 18f)
val GAUGE_BACKGROUND_TALL = WidgetLocation.WIDGETS.element(x = 160f, y = 202f, width = 96f, height = 18f)
val GAUGE_FOREGROUND_TALL = WidgetLocation.WIDGETS.element(x = 160f, y = 220f, width = 96f, height = 18f)
}
}
@ -62,6 +61,6 @@ fun <S : Screen> TallHorizontalPowerGaugePanel(
widget: LevelGaugeWidget,
x: Float = 0f,
y: Float = 0f,
width: Float = HorizontalPowerGaugePanel.GAUGE_BACKGROUND_TALL.w,
height: Float = HorizontalPowerGaugePanel.GAUGE_BACKGROUND_TALL.h
width: Float = HorizontalPowerGaugePanel.GAUGE_BACKGROUND_TALL.width,
height: Float = HorizontalPowerGaugePanel.GAUGE_BACKGROUND_TALL.height
) = HorizontalPowerGaugePanel(screen, parent, widget, x, y, width, height)

View File

@ -12,7 +12,6 @@ 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.tesselator
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.core.formatMatterLevel
@ -26,7 +25,7 @@ open class MatterGaugePanel<S : Screen> @JvmOverloads constructor(
val widget: LevelGaugeWidget,
x: Float = 0f,
y: Float = 0f
): EditablePanel<S>(screen, parent, x, y, width = GAUGE_BACKGROUND.w, height = GAUGE_BACKGROUND.h) {
): EditablePanel<S>(screen, parent, x, y, width = GAUGE_BACKGROUND.width, height = GAUGE_BACKGROUND.height) {
init {
scissor = true
}
@ -54,8 +53,8 @@ open class MatterGaugePanel<S : Screen> @JvmOverloads constructor(
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
val u0 = GAUGE_FOREGROUND.x / GAUGE_FOREGROUND.imageWidth
val u1 = (GAUGE_FOREGROUND.x + GAUGE_FOREGROUND.w) / GAUGE_FOREGROUND.imageWidth
val v1 = (GAUGE_FOREGROUND.y + GAUGE_FOREGROUND.h) / GAUGE_FOREGROUND.imageHeight
val u1 = (GAUGE_FOREGROUND.x + GAUGE_FOREGROUND.width) / GAUGE_FOREGROUND.imageWidth
val v1 = (GAUGE_FOREGROUND.y + GAUGE_FOREGROUND.height) / GAUGE_FOREGROUND.imageHeight
val matrix = stack.last().pose()
val builder = tesselator.builder
@ -73,7 +72,7 @@ open class MatterGaugePanel<S : Screen> @JvmOverloads constructor(
val thisY = (height + sin + cos).coerceAtLeast(0f)
builder.vertex(matrix, thisX, thisY, 0f).uv(
(GAUGE_FOREGROUND.x + (i / 4f) * GAUGE_FOREGROUND.w) / GAUGE_FOREGROUND.imageWidth,
(GAUGE_FOREGROUND.x + (i / 4f) * GAUGE_FOREGROUND.width) / GAUGE_FOREGROUND.imageWidth,
(GAUGE_FOREGROUND.y + thisY) / GAUGE_FOREGROUND.imageHeight,
).endVertex()
}
@ -91,7 +90,7 @@ open class MatterGaugePanel<S : Screen> @JvmOverloads constructor(
}
companion object {
val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 184f, y = 0f, w = 9f, h = 48f)
val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 193f, y = 0f, w = 9f, h = 48f)
val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 184f, y = 0f, width = 9f, height = 48f)
val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 193f, y = 0f, width = 9f, height = 48f)
}
}

View File

@ -6,7 +6,6 @@ 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.screen.MatteryScreen
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
@ -17,7 +16,7 @@ open class PatternGaugePanel<S : Screen> @JvmOverloads constructor(
val widget: LevelGaugeWidget,
x: Float = 0f,
y: Float = 0f
): EditablePanel<S>(screen, parent, x, y, width = GAUGE_BACKGROUND.w, height = GAUGE_BACKGROUND.h) {
): EditablePanel<S>(screen, parent, x, y, width = GAUGE_BACKGROUND.width, height = GAUGE_BACKGROUND.height) {
init {
scissor = true
}
@ -48,7 +47,7 @@ open class PatternGaugePanel<S : Screen> @JvmOverloads constructor(
}
companion object {
val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 166f, y = 0f, w = 9f, h = 48f)
val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 175f, y = 0f, w = 9f, h = 48f)
val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 166f, y = 0f, width = 9f, height = 48f)
val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 175f, y = 0f, width = 9f, height = 48f)
}
}

View File

@ -5,7 +5,6 @@ import net.minecraft.client.gui.screens.Screen
import net.minecraft.network.chat.Component
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.client.render.*
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
import ru.dbotthepony.mc.otm.core.formatPowerLevel
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
@ -16,8 +15,8 @@ open class PowerGaugePanel<out S : Screen> @JvmOverloads constructor(
val widget: LevelGaugeWidget,
x: Float = 0f,
y: Float = 0f,
width: Float = GAUGE_BACKGROUND.w,
height: Float = GAUGE_BACKGROUND.h
width: Float = GAUGE_BACKGROUND.width,
height: Float = GAUGE_BACKGROUND.height
) : EditablePanel<S>(screen, parent, x, y, width, height) {
init {
scissor = true
@ -62,11 +61,11 @@ open class PowerGaugePanel<out S : Screen> @JvmOverloads constructor(
}
companion object {
val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 202f, y = 0f, w = 9f, h = 48f)
val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 211f, y = 0f, w = 9f, h = 48f)
val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 202f, y = 0f, width = 9f, height = 48f)
val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 211f, y = 0f, width = 9f, height = 48f)
val GAUGE_BACKGROUND_WIDE = WidgetLocation.WIDGETS.element(x = 238f, y = 0f, w = 18f, h = 48f)
val GAUGE_FOREGROUND_WIDE = WidgetLocation.WIDGETS.element(x = 220f, y = 0f, w = 18f, h = 48f)
val GAUGE_BACKGROUND_WIDE = WidgetLocation.WIDGETS.element(x = 238f, y = 0f, width = 18f, height = 48f)
val GAUGE_FOREGROUND_WIDE = WidgetLocation.WIDGETS.element(x = 220f, y = 0f, width = 18f, height = 48f)
}
}

View File

@ -8,7 +8,6 @@ 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.screen.MatteryScreen
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget
@ -19,7 +18,7 @@ open class ProgressGaugePanel<S : Screen> @JvmOverloads constructor(
val widget: ProgressGaugeWidget,
x: Float = 0f,
y: Float = 0f
): EditablePanel<S>(screen, parent, x, y, width = GAUGE_BACKGROUND.w, height = GAUGE_BACKGROUND.h) {
): EditablePanel<S>(screen, parent, x, y, width = GAUGE_BACKGROUND.width, height = GAUGE_BACKGROUND.height) {
init {
scissor = true
}
@ -79,7 +78,7 @@ open class ProgressGaugePanel<S : Screen> @JvmOverloads constructor(
}
companion object {
val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 0f, y = 240f, w = 22f, h = 16f)
val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 22f, y = 240f, w = 22f, h = 16f)
val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 0f, y = 240f, width = 22f, height = 16f)
val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 22f, y = 240f, width = 22f, height = 16f)
}
}

View File

@ -4,7 +4,6 @@ import com.mojang.blaze3d.vertex.PoseStack
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder
import mezz.jei.api.gui.drawable.IDrawable
import mezz.jei.api.gui.ingredient.IRecipeSlotsView
import mezz.jei.api.helpers.IJeiHelpers
import mezz.jei.api.recipe.IFocusGroup
import mezz.jei.api.recipe.RecipeIngredientRole
import mezz.jei.api.recipe.RecipeType
@ -17,13 +16,11 @@ import ru.dbotthepony.mc.otm.client.minecraft
import ru.dbotthepony.mc.otm.client.render.TextAlign
import ru.dbotthepony.mc.otm.client.render.drawAligned
import ru.dbotthepony.mc.otm.client.screen.panels.AbstractSlotPanel
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel
import ru.dbotthepony.mc.otm.core.RGBAColor
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.recipe.PlatePressRecipe
import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.registry.WriteOnce
object PlatePressRecipeCategory : IRecipeCategory<PlatePressRecipe>, IDrawable {
const val X_INPUT = 6f
@ -60,7 +57,7 @@ object PlatePressRecipeCategory : IRecipeCategory<PlatePressRecipe>, IDrawable {
poseStack,
X_ARROW + xOffset,
Y_ARROW + yOffset,
width = ((System.currentTimeMillis() % 4000L) / 4000f) * ProgressGaugePanel.GAUGE_FOREGROUND.w)
width = ((System.currentTimeMillis() % 4000L) / 4000f) * ProgressGaugePanel.GAUGE_FOREGROUND.width)
}
override fun draw(

View File

@ -6,11 +6,11 @@ import ru.dbotthepony.mc.otm.client.render.SkinElement
class SkinDrawable(val element: SkinElement) : IDrawable {
override fun getWidth(): Int {
return element.w.toInt()
return element.width.toInt()
}
override fun getHeight(): Int {
return element.h.toInt()
return element.height.toInt()
}
override fun draw(poseStack: PoseStack, xOffset: Int, yOffset: Int) {