diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/FontRendering.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/FontRendering.kt index e34f35716..fe3e49153 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/FontRendering.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/FontRendering.kt @@ -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, diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/IGUIRenderable.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/IGUIRenderable.kt index 75c9eac0c..ff58bcff2 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/IGUIRenderable.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/IGUIRenderable.kt @@ -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) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/sprites/AbstractMatterySprite.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/sprites/AbstractMatterySprite.kt index 9464854b1..6cbab80a2 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/sprites/AbstractMatterySprite.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/sprites/AbstractMatterySprite.kt @@ -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( diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/ColorPicker.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/ColorPicker.kt index 26317bdb7..c8c81f08b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/ColorPicker.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/ColorPicker.kt @@ -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( 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( 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) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EffectListPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EffectListPanel.kt index 3f964deb4..330fa3ef7 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EffectListPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EffectListPanel.kt @@ -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 @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) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/BooleanRectangleButtonPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/BooleanRectangleButtonPanel.kt index 48383f668..5569db12f 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/BooleanRectangleButtonPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/BooleanRectangleButtonPanel.kt @@ -83,9 +83,9 @@ abstract class BooleanRectangleButtonPanel( 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) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/CheckBoxPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/CheckBoxPanel.kt index bdfe883c6..8d4cbbc13 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/CheckBoxPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/CheckBoxPanel.kt @@ -28,28 +28,28 @@ open class CheckBoxPanel( 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) } } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/LargeRectangleButtonPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/LargeRectangleButtonPanel.kt index 7e43bd9a6..c0953ef4b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/LargeRectangleButtonPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/LargeRectangleButtonPanel.kt @@ -31,9 +31,9 @@ open class LargeRectangleButtonPanel( 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) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/SmallRectangleButtonPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/SmallRectangleButtonPanel.kt index b7b5a1cf6..7e9b5341e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/SmallRectangleButtonPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/SmallRectangleButtonPanel.kt @@ -27,9 +27,9 @@ open class SmallRectangleButtonPanel( 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) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/AbstractSlotPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/AbstractSlotPanel.kt index ce1f04d26..63297eff5 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/AbstractSlotPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/AbstractSlotPanel.kt @@ -27,7 +27,7 @@ abstract class AbstractSlotPanel>( 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) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/SlotPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/SlotPanel.kt index f081dde43..0a429138f 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/SlotPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/SlotPanel.kt @@ -99,7 +99,7 @@ open class SlotPanel, 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) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/util/AnalogScrollBarPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/util/AnalogScrollBarPanel.kt index 2e4f66893..01906679d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/util/AnalogScrollBarPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/util/AnalogScrollBarPanel.kt @@ -33,23 +33,23 @@ open class AnalogScrollBarPanel( 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( 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) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/util/DiscreteScrollBarPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/util/DiscreteScrollBarPanel.kt index c402ff43e..d37f82a96 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/util/DiscreteScrollBarPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/util/DiscreteScrollBarPanel.kt @@ -27,23 +27,23 @@ open class DiscreteScrollBarPanel( 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( 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) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EssenceStorageScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EssenceStorageScreen.kt index 6f3f187e4..0ac68e287 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EssenceStorageScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EssenceStorageScreen.kt @@ -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) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/FluidGaugePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/FluidGaugePanel.kt index 12cf5c213..00203f2ac 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/FluidGaugePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/FluidGaugePanel.kt @@ -105,7 +105,7 @@ open class FluidGaugePanel( 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 { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/HorizontalPowerGaugePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/HorizontalPowerGaugePanel.kt index 60cbc2ed8..f119d707b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/HorizontalPowerGaugePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/HorizontalPowerGaugePanel.kt @@ -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) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/PowerGaugePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/PowerGaugePanel.kt index 9d0b7f2cf..440f741c6 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/PowerGaugePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/PowerGaugePanel.kt @@ -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( 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( 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, diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/ProgressGaugePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/ProgressGaugePanel.kt index bd295bbf7..64aaa21c4 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/ProgressGaugePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/ProgressGaugePanel.kt @@ -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( } 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) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/cos/CosmeticArmorCompat.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/cos/CosmeticArmorCompat.kt index a89d186e8..4421a4f2c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/cos/CosmeticArmorCompat.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/cos/CosmeticArmorCompat.kt @@ -182,9 +182,9 @@ class CosmeticToggleButton( 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( 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) } } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/curios/CuriosCompat.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/curios/CuriosCompat.kt index 7cb91a57a..2db6097ed 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/curios/CuriosCompat.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/curios/CuriosCompat.kt @@ -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( 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) } }