Rename width/height to canvasWidth/canvasHeight to clarify

This commit is contained in:
DBotThePony 2024-09-22 17:52:24 +07:00
parent a6ff93d74c
commit 51f2c21f2d
Signed by: DBot
GPG Key ID: DCC23B5715498507
20 changed files with 82 additions and 97 deletions

View File

@ -303,16 +303,16 @@ data class TextIcon(
guiGraphics: MGUIGraphics,
x: Float,
y: Float,
width: Float,
height: Float,
canvasWidth: Float,
canvasHeight: Float,
winding: UVWindingOrder,
color: RGBAColor
) {
font.draw(
guiGraphics.pose,
text,
RenderGravity.CENTER_CENTER.x(x + width / 2f, this.width),
RenderGravity.CENTER_CENTER.y(y + height / 2f, this.height),
RenderGravity.CENTER_CENTER.x(x + canvasWidth / 2f, this.width),
RenderGravity.CENTER_CENTER.y(y + canvasHeight / 2f, this.height),
scale = scale,
gravity = RenderGravity.TOP_LEFT,
color = this.color * color,

View File

@ -31,14 +31,14 @@ interface IGUIRenderable {
}
/**
* Render at specified position [x], [y] with **canvas** size of [width] x [height], optionally with UV [winding], if we are rendering flat texture/sprite
* Render at specified position [x], [y] with **canvas** size of [canvasWidth] x [canvasHeight], optionally with UV [winding], if we are rendering flat texture/sprite
*/
fun render(
guiGraphics: MGUIGraphics,
x: Float = 0f,
y: Float = 0f,
width: Float = this.width,
height: Float = this.height,
canvasWidth: Float = this.width,
canvasHeight: Float = this.height,
winding: UVWindingOrder = this.winding,
color: RGBAColor = RGBAColor.WHITE
)
@ -50,9 +50,9 @@ interface IGUIRenderable {
override val height: Float
get() = this@IGUIRenderable.height.coerceAtLeast(other.height)
override fun render(guiGraphics: MGUIGraphics, x: Float, y: Float, width: Float, height: Float, winding: UVWindingOrder, color: RGBAColor) {
this@IGUIRenderable.render(guiGraphics, x, y, width, height, winding, color)
other.render(guiGraphics, x, y, width, height, winding, color)
override fun render(guiGraphics: MGUIGraphics, x: Float, y: Float, canvasWidth: Float, canvasHeight: Float, winding: UVWindingOrder, color: RGBAColor) {
this@IGUIRenderable.render(guiGraphics, x, y, canvasWidth, canvasHeight, winding, color)
other.render(guiGraphics, x, y, canvasWidth, canvasHeight, winding, color)
}
}
}
@ -68,8 +68,8 @@ interface IGUIRenderable {
override val height: Float
get() = this@IGUIRenderable.height
override fun render(guiGraphics: MGUIGraphics, x: Float, y: Float, width: Float, height: Float, winding: UVWindingOrder, color: RGBAColor) {
this@IGUIRenderable.render(guiGraphics, x + left, y + top, width + right + left, height + bottom + top, winding, color)
override fun render(guiGraphics: MGUIGraphics, x: Float, y: Float, canvasWidth: Float, canvasHeight: Float, winding: UVWindingOrder, color: RGBAColor) {
this@IGUIRenderable.render(guiGraphics, x + left, y + top, canvasWidth + right + left, canvasHeight + bottom + top, winding, color)
}
}
}
@ -91,19 +91,19 @@ interface IGUIRenderable {
override val height: Float
get() = this@IGUIRenderable.height
override fun render(guiGraphics: MGUIGraphics, x: Float, y: Float, width: Float, height: Float, winding: UVWindingOrder, color: RGBAColor) {
override fun render(guiGraphics: MGUIGraphics, x: Float, y: Float, canvasWidth: Float, canvasHeight: Float, winding: UVWindingOrder, color: RGBAColor) {
var realX = x
var realY = y
if (fixedWidth && width > this.width) {
realX += gravity.repositionX(width, this.width)
if (fixedWidth && canvasWidth > this.width) {
realX += gravity.repositionX(canvasWidth, this.width)
}
if (fixedHeight && height > this.height) {
realY += gravity.repositionY(height, this.height)
if (fixedHeight && canvasHeight > this.height) {
realY += gravity.repositionY(canvasHeight, this.height)
}
this@IGUIRenderable.render(guiGraphics, realX, realY, if (fixedWidth) this.width else width, if (fixedHeight) this.height else height, if (fixedWinding) this.winding else winding, color)
this@IGUIRenderable.render(guiGraphics, realX, realY, if (fixedWidth) this.width else canvasWidth, if (fixedHeight) this.height else canvasHeight, if (fixedWinding) this.winding else winding, color)
}
}
}
@ -120,24 +120,24 @@ interface IGUIRenderable {
}
data class ItemStackIcon(private val itemStack: ItemStack, override val width: Float = 16f, override val height: Float = 16f) : IGUIRenderable {
override fun render(guiGraphics: MGUIGraphics, x: Float, y: Float, width: Float, height: Float, winding: UVWindingOrder, color: RGBAColor) {
override fun render(guiGraphics: MGUIGraphics, x: Float, y: Float, canvasWidth: Float, canvasHeight: Float, winding: UVWindingOrder, color: RGBAColor) {
val pose = guiGraphics.pose
pose.pushPose()
pose.translate(x, y, 0f)
pose.scale(width / 16f, height / 16f, 1f)
pose.scale(canvasWidth / 16f, canvasHeight / 16f, 1f)
guiGraphics.setColor(color.red, color.green, color.blue, color.alpha)
guiGraphics.renderFakeItem(itemStack, 0, 0)
pose.popPose()
clearDepth(pose, x, y, width, height)
clearDepth(pose, x, y, canvasWidth, canvasHeight)
}
}
data class FlatRectangleIcon(override val width: Float = 1f, override val height: Float = 1f, val color: RGBAColor) : IGUIRenderable {
override fun render(guiGraphics: MGUIGraphics, x: Float, y: Float, width: Float, height: Float, winding: UVWindingOrder, color: RGBAColor) {
guiGraphics.renderRect(x, y, width, height, color = this.color)
override fun render(guiGraphics: MGUIGraphics, x: Float, y: Float, canvasWidth: Float, canvasHeight: Float, winding: UVWindingOrder, color: RGBAColor) {
guiGraphics.renderRect(x, y, canvasWidth, canvasHeight, color = this.color)
}
}

View File

@ -75,12 +75,12 @@ sealed class AbstractMatterySprite : IGUIRenderable, IUVCoords {
guiGraphics: MGUIGraphics,
x: Float,
y: Float,
width: Float,
height: Float,
canvasWidth: Float,
canvasHeight: Float,
winding: UVWindingOrder,
color: RGBAColor
) {
guiGraphics.renderTexturedRect(x, y, width, height, uvWinding = winding, color = color, texture = texture, uv = this)
guiGraphics.renderTexturedRect(x, y, canvasWidth, canvasHeight, uvWinding = winding, color = color, texture = texture, uv = this)
}
fun renderPartial(

View File

@ -5,7 +5,6 @@ import com.mojang.datafixers.util.Either
import it.unimi.dsi.fastutil.floats.FloatConsumer
import net.minecraft.client.gui.screens.Screen
import net.minecraft.network.chat.Component
import net.minecraft.resources.ResourceLocation
import ru.dbotthepony.kommons.math.HSVColor
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.client.CursorType
@ -118,8 +117,8 @@ open class ColorBoxPanel<out S : Screen>(
val x = (1f - markerPos.saturation) * width
val y = (1f - markerPos.value) * height
LINE_VERTICAL.render(graphics, x = x - 1f, height = height)
LINE_HORIZONTAL.render(graphics, y = y - 1f, width = width)
LINE_VERTICAL.render(graphics, x = x - 1f, canvasHeight = height)
LINE_HORIZONTAL.render(graphics, y = y - 1f, canvasWidth = width)
LINE_CROSS.render(graphics, x = x - 1f, y = y - 1f)
}
@ -216,7 +215,7 @@ abstract class AbstractColorWangPanel<out S : Screen>(
protected fun renderWang(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
if (wangPosition in 0f .. 1f) {
ColorBoxPanel.LINE_VERTICAL.render(graphics, x = wangPosition * width - 1f, height = height)
ColorBoxPanel.LINE_VERTICAL.render(graphics, x = wangPosition * width - 1f, canvasHeight = height)
}
}

View File

@ -5,7 +5,6 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap
import it.unimi.dsi.fastutil.objects.Object2ObjectFunction
import net.minecraft.client.gui.screens.Screen
import net.minecraft.core.Holder
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.effect.MobEffect
import net.minecraft.world.effect.MobEffectInstance
import net.minecraft.world.entity.LivingEntity
@ -110,7 +109,7 @@ open class EffectListPanel<out S : Screen> @JvmOverloads constructor(
override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
clearDepth(graphics)
SQUARE_THIN.render(graphics, width = width, height = height)
SQUARE_THIN.render(graphics, canvasWidth = width, canvasHeight = height)
RenderSystem.setShaderColor(1f, 1f, 1f, 0.5f)
graphics.renderSprite(minecraft.mobEffectTextures.get(effect.effect), x = 3f, y = 3f, width = width - 6f, height = height - 6f)

View File

@ -83,9 +83,9 @@ abstract class BooleanRectangleButtonPanel<out S : Screen>(
super.innerRender(graphics, mouseX, mouseY, partialTick)
if (prop.value) {
iconActive?.render(graphics, width = width, height = height)
iconActive?.render(graphics, canvasWidth = width, canvasHeight = height)
} else {
iconInactive?.render(graphics, width = width, height = height)
iconInactive?.render(graphics, canvasWidth = width, canvasHeight = height)
}
}

View File

@ -28,28 +28,28 @@ open class CheckBoxPanel<out S : Screen>(
protected fun renderCheckboxBackground(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
if (isDisabled) {
if (isChecked.get()) {
DISABLED_CHECKED.render(graphics, width = width, height = height)
DISABLED_CHECKED.render(graphics, canvasWidth = width, canvasHeight = height)
} else {
DISABLED_UNCHECKED.render(graphics, width = width, height = height)
DISABLED_UNCHECKED.render(graphics, canvasWidth = width, canvasHeight = height)
}
} else {
if (isPressed) {
if (isChecked.get()) {
PRESSED_CHECKED.render(graphics, width = width, height = height)
PRESSED_CHECKED.render(graphics, canvasWidth = width, canvasHeight = height)
} else {
PRESSED_UNCHECKED.render(graphics, width = width, height = height)
PRESSED_UNCHECKED.render(graphics, canvasWidth = width, canvasHeight = height)
}
} else if (isHovered) {
if (isChecked.get()) {
HOVERED_CHECKED.render(graphics, width = width, height = height)
HOVERED_CHECKED.render(graphics, canvasWidth = width, canvasHeight = height)
} else {
HOVERED_UNCHECKED.render(graphics, width = width, height = height)
HOVERED_UNCHECKED.render(graphics, canvasWidth = width, canvasHeight = height)
}
} else {
if (isChecked.get()) {
IDLE_CHECKED.render(graphics, width = width, height = height)
IDLE_CHECKED.render(graphics, canvasWidth = width, canvasHeight = height)
} else {
IDLE_UNCHECKED.render(graphics, width = width, height = height)
IDLE_UNCHECKED.render(graphics, canvasWidth = width, canvasHeight = height)
}
}
}

View File

@ -31,9 +31,9 @@ open class LargeRectangleButtonPanel<out S : Screen>(
val color = if (isDisabled || isPressed) RGBAColor.DARK_GRAY else RGBAColor.WHITE
if (iconWinding != null) {
icon?.render(graphics, width = width, height = height, winding = iconWinding!!, color = color)
icon?.render(graphics, canvasWidth = width, canvasHeight = height, winding = iconWinding!!, color = color)
} else {
icon?.render(graphics, width = width, height = height, color = color)
icon?.render(graphics, canvasWidth = width, canvasHeight = height, color = color)
}
}

View File

@ -27,9 +27,9 @@ open class SmallRectangleButtonPanel<out S : Screen>(
super.innerRender(graphics, mouseX, mouseY, partialTick)
if (skinElementWinding != null) {
skinElement?.render(graphics, width = width, height = height, winding = skinElementWinding)
skinElement?.render(graphics, canvasWidth = width, canvasHeight = height, winding = skinElementWinding)
} else {
skinElement?.render(graphics, width = width, height = height)
skinElement?.render(graphics, canvasWidth = width, canvasHeight = height)
}
}

View File

@ -27,7 +27,7 @@ abstract class AbstractSlotPanel<out S : MatteryScreen<*>>(
abstract val itemStack: ItemStack
protected open fun renderSlotBackground(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
SLOT_BACKGROUND.render(graphics, width = width, height = height)
SLOT_BACKGROUND.render(graphics, canvasWidth = width, canvasHeight = height)
slotBackground?.render(graphics, 0f, 0f, width, height)
}

View File

@ -99,7 +99,7 @@ open class SlotPanel<out S : MatteryScreen<*>, out T : Slot>(
RenderSystem.setShaderTexture(0, texture.atlasLocation())
graphics.renderSprite(texture, 1f, 1f, 16f, 16f)
} else {
slotBackgroundEmpty?.render(graphics, 0f, 0f, width = width, height = height)
slotBackgroundEmpty?.render(graphics, 0f, 0f, canvasWidth = width, canvasHeight = height)
}
}

View File

@ -33,23 +33,23 @@ open class AnalogScrollBarPanel<out S : Screen>(
override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
if (this@AnalogScrollBarPanel.width == ScrollBarConstants.SLIM_WIDTH) {
if (isScrolling) {
ScrollBarConstants.SLIM_BUTTON_PRESS.render(graphics, width = width, height = height)
ScrollBarConstants.SLIM_BUTTON_PRESS.render(graphics, canvasWidth = width, canvasHeight = height)
} else if (maxScroll.invoke(this@AnalogScrollBarPanel) <= 0) {
ScrollBarConstants.SLIM_BUTTON_DISABLED.render(graphics, width = width, height = height)
ScrollBarConstants.SLIM_BUTTON_DISABLED.render(graphics, canvasWidth = width, canvasHeight = height)
} else if (isHovered) {
ScrollBarConstants.SLIM_BUTTON_HOVER.render(graphics, width = width, height = height)
ScrollBarConstants.SLIM_BUTTON_HOVER.render(graphics, canvasWidth = width, canvasHeight = height)
} else {
ScrollBarConstants.SLIM_BUTTON.render(graphics, width = width, height = height)
ScrollBarConstants.SLIM_BUTTON.render(graphics, canvasWidth = width, canvasHeight = height)
}
} else {
if (isScrolling) {
ScrollBarConstants.BUTTON_PRESS.render(graphics, width = width, height = height)
ScrollBarConstants.BUTTON_PRESS.render(graphics, canvasWidth = width, canvasHeight = height)
} else if (maxScroll.invoke(this@AnalogScrollBarPanel) <= 0) {
ScrollBarConstants.BUTTON_DISABLED.render(graphics, width = width, height = height)
ScrollBarConstants.BUTTON_DISABLED.render(graphics, canvasWidth = width, canvasHeight = height)
} else if (isHovered) {
ScrollBarConstants.BUTTON_HOVER.render(graphics, width = width, height = height)
ScrollBarConstants.BUTTON_HOVER.render(graphics, canvasWidth = width, canvasHeight = height)
} else {
ScrollBarConstants.BUTTON.render(graphics, width = width, height = height)
ScrollBarConstants.BUTTON.render(graphics, canvasWidth = width, canvasHeight = height)
}
}
}
@ -104,11 +104,11 @@ open class AnalogScrollBarPanel<out S : Screen>(
override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
if (width == ScrollBarConstants.SLIM_WIDTH) {
ScrollBarConstants.SLIM_BODY.render(graphics, y = 2f, height = height - 4f)
ScrollBarConstants.SLIM_BODY.render(graphics, y = 2f, canvasHeight = height - 4f)
ScrollBarConstants.SLIM_TOP.render(graphics)
ScrollBarConstants.SLIM_BOTTOM.render(graphics, y = height - 2f)
} else {
ScrollBarConstants.BODY.render(graphics, y = 2f, height = height - 4f)
ScrollBarConstants.BODY.render(graphics, y = 2f, canvasHeight = height - 4f)
ScrollBarConstants.TOP.render(graphics)
ScrollBarConstants.BOTTOM.render(graphics, y = height - 2f)
}

View File

@ -27,23 +27,23 @@ open class DiscreteScrollBarPanel<out S : Screen>(
override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
if (this@DiscreteScrollBarPanel.width == ScrollBarConstants.SLIM_WIDTH) {
if (isScrolling) {
ScrollBarConstants.SLIM_BUTTON_PRESS.render(graphics, width = width, height = height)
ScrollBarConstants.SLIM_BUTTON_PRESS.render(graphics, canvasWidth = width, canvasHeight = height)
} else if (maxScroll.invoke(this@DiscreteScrollBarPanel) <= 0) {
ScrollBarConstants.SLIM_BUTTON_DISABLED.render(graphics, width = width, height = height)
ScrollBarConstants.SLIM_BUTTON_DISABLED.render(graphics, canvasWidth = width, canvasHeight = height)
} else if (isHovered) {
ScrollBarConstants.SLIM_BUTTON_HOVER.render(graphics, width = width, height = height)
ScrollBarConstants.SLIM_BUTTON_HOVER.render(graphics, canvasWidth = width, canvasHeight = height)
} else {
ScrollBarConstants.SLIM_BUTTON.render(graphics, width = width, height = height)
ScrollBarConstants.SLIM_BUTTON.render(graphics, canvasWidth = width, canvasHeight = height)
}
} else {
if (isScrolling) {
ScrollBarConstants.BUTTON_PRESS.render(graphics, width = width, height = height)
ScrollBarConstants.BUTTON_PRESS.render(graphics, canvasWidth = width, canvasHeight = height)
} else if (maxScroll.invoke(this@DiscreteScrollBarPanel) <= 0) {
ScrollBarConstants.BUTTON_DISABLED.render(graphics, width = width, height = height)
ScrollBarConstants.BUTTON_DISABLED.render(graphics, canvasWidth = width, canvasHeight = height)
} else if (isHovered) {
ScrollBarConstants.BUTTON_HOVER.render(graphics, width = width, height = height)
ScrollBarConstants.BUTTON_HOVER.render(graphics, canvasWidth = width, canvasHeight = height)
} else {
ScrollBarConstants.BUTTON.render(graphics, width = width, height = height)
ScrollBarConstants.BUTTON.render(graphics, canvasWidth = width, canvasHeight = height)
}
}
}
@ -96,11 +96,11 @@ open class DiscreteScrollBarPanel<out S : Screen>(
override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
if (width == ScrollBarConstants.SLIM_WIDTH) {
ScrollBarConstants.SLIM_BODY.render(graphics, y = 2f, height = height - 4f)
ScrollBarConstants.SLIM_BODY.render(graphics, y = 2f, canvasHeight = height - 4f)
ScrollBarConstants.SLIM_TOP.render(graphics)
ScrollBarConstants.SLIM_BOTTOM.render(graphics, y = height - 2f)
} else {
ScrollBarConstants.BODY.render(graphics, y = 2f, height = height - 4f)
ScrollBarConstants.BODY.render(graphics, y = 2f, canvasHeight = height - 4f)
ScrollBarConstants.TOP.render(graphics)
ScrollBarConstants.BOTTOM.render(graphics, y = height - 2f)
}

View File

@ -2,9 +2,7 @@ package ru.dbotthepony.mc.otm.client.screen.tech
import net.minecraft.ChatFormatting
import net.minecraft.network.chat.Component
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.item.enchantment.Enchantments
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
import ru.dbotthepony.mc.otm.client.isShiftDown
@ -59,7 +57,7 @@ class EssenceStorageScreen(menu: EssenceStorageMenu, inventory: Inventory, title
}
override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
BAR_BACKGROUND.render(graphics, width = width, height = height)
BAR_BACKGROUND.render(graphics, canvasWidth = width, canvasHeight = height)
val level = getLevelFromXp(menu.experienceStored)
val progress = (menu.experienceStored - getTotalXpRequiredForLevel(level)).toDouble() / getXpRequiredForLevelUp(level).toDouble()
BAR_FOREGROUND.renderPartial(graphics, width = width * progress.toFloat(), height = height)

View File

@ -105,7 +105,7 @@ open class FluidGaugePanel<out S : Screen>(
RenderSystem.depthFunc(GL11.GL_LESS)
}
GAUGE.render(graphics, 0f, 0f, width = width, height = height)
GAUGE.render(graphics, 0f, 0f, canvasWidth = width, canvasHeight = height)
}
companion object {

View File

@ -11,21 +11,21 @@ import ru.dbotthepony.mc.otm.menu.widget.ProfiledLevelGaugeWidget
private fun PowerGaugePanel<*>.doRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float, flop: Boolean) {
if (height >= 18f) {
if (flop) {
HorizontalPowerGaugePanel.GAUGE_BACKGROUND_TALL.render(graphics, height = height, width = this.width, winding = UVWindingOrder.U1_V0_U0_V1)
HorizontalPowerGaugePanel.GAUGE_BACKGROUND_TALL.render(graphics, canvasHeight = height, canvasWidth = this.width, winding = UVWindingOrder.U1_V0_U0_V1)
val width = this.width * widget.percentage
HorizontalPowerGaugePanel.GAUGE_FOREGROUND_TALL.renderPartial(graphics, x = this.width - width, height = height, width = width, winding = UVWindingOrder.U1_V0_U0_V1)
} else {
HorizontalPowerGaugePanel.GAUGE_BACKGROUND_TALL.render(graphics, height = height, width = this.width)
HorizontalPowerGaugePanel.GAUGE_BACKGROUND_TALL.render(graphics, canvasHeight = height, canvasWidth = this.width)
val width = this.width * widget.percentage
HorizontalPowerGaugePanel.GAUGE_FOREGROUND_TALL.renderPartial(graphics, height = height, width = width)
}
} else {
if (flop) {
HorizontalPowerGaugePanel.GAUGE_BACKGROUND.render(graphics, height = height, width = this.width, winding = UVWindingOrder.U1_V0_U0_V1)
HorizontalPowerGaugePanel.GAUGE_BACKGROUND.render(graphics, canvasHeight = height, canvasWidth = this.width, winding = UVWindingOrder.U1_V0_U0_V1)
val width = this.width * widget.percentage
HorizontalPowerGaugePanel.GAUGE_FOREGROUND.renderPartial(graphics, x = this.width - width, height = height, width = width, winding = UVWindingOrder.U1_V0_U0_V1)
} else {
HorizontalPowerGaugePanel.GAUGE_BACKGROUND.render(graphics, height = height, width = this.width)
HorizontalPowerGaugePanel.GAUGE_BACKGROUND.render(graphics, canvasHeight = height, canvasWidth = this.width)
val width = this.width * widget.percentage
HorizontalPowerGaugePanel.GAUGE_FOREGROUND.renderPartial(graphics, height = height, width = width)
}

View File

@ -1,22 +1,13 @@
package ru.dbotthepony.mc.otm.client.screen.widget
import it.unimi.dsi.fastutil.ints.IntArrayList
import net.minecraft.ChatFormatting
import net.minecraft.client.gui.screens.Screen
import net.minecraft.network.chat.Component
import ru.dbotthepony.kommons.util.value
import ru.dbotthepony.mc.otm.capability.AbstractProfiledStorage
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
import ru.dbotthepony.mc.otm.client.ShiftPressedCond
import ru.dbotthepony.mc.otm.client.isShiftDown
import ru.dbotthepony.mc.otm.client.minecraft
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.client.render.*
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
import ru.dbotthepony.mc.otm.core.TextComponent
import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.core.util.formatHistory
import ru.dbotthepony.mc.otm.core.util.formatPower
import ru.dbotthepony.mc.otm.core.util.formatPowerLevel
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
import ru.dbotthepony.mc.otm.menu.widget.ProfiledLevelGaugeWidget
@ -45,7 +36,7 @@ open class PowerGaugePanel<out S : Screen>(
val height = this.height * widget.percentage
if (width >= 18f) {
GAUGE_BACKGROUND_WIDE.render(graphics, width = width, height = this.height)
GAUGE_BACKGROUND_WIDE.render(graphics, canvasWidth = width, canvasHeight = this.height)
GAUGE_FOREGROUND_WIDE.renderPartial(
graphics,
y = this.height - height,
@ -53,7 +44,7 @@ open class PowerGaugePanel<out S : Screen>(
width = width,
winding = UVWindingOrder.U0_V1_U1_V0)
} else {
GAUGE_BACKGROUND.render(graphics, width = width, height = this.height)
GAUGE_BACKGROUND.render(graphics, canvasWidth = width, canvasHeight = this.height)
GAUGE_FOREGROUND.renderPartial(
graphics,
y = this.height - height,

View File

@ -14,7 +14,6 @@ import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
import ru.dbotthepony.mc.otm.client.screen.panels.button.AbstractButtonPanel
import ru.dbotthepony.mc.otm.compat.jei.JEIPlugin
import ru.dbotthepony.mc.otm.compat.jei.isJeiLoaded
import ru.dbotthepony.mc.otm.core.TextComponent
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget
import java.util.function.Supplier
@ -63,11 +62,11 @@ open class ProgressGaugePanel<out S : Screen>(
}
if (flop) {
GAUGE_BACKGROUND.render(graphics, height = height, width = this.width, winding = UVWindingOrder.U1_V0_U0_V1)
GAUGE_BACKGROUND.render(graphics, canvasHeight = height, canvasWidth = this.width, winding = UVWindingOrder.U1_V0_U0_V1)
val width = (this.width * widget.percentage).roundToInt().toFloat()
GAUGE_FOREGROUND.renderPartial(graphics, x = this.width - width, height = height, width = width, winding = UVWindingOrder.U1_V0_U0_V1)
} else {
GAUGE_BACKGROUND.render(graphics, height = height, width = this.width)
GAUGE_BACKGROUND.render(graphics, canvasHeight = height, canvasWidth = this.width)
val width = (this.width * widget.percentage).roundToInt().toFloat()
GAUGE_FOREGROUND.renderPartial(graphics, height = height, width = width)
}

View File

@ -182,9 +182,9 @@ class CosmeticToggleButton<out S : Screen>(
val color = if (isHovered) RGBAColor.WHITE else RGBAColor.HALF_TRANSPARENT
if (inv.isSkinArmor(index)) {
BUTTON_ACTIVE.render(graphics, width = width, height = height, color = color)
BUTTON_ACTIVE.render(graphics, canvasWidth = width, canvasHeight = height, color = color)
} else {
BUTTON_INACTIVE.render(graphics, width = width, height = height, color = color)
BUTTON_INACTIVE.render(graphics, canvasWidth = width, canvasHeight = height, color = color)
}
}
@ -219,9 +219,9 @@ class CosmeticToggleRenderButton<out S : Screen>(
override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
if (PlayerRenderHandler.Disabled) {
BUTTON_ACTIVE.render(graphics, width = width, height = height)
BUTTON_ACTIVE.render(graphics, canvasWidth = width, canvasHeight = height)
} else {
BUTTON_INACTIVE.render(graphics, width = width, height = height)
BUTTON_INACTIVE.render(graphics, canvasWidth = width, canvasHeight = height)
}
}
}

View File

@ -12,7 +12,6 @@ import net.neoforged.fml.ModList
import net.neoforged.fml.loading.FMLEnvironment
import net.neoforged.neoforge.network.PacketDistributor
import ru.dbotthepony.kommons.math.RGBAColor
import ru.dbotthepony.mc.otm.capability.MatteryCapability
import ru.dbotthepony.mc.otm.capability.matteryPlayer
import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
import ru.dbotthepony.mc.otm.client.render.sprites.MatterySprite
@ -217,9 +216,9 @@ class CurioToggleButton<out S : Screen>(
val color = if (isHovered) RGBAColor.WHITE else RGBAColor.HALF_TRANSPARENT
if ((slot as CurioSlot).getRenderStatus()) {
BUTTON_ACTIVE.render(graphics, width = width, height = height, color = color)
BUTTON_ACTIVE.render(graphics, canvasWidth = width, canvasHeight = height, color = color)
} else {
BUTTON_INACTIVE.render(graphics, width = width, height = height, color = color)
BUTTON_INACTIVE.render(graphics, canvasWidth = width, canvasHeight = height, color = color)
}
}