From 311de079fa7a42dce152953dfc868f1862eea4cb Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Mon, 1 Jan 2024 02:39:58 +0700 Subject: [PATCH 1/4] Add polyfill guigraphics --- .../otm/android/AndroidSwitchableFeature.kt | 3 +- .../android/feature/EnderTeleporterFeature.kt | 3 +- .../otm/android/feature/ItemMagnetFeature.kt | 3 +- .../otm/android/feature/JumpBoostFeature.kt | 3 +- .../otm/android/feature/NightVisionFeature.kt | 3 +- .../otm/android/feature/ShockwaveFeature.kt | 3 +- .../otm/android/feature/StepAssistFeature.kt | 3 +- .../android/feature/SwimBoostersFeature.kt | 3 +- .../mc/otm/client/AndroidAbilityKeyMapping.kt | 7 +- .../mc/otm/client/AndroidMenuKeyMapping.kt | 14 +- .../dbotthepony/mc/otm/client/MGUIGraphics.kt | 259 ++++++++++++++++++ .../dbotthepony/mc/otm/client/MatteryGUI.kt | 37 +-- .../mc/otm/client/render/FontRenderer.kt | 70 +---- .../mc/otm/client/render/IGUIRenderable.kt | 17 +- .../mc/otm/client/render/RenderHelper.kt | 55 +--- .../render/sprites/AbstractMatterySprite.kt | 9 +- .../sprites/StretchingRectangleElement.kt | 5 +- .../mc/otm/client/screen/MatteryScreen.kt | 14 +- .../client/screen/decorative/PainterScreen.kt | 8 +- .../client/screen/matter/MatterPanelScreen.kt | 4 +- .../otm/client/screen/panels/ColorPicker.kt | 16 +- .../otm/client/screen/panels/EditablePanel.kt | 21 +- .../client/screen/panels/EffectListPanel.kt | 9 +- .../screen/panels/EntityRendererPanel.kt | 8 +- .../mc/otm/client/screen/panels/FramePanel.kt | 10 +- .../mc/otm/client/screen/panels/Label.kt | 4 +- .../screen/panels/NetworkedItemGridPanel.kt | 6 +- .../otm/client/screen/panels/Panel2Widget.kt | 7 +- .../otm/client/screen/panels/SpritePanel.kt | 4 +- .../otm/client/screen/panels/Widget2Panel.kt | 7 +- .../panels/button/AbstractButtonPanel.kt | 4 +- .../button/BooleanRectangleButtonPanel.kt | 6 +- .../screen/panels/button/ButtonPanel.kt | 5 +- .../client/screen/panels/button/Buttons.kt | 8 +- .../screen/panels/button/CheckBoxPanel.kt | 5 +- .../panels/button/EnumRectangleButtonPanel.kt | 6 +- .../button/LargeRectangleButtonPanel.kt | 4 +- .../panels/button/RectangleButtonPanel.kt | 5 +- .../button/SmallRectangleButtonPanel.kt | 4 +- .../screen/panels/input/TextInputPanel.kt | 7 +- .../screen/panels/slot/AbstractSlotPanel.kt | 10 +- .../screen/panels/slot/InventorySlotPanel.kt | 3 +- .../client/screen/panels/slot/SlotPanel.kt | 9 +- .../panels/slot/UserFilteredSlotPanel.kt | 8 +- .../panels/util/AnalogScrollBarPanel.kt | 7 +- .../screen/panels/util/BackgroundPanel.kt | 4 +- .../panels/util/DiscreteScrollBarPanel.kt | 7 +- .../screen/storage/ItemMonitorScreen.kt | 8 +- .../screen/tech/AndroidStationScreen.kt | 17 +- .../client/screen/tech/EnergyServoScreen.kt | 4 +- .../screen/tech/EssenceStorageScreen.kt | 4 +- .../client/screen/widget/FluidGaugePanel.kt | 8 +- .../widget/HorizontalPowerGaugePanel.kt | 7 +- .../client/screen/widget/MatterGaugePanel.kt | 18 +- .../client/screen/widget/PatternGaugePanel.kt | 7 +- .../client/screen/widget/PowerGaugePanel.kt | 8 +- .../screen/widget/ProgressGaugePanel.kt | 7 +- .../mc/otm/compat/cos/CosmeticArmorCompat.kt | 6 +- .../dbotthepony/mc/otm/compat/jei/Gauges.kt | 5 +- .../compat/jei/IGUIRenderable2IDrawable.kt | 3 +- .../jei/MatterEntanglerRecipeCategory.kt | 17 +- .../otm/compat/jei/MicrowaveRecipeCategory.kt | 16 +- .../otm/compat/jei/PainterRecipeCategory.kt | 11 +- .../compat/jei/PlatePressRecipeCategory.kt | 17 +- 64 files changed, 532 insertions(+), 348 deletions(-) create mode 100644 src/main/kotlin/ru/dbotthepony/mc/otm/client/MGUIGraphics.kt diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidSwitchableFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidSwitchableFeature.kt index eb4bbe251..180729b85 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidSwitchableFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidSwitchableFeature.kt @@ -4,6 +4,7 @@ import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.multiplayer.ClientLevel import net.minecraft.nbt.CompoundTag import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.core.math.RGBAColor import ru.dbotthepony.mc.otm.core.nbt.set @@ -47,7 +48,7 @@ abstract class AndroidSwitchableFeature(type: AndroidFeatureType<*>, android: Ma // TODO: GuiGraphics is stripped from server dist // but it doesn't seem to cause issues? - abstract fun renderIcon(graphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float, color: RGBAColor = RGBAColor.WHITE) + abstract fun renderIcon(graphics: MGUIGraphics, x: Float, y: Float, width: Float, height: Float, color: RGBAColor = RGBAColor.WHITE) override fun serializeNBT(): CompoundTag { return super.serializeNBT().also { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt index 30d4268dc..fc5610e7f 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt @@ -30,6 +30,7 @@ import ru.dbotthepony.mc.otm.android.AndroidActiveFeature import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.DynamicBufferSource import ru.dbotthepony.mc.otm.client.render.ResearchIcons import ru.dbotthepony.mc.otm.client.render.linesIgnoreZRenderType @@ -373,7 +374,7 @@ class EnderTeleporterFeature(capability: MatteryPlayerCapability) : AndroidActiv } } - override fun renderIcon(graphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float, color: RGBAColor) { + override fun renderIcon(graphics: MGUIGraphics, x: Float, y: Float, width: Float, height: Float, color: RGBAColor) { if (cooldown > 0) { RenderSystem.setShaderColor(1f, 0.4f, 0.4f, 1f) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ItemMagnetFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ItemMagnetFeature.kt index 1112beb02..68f0eed77 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ItemMagnetFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ItemMagnetFeature.kt @@ -9,6 +9,7 @@ import ru.dbotthepony.mc.otm.config.AndroidConfig import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.ResearchIcons import ru.dbotthepony.mc.otm.core.math.Vector @@ -119,7 +120,7 @@ class ItemMagnetFeature(capability: MatteryPlayerCapability) : AndroidSwitchable } } - override fun renderIcon(graphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float, color: RGBAColor) { + override fun renderIcon(graphics: MGUIGraphics, x: Float, y: Float, width: Float, height: Float, color: RGBAColor) { ResearchIcons.ICON_ITEM_MAGNET.render(graphics, x, y, width, height, color = color) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/JumpBoostFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/JumpBoostFeature.kt index 904efea81..910214ce3 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/JumpBoostFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/JumpBoostFeature.kt @@ -8,6 +8,7 @@ import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons import ru.dbotthepony.mc.otm.config.AndroidConfig import ru.dbotthepony.mc.otm.config.ClientConfig @@ -96,7 +97,7 @@ class JumpBoostFeature(capability: MatteryPlayerCapability) : AndroidSwitchableF } } - override fun renderIcon(graphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float, color: RGBAColor) { + override fun renderIcon(graphics: MGUIGraphics, x: Float, y: Float, width: Float, height: Float, color: RGBAColor) { ResearchIcons.ICON_JUMP_BOOST.render(graphics, x, y, width, height, color = if (cooldown > 0) color * RGBAColor.REDDISH else color) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NightVisionFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NightVisionFeature.kt index c7241d161..9c124ea68 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NightVisionFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NightVisionFeature.kt @@ -6,6 +6,7 @@ import net.minecraft.world.effect.MobEffects import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons import ru.dbotthepony.mc.otm.config.AndroidConfig import ru.dbotthepony.mc.otm.core.math.RGBAColor @@ -33,7 +34,7 @@ class NightVisionFeature(android: MatteryPlayerCapability) : AndroidSwitchableFe } } - override fun renderIcon(graphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float, color: RGBAColor) { + override fun renderIcon(graphics: MGUIGraphics, x: Float, y: Float, width: Float, height: Float, color: RGBAColor) { ResearchIcons.ICON_NIGHT_VISION.render(graphics, x, y, width, height, color = color) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt index a1bbe002f..b987457e8 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt @@ -12,6 +12,7 @@ import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons import ru.dbotthepony.mc.otm.config.AndroidConfig import ru.dbotthepony.mc.otm.core.damageType @@ -225,7 +226,7 @@ class ShockwaveFeature(capability: MatteryPlayerCapability) : AndroidSwitchableF ticker(false) } - override fun renderIcon(graphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float, color: RGBAColor) { + override fun renderIcon(graphics: MGUIGraphics, x: Float, y: Float, width: Float, height: Float, color: RGBAColor) { ResearchIcons.ICON_SHOCKWAVE.render(graphics, x, y, width, height, color = if (isOnCooldown) color * RGBAColor.REDDISH else color) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/StepAssistFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/StepAssistFeature.kt index a26e62bd8..ead87ccd9 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/StepAssistFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/StepAssistFeature.kt @@ -6,6 +6,7 @@ import net.minecraft.world.entity.ai.attributes.AttributeModifier import net.minecraftforge.common.ForgeMod import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons import ru.dbotthepony.mc.otm.core.math.RGBAColor import ru.dbotthepony.mc.otm.registry.AndroidFeatures @@ -55,7 +56,7 @@ class StepAssistFeature(android: MatteryPlayerCapability) : AndroidSwitchableFea sharedTick() } - override fun renderIcon(graphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float, color: RGBAColor) { + override fun renderIcon(graphics: MGUIGraphics, x: Float, y: Float, width: Float, height: Float, color: RGBAColor) { ResearchIcons.ICON_STEP_ASSIST.render(graphics, x, y, width, height, color = color) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/SwimBoostersFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/SwimBoostersFeature.kt index 24aaebbce..8938b8a23 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/SwimBoostersFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/SwimBoostersFeature.kt @@ -5,6 +5,7 @@ import net.minecraft.world.entity.ai.attributes.AttributeModifier import net.minecraftforge.common.ForgeMod import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons import ru.dbotthepony.mc.otm.config.AndroidConfig import ru.dbotthepony.mc.otm.core.math.RGBAColor @@ -29,7 +30,7 @@ class SwimBoostersFeature(android: MatteryPlayerCapability) : AndroidSwitchableF ply.getAttribute(ForgeMod.SWIM_SPEED.get())?.removeModifier(MODIFIER_ID) } - override fun renderIcon(graphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float, color: RGBAColor) { + override fun renderIcon(graphics: MGUIGraphics, x: Float, y: Float, width: Float, height: Float, color: RGBAColor) { ResearchIcons.ICON_LIMB_OVERCLOCKING.render(graphics, x, y, width, height, color = color) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidAbilityKeyMapping.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidAbilityKeyMapping.kt index fae782495..d6882919d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidAbilityKeyMapping.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidAbilityKeyMapping.kt @@ -57,18 +57,19 @@ object AndroidAbilityKeyMapping : KeyMapping("key.otm.android_ability", KeyConfl val x = minecraft.window.guiScaledWidth.toFloat() * .5f + iconSize / 2f val y = minecraft.window.guiScaledHeight.toFloat() * .5f - iconSize / 2f + val wrap = MGUIGraphics(event.guiGraphics) - feature.renderIcon(event.guiGraphics, x, y, iconSize, iconSize) + feature.renderIcon(wrap, x, y, iconSize, iconSize) if (feature.isOnCooldown) { val cooldownPct = feature.cooldownPercent if (cooldownPct > 0.0f) { val nodrawpixels = (iconSize * (1 - cooldownPct)).roundToInt().toFloat() - event.guiGraphics.renderRect(x, y + nodrawpixels, iconSize, iconSize - nodrawpixels, color = RGBAColor.HALF_TRANSPARENT) + wrap.renderRect(x, y + nodrawpixels, iconSize, iconSize - nodrawpixels, color = RGBAColor.HALF_TRANSPARENT) } - Widgets18.COOLDOWN.render(event.guiGraphics, x, y + iconSize, iconSize, iconSize) + Widgets18.COOLDOWN.render(wrap, x, y + iconSize, iconSize, iconSize) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt index 6dd666d48..086aaf640 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt @@ -246,6 +246,7 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon val poseStack = event.guiGraphics.pose() poseStack.pushPose() poseStack.translate(minecraft.window.guiScaledWidth.toDouble() / 2f, minecraft.window.guiScaledHeight.toDouble() / 2f, 0.0) + val wrap = MGUIGraphics(event.guiGraphics) for ((index, feature) in features.withIndex()) { var sin = sin((index + 0.5) * degreePerSlice).toFloat() @@ -257,17 +258,17 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon } val shift = size * 0.6f - feature.renderIcon(event.guiGraphics, -iconSize / 2f + shift * cos, -shift * sin - iconSize / 2f, iconSize, iconSize) + feature.renderIcon(wrap, -iconSize / 2f + shift * cos, -shift * sin - iconSize / 2f, iconSize, iconSize) - event.guiGraphics.draw(minecraft.font, feature.type.displayName, shift * cos + 1f, -shift * sin - iconSize / 1.5f + 1f, color = RGBAColor.BLACK, gravity = RenderGravity.CENTER_CENTER) - event.guiGraphics.draw(minecraft.font, feature.type.displayName, shift * cos, -shift * sin - iconSize / 1.5f, color = if (feature.isActive) RGBAColor.DARK_GREEN else RGBAColor.DARK_RED, gravity = RenderGravity.CENTER_CENTER) + wrap.draw(minecraft.font, feature.type.displayName, shift * cos + 1f, -shift * sin - iconSize / 1.5f + 1f, color = RGBAColor.BLACK, gravity = RenderGravity.CENTER_CENTER) + wrap.draw(minecraft.font, feature.type.displayName, shift * cos, -shift * sin - iconSize / 1.5f, color = if (feature.isActive) RGBAColor.DARK_GREEN else RGBAColor.DARK_RED, gravity = RenderGravity.CENTER_CENTER) if (feature.isOnCooldown && feature.cooldownPercent > 0.0f) { RenderSystem.setShaderColor(1f, 1f, 1f, 0.5f) drawArc(event.guiGraphics, shift * cos, -shift * sin, iconSize / 2f, 0f, PI / 2.0, PI / 2.0 + PI * 2.0 * feature.cooldownPercent.toDouble()) RenderSystem.setShaderColor(1f, 1f, 1f, 1f) - event.guiGraphics.draw(minecraft.font, formatTickDuration(feature.cooldown), shift * cos, -shift * sin + iconSize / 1.5f, color = RGBAColor.WHITE, gravity = RenderGravity.CENTER_CENTER) + wrap.draw(minecraft.font, formatTickDuration(feature.cooldown), shift * cos, -shift * sin + iconSize / 1.5f, color = RGBAColor.WHITE, gravity = RenderGravity.CENTER_CENTER) } } @@ -296,15 +297,16 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon val y = minecraft.window.guiScaledHeight * 0.2f var x = minecraft.window.guiScaledWidth * 0.5f - (features.size.toFloat() * COOLDOWN_ICON_SIZE / 2f + (features.size - 1).toFloat() * (COOLDOWN_ICON_MARGIN / 2f)) + val wrap = MGUIGraphics(event.guiGraphics) for (feature in features) { - feature.renderIcon(event.guiGraphics, x, y, COOLDOWN_ICON_SIZE, COOLDOWN_ICON_SIZE) + feature.renderIcon(wrap, x, y, COOLDOWN_ICON_SIZE, COOLDOWN_ICON_SIZE) RenderSystem.setShaderColor(1f, 1f, 1f, 0.5f) drawArc(event.guiGraphics, x, y, COOLDOWN_ICON_SIZE / 2f, 0f, PI / 2.0, PI / 2.0 + PI * 2.0 * feature.cooldownPercent, alignAtCenter = false) RenderSystem.setShaderColor(1f, 1f, 1f, 1f) - event.guiGraphics.draw(font, formatTickDuration(feature.cooldown), x + COOLDOWN_ICON_SIZE / 2f, y + COOLDOWN_ICON_SIZE + 1f, color = RGBAColor.WHITE, gravity = RenderGravity.TOP_CENTER) + wrap.draw(font, formatTickDuration(feature.cooldown), x + COOLDOWN_ICON_SIZE / 2f, y + COOLDOWN_ICON_SIZE + 1f, color = RGBAColor.WHITE, gravity = RenderGravity.TOP_CENTER) x += COOLDOWN_ICON_SIZE + COOLDOWN_ICON_MARGIN } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/MGUIGraphics.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/MGUIGraphics.kt new file mode 100644 index 000000000..868fb7354 --- /dev/null +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/MGUIGraphics.kt @@ -0,0 +1,259 @@ +package ru.dbotthepony.mc.otm.client + +import com.mojang.blaze3d.vertex.PoseStack +import net.minecraft.client.gui.Font +import net.minecraft.client.gui.GuiGraphics +import net.minecraft.client.renderer.MultiBufferSource +import net.minecraft.client.renderer.texture.TextureAtlasSprite +import net.minecraft.network.chat.Component +import net.minecraft.resources.ResourceLocation +import net.minecraft.util.FormattedCharSequence +import net.minecraft.world.item.ItemStack +import ru.dbotthepony.mc.otm.client.render.GravityRounding +import ru.dbotthepony.mc.otm.client.render.IUVCoords +import ru.dbotthepony.mc.otm.client.render.RenderGravity +import ru.dbotthepony.mc.otm.client.render.UVCoords +import ru.dbotthepony.mc.otm.client.render.UVWindingOrder +import ru.dbotthepony.mc.otm.client.render.draw +import ru.dbotthepony.mc.otm.core.math.RGBAColor + +// polyfill class for 1.19.4 and older +class MGUIGraphics(val parent: GuiGraphics) { + val pose: PoseStack get() = parent.pose() + val bufferSource: MultiBufferSource.BufferSource get() = parent.bufferSource() + val width get() = parent.guiWidth() + val height get() = parent.guiHeight() + val font: Font get() = minecraft.font + + fun setColor(red: Float, green: Float, blue: Float, alpha: Float) { + parent.setColor(red, green, blue, alpha) + } + + fun renderFakeItem(itemStack: ItemStack, x: Int, y: Int) { + parent.renderFakeItem(itemStack, x, y) + } + + fun drawLine( + startX: Float, + startY: Float, + endX: Float, + endY: Float, + width: Float, + z: Float = 0f, + color: RGBAColor = RGBAColor.WHITE + ) { + ru.dbotthepony.mc.otm.client.render.drawLine(pose.last().pose(), startX, startY, endX, endY, width, z, color) + } + + fun renderRect( + x: Float, + y: Float, + width: Float, + height: Float, + z: Float = 0f, + color: RGBAColor = RGBAColor.WHITE + ) { + ru.dbotthepony.mc.otm.client.render.renderRect(pose.last().pose(), x, y, width, height, z, color) + } + + fun renderTexturedRect( + x: Float, + y: Float, + width: Float, + height: Float, + z: Float = 0f, + uv: IUVCoords = defaultUV, + uvWinding: UVWindingOrder = UVWindingOrder.NORMAL, + color: RGBAColor = RGBAColor.WHITE, + texture: ResourceLocation? = null + ) { + ru.dbotthepony.mc.otm.client.render.renderTexturedRect(pose.last().pose(), x, y, width, height, z, uv, uvWinding, color, texture) + } + + fun renderCheckerboard( + x: Float, + y: Float, + width: Float, + height: Float, + z: Float = 0f, + color: RGBAColor = RGBAColor.WHITE + ) { + ru.dbotthepony.mc.otm.client.render.renderCheckerboard(pose.last().pose(), x, y, width, height, z, color) + } + + fun renderComponentTooltip(font: Font, lines: MutableList, x: Int, y: Int, itemStack: ItemStack = ItemStack.EMPTY) { + parent.renderComponentTooltip(font, lines, x, y, itemStack) + } + + fun flush() { + parent.flush() + } + + fun draw( + font: Font, + text: String, + x: Float = 0f, + y: Float = 0f, + gravity: RenderGravity = RenderGravity.TOP_LEFT, + scale: Float = 1f, + color: RGBAColor = RGBAColor.WHITE, + drawShadow: Boolean = false, + displayMode: Font.DisplayMode = Font.DisplayMode.NORMAL, + packedLightCoords: Int = 15728880, + effectColor: Int = 0, + shadowColor: RGBAColor = RGBAColor.BLACK, + shadowX: Float = 1f, + shadowY: Float = 1f, + shadowZ: Float = -0.1f, + customShadow: Boolean = false, + rounding: GravityRounding = if (scale == 1f) GravityRounding.DEFAULT else GravityRounding.NO, + drawOutline: Boolean = false, + outlineColor: RGBAColor = RGBAColor.BLACK, + outlineZ: Float = -0.1f, + ): Float { + val width = font.draw( + poseStack = pose, + text = text, + x = x, + y = y, + buffer = bufferSource, + gravity = gravity, + scale = scale, + color = color, + drawShadow = drawShadow, + displayMode = displayMode, + packedLightCoords = packedLightCoords, + effectColor = effectColor, + shadowColor = shadowColor, + shadowX = shadowX, + shadowY = shadowY, + shadowZ = shadowZ, + customShadow = customShadow, + rounding = rounding, + drawOutline = drawOutline, + outlineColor = outlineColor, + outlineZ = outlineZ, + ) + + flush() + return width + } + + fun draw( + font: Font, + text: Component, + x: Float = 0f, + y: Float = 0f, + gravity: RenderGravity = RenderGravity.TOP_LEFT, + scale: Float = 1f, + color: RGBAColor = RGBAColor.WHITE, + drawShadow: Boolean = false, + displayMode: Font.DisplayMode = Font.DisplayMode.NORMAL, + packedLightCoords: Int = 15728880, + effectColor: Int = 0, + shadowColor: RGBAColor = RGBAColor.BLACK, + shadowX: Float = 1f, + shadowY: Float = 1f, + shadowZ: Float = -0.1f, + customShadow: Boolean = false, + rounding: GravityRounding = if (scale == 1f) GravityRounding.DEFAULT else GravityRounding.NO, + drawOutline: Boolean = false, + outlineColor: RGBAColor = RGBAColor.BLACK, + outlineZ: Float = -0.1f, + ): Float { + val width = font.draw( + poseStack = pose, + text = text, + x = x, + y = y, + buffer = bufferSource, + gravity = gravity, + scale = scale, + color = color, + drawShadow = drawShadow, + displayMode = displayMode, + packedLightCoords = packedLightCoords, + effectColor = effectColor, + shadowColor = shadowColor, + shadowX = shadowX, + shadowY = shadowY, + shadowZ = shadowZ, + customShadow = customShadow, + rounding = rounding, + drawOutline = drawOutline, + outlineColor = outlineColor, + outlineZ = outlineZ, + ) + + flush() + return width + } + + fun draw( + font: Font, + text: FormattedCharSequence, + x: Float = 0f, + y: Float = 0f, + gravity: RenderGravity = RenderGravity.TOP_LEFT, + scale: Float = 1f, + color: RGBAColor = RGBAColor.WHITE, + drawShadow: Boolean = false, + displayMode: Font.DisplayMode = Font.DisplayMode.NORMAL, + packedLightCoords: Int = 15728880, + effectColor: Int = 0, + shadowColor: RGBAColor = RGBAColor.BLACK, + shadowX: Float = 1f, + shadowY: Float = 1f, + shadowZ: Float = -0.1f, + customShadow: Boolean = false, + rounding: GravityRounding = if (scale == 1f) GravityRounding.DEFAULT else GravityRounding.NO, + drawOutline: Boolean = false, + outlineColor: RGBAColor = RGBAColor.BLACK, + outlineZ: Float = -0.1f, + ): Float { + val width = font.draw( + poseStack = pose, + text = text, + x = x, + y = y, + buffer = bufferSource, + gravity = gravity, + scale = scale, + color = color, + drawShadow = drawShadow, + displayMode = displayMode, + packedLightCoords = packedLightCoords, + effectColor = effectColor, + shadowColor = shadowColor, + shadowX = shadowX, + shadowY = shadowY, + shadowZ = shadowZ, + customShadow = customShadow, + rounding = rounding, + drawOutline = drawOutline, + outlineColor = outlineColor, + outlineZ = outlineZ, + ) + + flush() + return width + } + + fun renderSprite( + sprite: TextureAtlasSprite, x: Float, y: Float, + width: Float = sprite.contents().width().toFloat(), + height: Float = sprite.contents().height().toFloat(), + color: RGBAColor = RGBAColor.WHITE + ) { + renderTexturedRect( + x, y, width, height, + uv = UVCoords(sprite.u0, sprite.v0, sprite.u1, sprite.v1), + texture = sprite.atlasLocation(), + color = color + ) + } + + companion object { + private val defaultUV = UVCoords(0f, 0f, 1f, 1f) + } +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt index 84912739a..737b26927 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt @@ -141,7 +141,8 @@ object MatteryGUI { return } - val stack = event.guiGraphics.pose() + val guiGraphics = MGUIGraphics(event.guiGraphics) + val stack = guiGraphics.pose val window = event.window stack.pushPose() @@ -164,7 +165,7 @@ object MatteryGUI { pushScissorRect(0, (scissorBase + scissorHeight * (1f - progress)).toInt(), window.width, (scissorHeight * progress * 2f).toInt()) - event.guiGraphics.renderRect( + guiGraphics.renderRect( 0f, y - 12f, window.guiScaledWidth.toFloat(), @@ -173,8 +174,8 @@ object MatteryGUI { val text = TranslatableComponent("otm.iteration", iteration) - event.guiGraphics.draw(minecraft.font, text, x + 1f, y + 1f, color = RGBAColor.BLACK, gravity = RenderGravity.CENTER_CENTER) - event.guiGraphics.draw(minecraft.font, text, x, y, color = RGBAColor.WHITE, gravity = RenderGravity.CENTER_CENTER) + guiGraphics.draw(minecraft.font, text, x + 1f, y + 1f, color = RGBAColor.BLACK, gravity = RenderGravity.CENTER_CENTER) + guiGraphics.draw(minecraft.font, text, x, y, color = RGBAColor.WHITE, gravity = RenderGravity.CENTER_CENTER) stack.scale(0.35f, 0.35f, 0.35f) @@ -190,8 +191,8 @@ object MatteryGUI { for (i in deathLog.indices.reversed()) { val component = deathLog[i] - event.guiGraphics.draw(minecraft.font, component.second, x + 1f, y + 1f, color = RGBAColor.BLACK, gravity = RenderGravity.CENTER_CENTER) - event.guiGraphics.draw(minecraft.font, component.second, x, y, color = RGBAColor(color, color, color), gravity = RenderGravity.CENTER_CENTER) + guiGraphics.draw(minecraft.font, component.second, x + 1f, y + 1f, color = RGBAColor.BLACK, gravity = RenderGravity.CENTER_CENTER) + guiGraphics.draw(minecraft.font, component.second, x, y, color = RGBAColor(color, color, color), gravity = RenderGravity.CENTER_CENTER) y += minecraft.font.lineHeight color = (color - 0x20).coerceAtLeast(0x0) @@ -252,18 +253,20 @@ object MatteryGUI { val leftPadding = ceil(level * 80f - 0.5f) + val guiGraphics = MGUIGraphics(event.guiGraphics) + if (ply.hasEffect(MobEffects.HUNGER)) { - CHARGE_HUNGER_BG.render(event.guiGraphics, left.toFloat(), top.toFloat()) - CHARGE_HUNGER.renderPartial(event.guiGraphics, left.toFloat() - leftPadding + 80f, top.toFloat(), width = leftPadding) + CHARGE_HUNGER_BG.render(guiGraphics, left.toFloat(), top.toFloat()) + CHARGE_HUNGER.renderPartial(guiGraphics, left.toFloat() - leftPadding + 80f, top.toFloat(), width = leftPadding) } else { - CHARGE_BG.render(event.guiGraphics, left.toFloat(), top.toFloat()) - CHARGE.renderPartial(event.guiGraphics, left.toFloat() - leftPadding + 80f, top.toFloat(), width = leftPadding) + CHARGE_BG.render(guiGraphics, left.toFloat(), top.toFloat()) + CHARGE.renderPartial(guiGraphics, left.toFloat() - leftPadding + 80f, top.toFloat(), width = leftPadding) } val formattedPower = mattery.androidEnergy.batteryLevel.formatPower() val scale = ClientConfig.HUD.BAR_TEXT_SCALE.toFloat() - event.guiGraphics.draw(gui.font, formattedPower, left + CHARGE_BG.width + 2f + scale, top + CHARGE_BG.height / 2f + scale, scale = scale, gravity = RenderGravity.CENTER_LEFT, color = RGBAColor.YELLOW, drawOutline = true) + guiGraphics.draw(gui.font, formattedPower, left + CHARGE_BG.width + 2f + scale, top + CHARGE_BG.height / 2f + scale, scale = scale, gravity = RenderGravity.CENTER_LEFT, color = RGBAColor.YELLOW, drawOutline = true) } } @@ -320,18 +323,20 @@ object MatteryGUI { val top: Int = height - gui.leftHeight gui.leftHeight += 10 - HEALTH_BG.render(event.guiGraphics, left.toFloat(), top.toFloat()) + val guiGraphics = MGUIGraphics(event.guiGraphics) + + HEALTH_BG.render(guiGraphics, left.toFloat(), top.toFloat()) if (mattery.hasFeature(AndroidFeatures.NANOBOTS_ARMOR)) { val featArmor = mattery.getFeature(AndroidFeatures.NANOBOTS_ARMOR) as NanobotsArmorFeature val levelArmor: Float = (featArmor.layers.toFloat() / (featArmor.strength + 1).toFloat()).coerceIn(0.0f, 1.0f) - HEALTH_BG_NANOBOTS.renderPartial(event.guiGraphics, left.toFloat(), top.toFloat(), width = ceil(levelArmor * 81f)) + HEALTH_BG_NANOBOTS.renderPartial(guiGraphics, left.toFloat(), top.toFloat(), width = ceil(levelArmor * 81f)) } - getSpriteForPlayer(ply).renderPartial(event.guiGraphics, left.toFloat(), top.toFloat(), width = ceil(level * 80f - 0.5f)) + getSpriteForPlayer(ply).renderPartial(guiGraphics, left.toFloat(), top.toFloat(), width = ceil(level * 80f - 0.5f)) if (levelAbsorb > 0) { - HEALTH_ABSORB.renderPartial(event.guiGraphics, left.toFloat(), top.toFloat(), width = ceil(levelAbsorb * 80f - 0.5f)) + HEALTH_ABSORB.renderPartial(guiGraphics, left.toFloat(), top.toFloat(), width = ceil(levelAbsorb * 80f - 0.5f)) } var formattedHealth = TextComponent("%d/%d".format(ply.health.toInt(), ply.maxHealth.toInt())) @@ -340,7 +345,7 @@ object MatteryGUI { formattedHealth = TextComponent("%d+%d/%d".format(ply.health.toInt(), ply.absorptionAmount.toInt(), ply.maxHealth.toInt())) val scale = ClientConfig.HUD.BAR_TEXT_SCALE.toFloat() - event.guiGraphics.draw(minecraft.font, formattedHealth, left - 2f, top + HEALTH_BG.height / 2f + 1f * scale, scale = scale, gravity = RenderGravity.CENTER_RIGHT, color = getHealthColorForPlayer(ply), drawOutline = true) + guiGraphics.draw(minecraft.font, formattedHealth, left - 2f, top + HEALTH_BG.height / 2f + 1f * scale, scale = scale, gravity = RenderGravity.CENTER_RIGHT, color = getHealthColorForPlayer(ply), drawOutline = true) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/FontRenderer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/FontRenderer.kt index 4e43bc1bb..e5b7d8a1d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/FontRenderer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/FontRenderer.kt @@ -327,11 +327,12 @@ fun Font.draw( ) } -fun GuiGraphics.draw( - font: Font, - text: Component, +fun Font.draw( + poseStack: PoseStack, + text: FormattedCharSequence, x: Float = 0f, y: Float = 0f, + buffer: MultiBufferSource = buffer(), gravity: RenderGravity = RenderGravity.TOP_LEFT, scale: Float = 1f, color: RGBAColor = RGBAColor.WHITE, @@ -342,19 +343,19 @@ fun GuiGraphics.draw( shadowColor: RGBAColor = RGBAColor.BLACK, shadowX: Float = 1f, shadowY: Float = 1f, - shadowZ: Float = -0.1f, + shadowZ: Float = 0.1f, customShadow: Boolean = false, rounding: GravityRounding = if (scale == 1f) GravityRounding.DEFAULT else GravityRounding.NO, drawOutline: Boolean = false, outlineColor: RGBAColor = RGBAColor.BLACK, - outlineZ: Float = -0.1f, + outlineZ: Float = 0.1f, ): Float { - val width = font.draw( - poseStack = pose(), + return drawInternal( + poseStack = poseStack, text = text, x = x, y = y, - buffer = bufferSource(), + buffer = buffer, gravity = gravity, scale = scale, color = color, @@ -372,57 +373,4 @@ fun GuiGraphics.draw( outlineColor = outlineColor, outlineZ = outlineZ, ) - - flush() - return width -} - -fun GuiGraphics.draw( - font: Font, - text: String, - x: Float = 0f, - y: Float = 0f, - gravity: RenderGravity = RenderGravity.TOP_LEFT, - scale: Float = 1f, - color: RGBAColor = RGBAColor.WHITE, - drawShadow: Boolean = false, - displayMode: Font.DisplayMode = Font.DisplayMode.NORMAL, - packedLightCoords: Int = 15728880, - effectColor: Int = 0, - shadowColor: RGBAColor = RGBAColor.BLACK, - shadowX: Float = 1f, - shadowY: Float = 1f, - shadowZ: Float = -0.1f, - customShadow: Boolean = false, - rounding: GravityRounding = if (scale == 1f) GravityRounding.DEFAULT else GravityRounding.NO, - drawOutline: Boolean = false, - outlineColor: RGBAColor = RGBAColor.BLACK, - outlineZ: Float = -0.1f, -): Float { - val width = font.draw( - poseStack = pose(), - text = text, - x = x, - y = y, - buffer = bufferSource(), - gravity = gravity, - scale = scale, - color = color, - drawShadow = drawShadow, - displayMode = displayMode, - packedLightCoords = packedLightCoords, - effectColor = effectColor, - shadowColor = shadowColor, - shadowX = shadowX, - shadowY = shadowY, - shadowZ = shadowZ, - customShadow = customShadow, - rounding = rounding, - drawOutline = drawOutline, - outlineColor = outlineColor, - outlineZ = outlineZ, - ) - - flush() - return width } 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 f4ffa2179..acb2bc00d 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 @@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.client.render import net.minecraft.client.gui.GuiGraphics import net.minecraft.world.item.ItemStack +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.core.math.RGBAColor import ru.dbotthepony.mc.otm.systemTime import kotlin.math.sin @@ -23,7 +24,7 @@ interface IGUIRenderable { val winding: UVWindingOrder get() = UVWindingOrder.NORMAL fun render( - guiGraphics: GuiGraphics, + guiGraphics: MGUIGraphics, x: Float = 0f, y: Float = 0f, gravity: RenderGravity = RenderGravity.TOP_LEFT, @@ -37,7 +38,7 @@ interface IGUIRenderable { * Render at specified position [x], [y] with size of [width] x [height], optionally with UV [winding], if we are rendering flat texture/sprite */ fun render( - guiGraphics: GuiGraphics, + guiGraphics: MGUIGraphics, x: Float = 0f, y: Float = 0f, width: Float = this.width, @@ -53,7 +54,7 @@ interface IGUIRenderable { override val height: Float get() = this@IGUIRenderable.height.coerceAtLeast(other.height) - override fun render(guiGraphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float, winding: UVWindingOrder, color: RGBAColor) { + 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) } @@ -71,7 +72,7 @@ interface IGUIRenderable { override val height: Float get() = this@IGUIRenderable.height - override fun render(guiGraphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float, winding: UVWindingOrder, color: RGBAColor) { + 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) } } @@ -94,7 +95,7 @@ interface IGUIRenderable { override val height: Float get() = this@IGUIRenderable.height - override fun render(guiGraphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float, winding: UVWindingOrder, color: RGBAColor) { + override fun render(guiGraphics: MGUIGraphics, x: Float, y: Float, width: Float, height: Float, winding: UVWindingOrder, color: RGBAColor) { var realX = x var realY = y @@ -123,8 +124,8 @@ interface IGUIRenderable { } data class ItemStackIcon(private val itemStack: ItemStack, override val width: Float = 16f, override val height: Float = 16f) : IGUIRenderable { - override fun render(guiGraphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float, winding: UVWindingOrder, color: RGBAColor) { - val pose = guiGraphics.pose() + override fun render(guiGraphics: MGUIGraphics, x: Float, y: Float, width: Float, height: Float, winding: UVWindingOrder, color: RGBAColor) { + val pose = guiGraphics.pose pose.pushPose() pose.translate(x, y, 0f) @@ -140,7 +141,7 @@ data class ItemStackIcon(private val itemStack: ItemStack, override val width: F } data class FlatRectangleIcon(override val width: Float = 1f, override val height: Float = 1f, val color: RGBAColor) : IGUIRenderable { - override fun render(guiGraphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float, winding: UVWindingOrder, color: RGBAColor) { + 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) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/RenderHelper.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/RenderHelper.kt index 177c28726..4e5d00d33 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/RenderHelper.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/RenderHelper.kt @@ -17,6 +17,7 @@ import org.joml.Matrix4f import org.lwjgl.opengl.GL11.GL_ALWAYS import org.lwjgl.opengl.GL11.GL_LESS import ru.dbotthepony.mc.otm.OverdriveThatMatters +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.core.math.RGBAColor import java.util.* @@ -94,17 +95,6 @@ fun renderRect( tess.end() } -fun GuiGraphics.renderRect( - x: Float, - y: Float, - width: Float, - height: Float, - z: Float = 0f, - color: RGBAColor = RGBAColor.WHITE -) { - renderRect(pose().last().pose(), x, y, width, height, z, color) -} - @Suppress("NAME_SHADOWING") fun renderCheckerboard( matrix: Matrix4f, @@ -146,17 +136,6 @@ fun renderCheckerboard( tess.end() } -fun GuiGraphics.renderCheckerboard( - x: Float, - y: Float, - width: Float, - height: Float, - z: Float = 0f, - color: RGBAColor = RGBAColor.WHITE -) { - renderCheckerboard(pose().last().pose(), x, y, width, height, z, color) -} - fun renderTexturedRect( matrix: Matrix4f, x: Float, @@ -209,20 +188,6 @@ fun renderTexturedRect( BufferUploader.drawWithShader(builder.end()) } -fun GuiGraphics.renderTexturedRect( - x: Float, - y: Float, - width: Float, - height: Float, - z: Float = 0f, - uv: IUVCoords = defaultUV, - uvWinding: UVWindingOrder = UVWindingOrder.NORMAL, - color: RGBAColor = RGBAColor.WHITE, - texture: ResourceLocation? = null -) { - renderTexturedRect(pose().last().pose(), x, y, width, height, z, uv, uvWinding, color, texture) -} - fun renderColoredSphere(pose: PoseStack, radius: Float, color: RGBAColor = RGBAColor.WHITE) { val fragments = 32 RenderSystem.enableBlend() @@ -330,18 +295,6 @@ fun drawLine( tess.end() } -fun GuiGraphics.drawLine( - startX: Float, - startY: Float, - endX: Float, - endY: Float, - width: Float, - z: Float = 0f, - color: RGBAColor = RGBAColor.WHITE -) { - drawLine(pose().last().pose(), startX, startY, endX, endY, width, z, color) -} - data class ScissorRect(val x: Int, val y: Int, val width: Int, val height: Int, val lock: Boolean = false) { fun withinBounds(x: Int, y: Int): Boolean { return (x in this.x .. this.x + width) && (y in this.y .. this.y + height) @@ -447,13 +400,13 @@ fun TextureAtlasSprite.render( } fun TextureAtlasSprite.render( - graphics: GuiGraphics, + graphics: MGUIGraphics, x: Float = 0f, y: Float = 0f, width: Float, height: Float, winding: UVWindingOrder = UVWindingOrder.NORMAL -) = render(graphics.pose(), x, y, width, height, winding) +) = render(graphics.pose, x, y, width, height, winding) fun determineTooltipPosition(x: Float, y: Float, width: Float, height: Float): Pair { val windowWidth = minecraft.window.guiScaledWidth.toFloat() @@ -513,7 +466,7 @@ fun clearDepth(stack: PoseStack, x: Float, y: Float, width: Float, height: Float } @JvmOverloads -fun clearDepth(graphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float, depth: Float = -500f) = ru.dbotthepony.mc.otm.client.render.clearDepth(graphics.pose(), x, y, width, height, depth) +fun clearDepth(graphics: MGUIGraphics, x: Float, y: Float, width: Float, height: Float, depth: Float = -500f) = clearDepth(graphics.pose, x, y, width, height, depth) fun drawArc( stack: PoseStack, 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 90de4157e..aced04306 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 @@ -13,6 +13,7 @@ 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.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.IGUIRenderable import ru.dbotthepony.mc.otm.client.render.IUVCoords import ru.dbotthepony.mc.otm.client.render.UVWindingOrder @@ -51,7 +52,7 @@ sealed class AbstractMatterySprite : IGUIRenderable, IUVCoords { * See [ru.dbotthepony.mc.otm.client.render.clearDepth] */ fun clearDepth( - graphics: GuiGraphics, + graphics: MGUIGraphics, x: Float = 0f, y: Float = 0f, width: Float = this.width, @@ -70,7 +71,7 @@ sealed class AbstractMatterySprite : IGUIRenderable, IUVCoords { } override fun render( - guiGraphics: GuiGraphics, + guiGraphics: MGUIGraphics, x: Float, y: Float, width: Float, @@ -105,14 +106,14 @@ sealed class AbstractMatterySprite : IGUIRenderable, IUVCoords { } fun renderPartial( - graphics: GuiGraphics, + graphics: MGUIGraphics, x: Float = 0f, y: Float = 0f, width: Float = this.width, height: Float = this.height, winding: UVWindingOrder = this.winding, color: RGBAColor = RGBAColor.WHITE - ) = renderPartial(graphics.pose(), x, y, width, height, winding, color) + ) = renderPartial(graphics.pose, x, y, width, height, winding, color) protected fun uploadOnto( pose: PoseStack, diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/sprites/StretchingRectangleElement.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/sprites/StretchingRectangleElement.kt index f777b9f3f..9a37f6359 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/sprites/StretchingRectangleElement.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/sprites/StretchingRectangleElement.kt @@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.client.render.sprites import com.mojang.blaze3d.vertex.PoseStack import net.minecraft.client.gui.GuiGraphics import net.minecraft.resources.ResourceLocation +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.screen.panels.DockProperty data class StretchingRectangleElement( @@ -46,12 +47,12 @@ data class StretchingRectangleElement( @JvmOverloads fun render( - graphics: GuiGraphics, + graphics: MGUIGraphics, x: Float = 0f, y: Float = 0f, width: Float, height: Float, - ) = render(graphics.pose(), x, y, width, height) + ) = render(graphics.pose, x, y, width, height) companion object { fun square( diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatteryScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatteryScreen.kt index 67f24f1b2..7f4165f5a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatteryScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatteryScreen.kt @@ -17,6 +17,7 @@ import net.minecraftforge.client.event.ContainerScreenEvent.Render.Foreground import net.minecraftforge.common.MinecraftForge import org.lwjgl.opengl.GL11 import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.moveMousePosScaled import ru.dbotthepony.mc.otm.client.render.WidgetLocation import ru.dbotthepony.mc.otm.client.render.Widgets18 @@ -86,13 +87,13 @@ abstract class MatteryScreen(menu: T, inventory: Inventory, tit val quickCraftingType: Int get() = super.quickCraftingType val isQuickCrafting: Boolean get() = super.isQuickCrafting - fun renderItemStack(graphics: GuiGraphics, itemstack: ItemStack, countOverride: String? = null) { + fun renderItemStack(graphics: MGUIGraphics, itemstack: ItemStack, countOverride: String? = null) { if (!itemstack.isEmpty) { RenderSystem.enableDepthTest() - val (x, y) = graphics.pose().translation() + val (x, y) = graphics.pose.translation() - graphics.renderItem( + graphics.parent.renderItem( requireNotNull(ru.dbotthepony.mc.otm.client.minecraft.player) { "yo, dude, what the fuck" }, itemstack, 1, @@ -101,7 +102,7 @@ abstract class MatteryScreen(menu: T, inventory: Inventory, tit ) RenderSystem.depthFunc(GL11.GL_ALWAYS) - graphics.renderItemDecorations( + graphics.parent.renderItemDecorations( super.font, itemstack, 1, @@ -643,6 +644,7 @@ abstract class MatteryScreen(menu: T, inventory: Inventory, tit } override fun render(graphics: GuiGraphics, mouseX: Int, mouseY: Int, partialTick: Float) { + val wrap = MGUIGraphics(graphics) val mouseXf = mouseX.toFloat() val mouseYf = mouseY.toFloat() @@ -667,7 +669,7 @@ abstract class MatteryScreen(menu: T, inventory: Inventory, tit for (panel in panels.asReversed()) { RenderSystem.depthFunc(GL11.GL_ALWAYS) RenderSystem.setShaderColor(1f, 1f, 1f, 1f) - panel.render(graphics, mouseXf, mouseYf, partialTick) + panel.render(wrap, mouseXf, mouseYf, partialTick) } RenderSystem.depthFunc(GL11.GL_LESS) @@ -711,7 +713,7 @@ abstract class MatteryScreen(menu: T, inventory: Inventory, tit for (panel in panels) { RenderSystem.disableDepthTest() - if (panel.renderTooltips(graphics, mouseXf, mouseYf, partialTick)) { + if (panel.renderTooltips(wrap, mouseXf, mouseYf, partialTick)) { break } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/decorative/PainterScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/decorative/PainterScreen.kt index fd52916fd..8ea0afa09 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/decorative/PainterScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/decorative/PainterScreen.kt @@ -1,7 +1,6 @@ package ru.dbotthepony.mc.otm.client.screen.decorative import net.minecraft.ChatFormatting -import net.minecraft.client.gui.GuiGraphics import net.minecraft.network.chat.Component import net.minecraft.util.RandomSource import net.minecraft.world.entity.player.Inventory @@ -11,10 +10,9 @@ import net.minecraft.world.item.Items import net.minecraftforge.common.Tags import net.minecraftforge.registries.ForgeRegistries import ru.dbotthepony.mc.otm.block.entity.decorative.PainterBlockEntity +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.FlatRectangleIcon import ru.dbotthepony.mc.otm.client.render.ItemStackIcon -import ru.dbotthepony.mc.otm.client.render.renderCheckerboard -import ru.dbotthepony.mc.otm.client.render.renderRect import ru.dbotthepony.mc.otm.client.screen.MatteryScreen import ru.dbotthepony.mc.otm.client.screen.panels.Dock import ru.dbotthepony.mc.otm.client.screen.panels.DockResizeMode @@ -49,7 +47,7 @@ class PainterScreen(menu: PainterMenu, inventory: Inventory, title: Component) : tooltips.add(TextComponent("")) } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { graphics.renderRect(0f, 0f, width, height, color = RGBAColor.DARK_GRAY) val color = RGBAColor.rgb(dye?.textColor ?: DyeColor.LIGHT_BLUE.textColor) @@ -156,7 +154,7 @@ class PainterScreen(menu: PainterMenu, inventory: Inventory, title: Component) : get() = !recipe.value.canCraft(menu.dyeStoredDirect) set(value) {} - override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { + override fun innerRenderTooltips(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { val list = getTooltipFromItem(minecraft!!, recipeOutput) recipe.value.dyes.forEach { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/matter/MatterPanelScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/matter/MatterPanelScreen.kt index ee098227c..fe58af574 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/matter/MatterPanelScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/matter/MatterPanelScreen.kt @@ -1,12 +1,12 @@ package ru.dbotthepony.mc.otm.client.screen.matter import net.minecraft.ChatFormatting -import net.minecraft.client.gui.GuiGraphics import net.minecraft.network.chat.Component import net.minecraft.world.entity.player.Inventory import net.minecraft.world.item.ItemStack import ru.dbotthepony.mc.otm.capability.matter.PatternState import ru.dbotthepony.mc.otm.capability.matter.ReplicationTask +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.ShiftPressedCond import ru.dbotthepony.mc.otm.client.render.* import ru.dbotthepony.mc.otm.client.screen.MatteryScreen @@ -205,7 +205,7 @@ class MatterPanelScreen( return list } - override fun renderRegular(graphics: GuiGraphics, itemstack: ItemStack, countOverride: String?) { + override fun renderRegular(graphics: MGUIGraphics, itemstack: ItemStack, countOverride: String?) { if (isPatternView) { super.renderRegular(graphics, itemstack, "") 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 5bc85ec98..e37365d4b 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 @@ -8,12 +8,12 @@ import net.minecraft.client.gui.screens.Screen import net.minecraft.network.chat.Component import net.minecraft.resources.ResourceLocation import ru.dbotthepony.mc.otm.OverdriveThatMatters +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.playGuiClickSound import ru.dbotthepony.mc.otm.client.render.sprites.MatterySprite import ru.dbotthepony.mc.otm.client.render.RenderGravity import ru.dbotthepony.mc.otm.client.render.UVWindingOrder import ru.dbotthepony.mc.otm.client.render.WidgetLocation -import ru.dbotthepony.mc.otm.client.render.renderRect import ru.dbotthepony.mc.otm.client.screen.MatteryScreen import ru.dbotthepony.mc.otm.client.screen.panels.button.AbstractButtonPanel import ru.dbotthepony.mc.otm.client.screen.panels.input.TextInputPanel @@ -47,7 +47,7 @@ open class ColorBoxPanel( var isPressed = false private set - override fun shouldRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { + override fun shouldRenderTooltips(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { return super.shouldRenderTooltips(graphics, mouseX, mouseY, partialTick) || isPressed } @@ -103,7 +103,7 @@ open class ColorBoxPanel( return super.mouseReleasedInner(x, y, button) } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { graphics.renderRect(0f, 0f, width, height, color = RGBAColor.WHITE) GRADIENT_LEFT.render(graphics, 0f, 0f, width, height, color = backgroundColor) GRADIENT_DOWN.render(graphics, 0f, 0f, width, height, color = RGBAColor.BLACK) @@ -192,18 +192,18 @@ abstract class AbstractColorWangPanel( return super.mouseReleasedInner(x, y, button) } - protected fun renderGradients(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + protected fun renderGradients(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { ColorBoxPanel.GRADIENT_RIGHT.render(graphics, 0f, 0f, width, height, color = rightColor) ColorBoxPanel.GRADIENT_LEFT.render(graphics, 0f, 0f, width, height, color = leftColor) } - protected fun renderWang(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + 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) } } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { renderGradients(graphics, mouseX, mouseY, partialTick) renderWang(graphics, mouseX, mouseY, partialTick) } @@ -334,7 +334,7 @@ open class HueWangPanel( hueCallback?.accept(newPosition * 360f) } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { HSV_BAR.render(graphics, 0f, 0f, width, height) renderWang(graphics, mouseX, mouseY, partialTick) } @@ -457,7 +457,7 @@ open class ColorPalettePanel( onColorChoose(color) } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { graphics.renderRect(0f, 0f, width, height, color = RGBAColor.BLACK) graphics.renderRect(1f, 1f, width - 2f, height - 2f, color = color) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EditablePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EditablePanel.kt index 981705c2f..f4c776c13 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EditablePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EditablePanel.kt @@ -7,7 +7,6 @@ import it.unimi.dsi.fastutil.ints.IntAVLTreeSet import it.unimi.dsi.fastutil.objects.ReferenceArraySet import net.minecraft.client.gui.ComponentPath import net.minecraft.client.gui.Font -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.components.events.GuiEventListener import net.minecraft.client.gui.navigation.FocusNavigationEvent import net.minecraft.client.gui.navigation.ScreenRectangle @@ -18,6 +17,7 @@ import net.minecraft.world.inventory.Slot import net.minecraft.world.item.ItemStack import org.apache.logging.log4j.LogManager import ru.dbotthepony.mc.otm.SystemTime +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.moveMousePosScaled import ru.dbotthepony.mc.otm.client.render.currentScissorRect @@ -25,7 +25,6 @@ import ru.dbotthepony.mc.otm.client.render.popScissorRect import ru.dbotthepony.mc.otm.client.render.pushScissorRect import ru.dbotthepony.mc.otm.client.screen.MatteryScreen import ru.dbotthepony.mc.otm.client.screen.panels.input.QueryUserPanel -import ru.dbotthepony.mc.otm.core.collect.any import ru.dbotthepony.mc.otm.core.collect.concatIterators import ru.dbotthepony.mc.otm.core.collect.flatMap import java.util.* @@ -786,14 +785,14 @@ open class EditablePanel @JvmOverloads constructor( } } - protected open fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {} - protected open fun preRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {} - protected open fun innerRenderPost(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {} - protected open fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { + protected open fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {} + protected open fun preRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {} + protected open fun innerRenderPost(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {} + protected open fun innerRenderTooltips(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { return false } - protected open fun shouldRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { + protected open fun shouldRenderTooltips(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { return isEverHovered || isGrabbingMouseInput() } @@ -840,14 +839,14 @@ open class EditablePanel @JvmOverloads constructor( } } - fun render(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + fun render(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { once = true if (!isVisible()) { return } - val poseStack = graphics.pose() + val poseStack = graphics.pose performLayoutIfNeeded() @@ -1041,7 +1040,7 @@ open class EditablePanel @JvmOverloads constructor( return null to ItemStack.EMPTY } - fun renderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { + fun renderTooltips(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { if (!isVisible()) { return false } @@ -1829,7 +1828,7 @@ open class EditablePanel @JvmOverloads constructor( /** * See [ru.dbotthepony.mc.otm.client.render.clearDepth] */ - fun clearDepth(graphics: GuiGraphics, x: Float = 0f, y: Float = 0f, width: Float = this.width, height: Float = this.height) = ru.dbotthepony.mc.otm.client.render.clearDepth(graphics, x, y, width, height) + fun clearDepth(graphics: MGUIGraphics, x: Float = 0f, y: Float = 0f, width: Float = this.width, height: Float = this.height) = ru.dbotthepony.mc.otm.client.render.clearDepth(graphics, x, y, width, height) fun queryUser(title: Component, text: Component, onConfirm: Runnable, onCancel: Runnable? = null): QueryUserPanel { return QueryUserPanel(screen, title, listOf(text), onConfirm, onCancel).also { blockingWindow = it } 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 eba7920cf..faea0c2f1 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 @@ -3,13 +3,12 @@ package ru.dbotthepony.mc.otm.client.screen.panels import com.mojang.blaze3d.systems.RenderSystem import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap import it.unimi.dsi.fastutil.objects.Object2ObjectFunction -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen -import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen import net.minecraft.resources.ResourceLocation import net.minecraft.world.effect.MobEffect import net.minecraft.world.effect.MobEffectInstance import net.minecraft.world.entity.LivingEntity +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.RenderGravity import ru.dbotthepony.mc.otm.client.render.determineTooltipPosition @@ -109,7 +108,7 @@ open class EffectListPanel @JvmOverloads constructor( } } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { clearDepth(graphics) SQUARE_THIN.render(graphics, width = width, height = height) @@ -120,7 +119,7 @@ open class EffectListPanel @JvmOverloads constructor( graphics.draw(font, formatTickDuration(effect.duration), width / 2f, height / 2f, scale = 0.75f, gravity = RenderGravity.CENTER_CENTER, color = RGBAColor.WHITE) } - override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { + override fun innerRenderTooltips(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { if (isHovered) { val (x, y) = determineTooltipPosition(mouseX + 4f, mouseY - 12f, BAR.width, BAR.height) @@ -131,7 +130,7 @@ open class EffectListPanel @JvmOverloads constructor( val renderHeight = 18f minecraft.mobEffectTextures.get(effect.effect).render( - graphics.pose(), + graphics.pose, x = x + 8f, y = y + BAR.height / 2f - renderHeight / 2f, width = renderWidth, diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt index 10f1dd8e8..59cc05a94 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt @@ -1,6 +1,5 @@ package ru.dbotthepony.mc.otm.client.screen.panels -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen import net.minecraft.client.gui.screens.inventory.InventoryScreen @@ -8,6 +7,7 @@ import net.minecraft.world.entity.LivingEntity import net.minecraft.world.entity.player.Player import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.Widgets8 import ru.dbotthepony.mc.otm.client.render.sprites.sprite import ru.dbotthepony.mc.otm.client.screen.ExopackInventoryScreen @@ -165,13 +165,13 @@ class EntityRendererPanel @JvmOverloads constructor( } } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { if (entity.isDeadOrDying) { return } InventoryScreen.renderEntityInInventoryFollowsMouse( - graphics, + graphics.parent, 0, 0, this.width.toInt(), this.height.toInt(), renderScale, @@ -197,7 +197,7 @@ class EntityRendererPanel @JvmOverloads constructor( } } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { ExopackInventoryScreen.ENTITY_RECTANGLE.render(graphics) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/FramePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/FramePanel.kt index 7f74a2bd6..adcb9d5b0 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/FramePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/FramePanel.kt @@ -2,13 +2,13 @@ package ru.dbotthepony.mc.otm.client.screen.panels import com.mojang.blaze3d.platform.InputConstants import com.mojang.blaze3d.systems.RenderSystem -import net.minecraft.client.gui.GuiGraphics 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.network.chat.Component import org.lwjgl.opengl.GL30 +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.* import ru.dbotthepony.mc.otm.client.render.sprites.StretchingRectangleElement import ru.dbotthepony.mc.otm.client.screen.panels.button.AbstractButtonPanel @@ -76,7 +76,7 @@ open class FramePanel( return tabs.indexOf(this) } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { if (isActive) { if (tabIndex() == 0) { if (isDisabled) { @@ -167,7 +167,7 @@ open class FramePanel( close() } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { if (isPressed) { CLOSE_BUTTON_PRESSED.render(graphics, 0f, 0f, width, height) } else if (isHovered) { @@ -193,7 +193,7 @@ open class FramePanel( isActive = !isActive }*/ - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { /*if (isPressed) { HELP_BUTTON_PRESSED.render(graphics, 0f, 0f, width, height) } else*/ if (isHovered /*|| isActive */) { @@ -364,7 +364,7 @@ open class FramePanel( return super.keyPressedInternal(key, scancode, mods) } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { RECTANGLE.render(graphics, width = width, height = height) // title diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Label.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Label.kt index aa1cba389..413eb8510 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Label.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Label.kt @@ -1,8 +1,8 @@ package ru.dbotthepony.mc.otm.client.screen.panels -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen import net.minecraft.network.chat.Component +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.RenderGravity import ru.dbotthepony.mc.otm.client.render.draw import ru.dbotthepony.mc.otm.core.TextComponent @@ -31,7 +31,7 @@ open class Label @JvmOverloads constructor( var color = RGBAColor.SLATE_GRAY var gravity = RenderGravity.TOP_LEFT - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { clearDepth(graphics) if (shadow) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/NetworkedItemGridPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/NetworkedItemGridPanel.kt index d394b347d..4c6463c0c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/NetworkedItemGridPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/NetworkedItemGridPanel.kt @@ -1,17 +1,15 @@ package ru.dbotthepony.mc.otm.client.screen.panels import net.minecraft.ChatFormatting -import net.minecraft.client.gui.GuiGraphics import net.minecraft.network.chat.Component import net.minecraft.world.item.ItemStack +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.RenderGravity -import ru.dbotthepony.mc.otm.client.render.draw import ru.dbotthepony.mc.otm.client.screen.MatteryScreen import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel import ru.dbotthepony.mc.otm.client.screen.panels.util.DiscreteScrollBarPanel import ru.dbotthepony.mc.otm.client.screen.panels.util.GridPanel import ru.dbotthepony.mc.otm.client.screen.panels.util.ScrollBarConstants -import ru.dbotthepony.mc.otm.client.screen.storage.ItemMonitorScreen import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.core.math.integerDivisionDown import ru.dbotthepony.mc.otm.core.util.formatReadableNumber @@ -79,7 +77,7 @@ open class NetworkedItemGridPanel>( return true } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { renderSlotBackground(graphics, mouseX, mouseY, partialTick) val itemStack = view.sortedView.getOrNull(index)?.stack ?: StorageStack.ITEMS.empty renderRegular(graphics, itemStack.toItemStack(), "") diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Panel2Widget.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Panel2Widget.kt index 7fb05715d..722af0a2b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Panel2Widget.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Panel2Widget.kt @@ -4,6 +4,7 @@ import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.components.Renderable import net.minecraft.client.gui.components.events.GuiEventListener import net.minecraft.client.gui.screens.Screen +import ru.dbotthepony.mc.otm.client.MGUIGraphics // before 1.19.3 Renderable was Widget class Panel2Widget>( @@ -19,9 +20,11 @@ class Panel2Widget>( val xFloat = mouseX.toFloat() val yFloat = mouseY.toFloat() + val wrap = MGUIGraphics(graphics) + panel.tickHover(xFloat, yFloat) - panel.render(graphics, xFloat, yFloat, partialTick) - panel.renderTooltips(graphics, xFloat, yFloat, partialTick) + panel.render(wrap, xFloat, yFloat, partialTick) + panel.renderTooltips(wrap, xFloat, yFloat, partialTick) } override fun mouseMoved(mouseX: Double, mouseY: Double) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/SpritePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/SpritePanel.kt index c0c45b58a..14a17b776 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/SpritePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/SpritePanel.kt @@ -1,7 +1,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.sprites.AbstractMatterySprite import ru.dbotthepony.mc.otm.client.render.UVWindingOrder @@ -16,7 +16,7 @@ class SpritePanel( var winding: UVWindingOrder = sprite.winding, var centerSprite: Boolean = false ) : EditablePanel(screen, parent, x, y, width, height) { - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { if (centerSprite) { sprite.render(graphics, width / 2f - sprite.width / 2f, height / 2f - sprite.height / 2f, sprite.width, sprite.height, winding) } else { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Widget2Panel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Widget2Panel.kt index 0b25469ee..4b6a35793 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Widget2Panel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Widget2Panel.kt @@ -1,11 +1,10 @@ package ru.dbotthepony.mc.otm.client.screen.panels import com.mojang.blaze3d.systems.RenderSystem -import com.mojang.blaze3d.vertex.PoseStack -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.components.AbstractWidget import net.minecraft.client.gui.screens.Screen import org.lwjgl.opengl.GL11 +import ru.dbotthepony.mc.otm.client.MGUIGraphics abstract class Widget2Panel( screen: S, @@ -90,9 +89,9 @@ abstract class Widget2Panel( return instance } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { RenderSystem.depthFunc(GL11.GL_ALWAYS) - getOrCreateWidget().render(graphics, mouseX.toInt(), mouseY.toInt(), partialTick) + getOrCreateWidget().render(graphics.parent, mouseX.toInt(), mouseY.toInt(), partialTick) RenderSystem.depthFunc(GL11.GL_ALWAYS) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/AbstractButtonPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/AbstractButtonPanel.kt index 41baa457c..f2ebc5a4c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/AbstractButtonPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/AbstractButtonPanel.kt @@ -1,8 +1,8 @@ package ru.dbotthepony.mc.otm.client.screen.panels.button import com.mojang.blaze3d.platform.InputConstants -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.playGuiClickSound import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel import java.util.function.IntPredicate @@ -65,7 +65,7 @@ abstract class AbstractButtonPanel( return true } - override fun shouldRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { + override fun shouldRenderTooltips(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { return super.shouldRenderTooltips(graphics, mouseX, mouseY, partialTick) || isPressed } } 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 52e2c716d..4a8469438 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 @@ -1,9 +1,9 @@ package ru.dbotthepony.mc.otm.client.screen.panels.button import net.minecraft.ChatFormatting -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen import net.minecraft.network.chat.Component +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.IGUIRenderable import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel @@ -33,7 +33,7 @@ abstract class BooleanRectangleButtonPanel( onChange?.invoke(newValue) } - override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { + override fun innerRenderTooltips(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { if (isHovered) { val tooltipActive = tooltipActive val tooltipInactive = tooltipInactive @@ -79,7 +79,7 @@ abstract class BooleanRectangleButtonPanel( } set(value) { super.isDisabled = value } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { super.innerRender(graphics, mouseX, mouseY, partialTick) if (prop.value) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/ButtonPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/ButtonPanel.kt index 67a0c546f..ea5b0185b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/ButtonPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/ButtonPanel.kt @@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.button import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen import net.minecraft.network.chat.Component +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.RenderGravity import ru.dbotthepony.mc.otm.client.render.Widgets18 import ru.dbotthepony.mc.otm.client.render.draw @@ -39,7 +40,7 @@ open class ButtonPanel( onPress?.accept(mouseButton) } - protected fun renderStretchableBackground(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + protected fun renderStretchableBackground(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { if (isDisabled) { Widgets18.BUTTON_DISABLED_STRETCHABLE.render(graphics, width = width, height = height) } else if (isPressed) { @@ -51,7 +52,7 @@ open class ButtonPanel( } } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { renderStretchableBackground(graphics, mouseX, mouseY, partialTick) graphics.draw(font, label, width / 2f, height / 2f, color = textColor, gravity = RenderGravity.CENTER_CENTER) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/Buttons.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/Buttons.kt index 69b871904..a1c78aebe 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/Buttons.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/Buttons.kt @@ -2,7 +2,6 @@ package ru.dbotthepony.mc.otm.client.screen.panels.button import com.mojang.blaze3d.platform.InputConstants import net.minecraft.ChatFormatting -import net.minecraft.client.gui.GuiGraphics import net.minecraft.network.chat.Component import net.minecraft.world.item.ItemStack import net.minecraft.world.item.Items @@ -10,6 +9,7 @@ import ru.dbotthepony.mc.otm.block.entity.MatteryDeviceBlockEntity import ru.dbotthepony.mc.otm.block.entity.RedstoneSetting import ru.dbotthepony.mc.otm.capability.FlowDirection import ru.dbotthepony.mc.otm.capability.addUpgradeTooltipLines +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.isCtrlDown import ru.dbotthepony.mc.otm.client.isShiftDown import ru.dbotthepony.mc.otm.client.minecraft @@ -100,7 +100,7 @@ private class PullPushButton, T : Enum>( sprites[State(pull, push, value)] = sprite } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { super.innerRender(graphics, mouseX, mouseY, partialTick) sprites[State(pullProp.value, pushProp.value, prop.get())]?.render(graphics, 0f, 0f, width, height) } @@ -486,7 +486,7 @@ class DeviceControls>( tooltips.add(TranslatableComponent("otm.gui.upgrades")) } - override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { + override fun innerRenderTooltips(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { graphics.renderComponentTooltip(font, ArrayList().also { it.add(TranslatableComponent("otm.gui.upgrades")) it.add(TextComponent("")) @@ -624,7 +624,7 @@ class DeviceControls>( } } - override fun preRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun preRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { if (parent is FramePanel<*>) { x = parent!!.width + 3f y = dockTop 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 5c5693ae0..e92a13106 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 @@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.button import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.sprites.AbstractMatterySprite import ru.dbotthepony.mc.otm.client.render.WidgetLocation import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel @@ -25,7 +26,7 @@ open class CheckBoxPanel( open val DISABLED_UNCHECKED: AbstractMatterySprite = Companion.DISABLED_UNCHECKED open val DISABLED_CHECKED: AbstractMatterySprite = Companion.DISABLED_CHECKED - protected fun renderCheckboxBackground(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + protected fun renderCheckboxBackground(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { if (isDisabled) { if (isChecked.get()) { DISABLED_CHECKED.render(graphics, width = width, height = height) @@ -55,7 +56,7 @@ open class CheckBoxPanel( } } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { renderCheckboxBackground(graphics, mouseX, mouseY, partialTick) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/EnumRectangleButtonPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/EnumRectangleButtonPanel.kt index 9e6ee6522..d2af01f0d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/EnumRectangleButtonPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/EnumRectangleButtonPanel.kt @@ -2,9 +2,9 @@ package ru.dbotthepony.mc.otm.client.screen.panels.button import com.mojang.blaze3d.platform.InputConstants import net.minecraft.ChatFormatting -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen import net.minecraft.network.chat.Component +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.IGUIRenderable import ru.dbotthepony.mc.otm.client.render.UVWindingOrder @@ -70,7 +70,7 @@ abstract class EnumRectangleButtonPanel>( return this } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { check(!isBuilding) { "Still building this button!" } super.innerRender(graphics, mouseX, mouseY, partialTick) val entry = enumMapping[prop.get()] ?: return @@ -144,7 +144,7 @@ abstract class EnumRectangleButtonPanel>( } } - override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { + override fun innerRenderTooltips(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { if (tooltips.isEmpty() && enumMapping.entries.none { predicate.test(it.key) && it.value.tooltip != null }) { return super.innerRenderTooltips(graphics, mouseX, mouseY, partialTick) } 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 5515b17af..718230f23 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 @@ -1,7 +1,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.button -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.IGUIRenderable import ru.dbotthepony.mc.otm.client.render.UVWindingOrder @@ -26,7 +26,7 @@ open class LargeRectangleButtonPanel( final override val PRESSED = Widgets18.BUTTON_PRESSED final override val DISABLED = Widgets18.BUTTON_DISABLED - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { super.innerRender(graphics, mouseX, mouseY, partialTick) val color = if (isDisabled || isPressed) RGBAColor.DARK_GRAY else RGBAColor.WHITE diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/RectangleButtonPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/RectangleButtonPanel.kt index a89d1436b..16afdc8c9 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/RectangleButtonPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/RectangleButtonPanel.kt @@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.button import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.IGUIRenderable import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel import java.util.function.IntConsumer @@ -25,7 +26,7 @@ abstract class RectangleButtonPanel( onPress?.accept(mouseButton) } - protected fun renderSquareButton(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + protected fun renderSquareButton(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { if (isDisabled) { DISABLED.render(graphics, 0f, 0f, width, height) } else if (isPressed) { @@ -37,7 +38,7 @@ abstract class RectangleButtonPanel( } } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { renderSquareButton(graphics, mouseX, mouseY, partialTick) } } 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 3b2cab6a9..a6bf44fb3 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 @@ -1,7 +1,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.button -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.sprites.MatterySprite import ru.dbotthepony.mc.otm.client.render.UVWindingOrder import ru.dbotthepony.mc.otm.client.render.Widgets8 @@ -23,7 +23,7 @@ open class SmallRectangleButtonPanel( final override val PRESSED = Widgets8.BUTTON_PRESSED final override val DISABLED = Widgets8.BUTTON_DISABLED - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { super.innerRender(graphics, mouseX, mouseY, partialTick) if (skinElementWinding != null) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/input/TextInputPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/input/TextInputPanel.kt index 328a0d943..b1a63bc0a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/input/TextInputPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/input/TextInputPanel.kt @@ -9,11 +9,11 @@ import it.unimi.dsi.fastutil.chars.Char2IntOpenHashMap import it.unimi.dsi.fastutil.chars.CharOpenHashSet import it.unimi.dsi.fastutil.ints.Int2ObjectAVLTreeMap import it.unimi.dsi.fastutil.ints.Int2ObjectMap -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen import net.minecraft.client.renderer.GameRenderer import net.minecraft.network.chat.Component import org.joml.Vector2i +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.isCtrlDown import ru.dbotthepony.mc.otm.client.isShiftDown import ru.dbotthepony.mc.otm.client.minecraft @@ -21,7 +21,6 @@ import ru.dbotthepony.mc.otm.client.playGuiClickSound import ru.dbotthepony.mc.otm.client.render.DynamicBufferSource import ru.dbotthepony.mc.otm.client.render.RenderGravity import ru.dbotthepony.mc.otm.client.render.draw -import ru.dbotthepony.mc.otm.client.render.renderRect import ru.dbotthepony.mc.otm.client.render.tesselator import ru.dbotthepony.mc.otm.client.screen.panels.DockProperty import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel @@ -1117,7 +1116,7 @@ open class TextInputPanel( return accumulate } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { if (!backgroundColor.isFullyTransparent) graphics.renderRect(0f, 0f, width, height, color = backgroundColor) @@ -1153,7 +1152,7 @@ open class TextInputPanel( scrollPixels = 0f } - val stack = graphics.pose() + val stack = graphics.pose stack.pushPose() stack.translate(-scrollPixels, 0f, 0f) 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 f98bbd7fe..6d4f7bbb6 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 @@ -1,12 +1,12 @@ package ru.dbotthepony.mc.otm.client.screen.panels.slot import com.mojang.blaze3d.systems.RenderSystem -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen.getTooltipFromItem import net.minecraft.client.renderer.GameRenderer import net.minecraft.network.chat.Component import net.minecraft.world.item.ItemStack import net.minecraftforge.client.extensions.common.IClientItemExtensions +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.* import ru.dbotthepony.mc.otm.client.screen.MatteryScreen import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel @@ -24,12 +24,12 @@ abstract class AbstractSlotPanel> @JvmOverloads constru open var slotBackground: IGUIRenderable? = null open var slotBackgroundEmpty: IGUIRenderable? = null - protected open fun renderSlotBackground(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + protected open fun renderSlotBackground(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { SLOT_BACKGROUND.render(graphics, width = width, height = height) slotBackground?.render(graphics, 0f, 0f, width, height) } - protected open fun renderRegular(graphics: GuiGraphics, itemstack: ItemStack, countOverride: String? = null) { + protected open fun renderRegular(graphics: MGUIGraphics, itemstack: ItemStack, countOverride: String? = null) { RenderSystem.setShader(GameRenderer::getPositionTexShader) if (!itemstack.isEmpty) { @@ -46,7 +46,7 @@ abstract class AbstractSlotPanel> @JvmOverloads constru return getTooltipFromItem(ru.dbotthepony.mc.otm.client.minecraft, stack) } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { renderSlotBackground(graphics, mouseX, mouseY, partialTick) val itemStack = itemStack renderRegular(graphics, itemStack) @@ -56,7 +56,7 @@ abstract class AbstractSlotPanel> @JvmOverloads constru } } - override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { + override fun innerRenderTooltips(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { if (isHovered) { val itemstack = itemStack diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/InventorySlotPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/InventorySlotPanel.kt index 405909afb..5e044dc99 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/InventorySlotPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/InventorySlotPanel.kt @@ -3,6 +3,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.slot import com.mojang.blaze3d.platform.InputConstants import net.minecraft.client.gui.GuiGraphics import net.minecraft.world.item.Item +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.isAltDown import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.playGuiClickSound @@ -22,7 +23,7 @@ open class InventorySlotPanel, out T : MatteryMenu.Inve get() = slot.filter?.get() set(value) { slot.filter?.accept(value) } - override fun renderBackgroundBeforeFilter(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun renderBackgroundBeforeFilter(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { if (slot.chargeFlag?.get() == true) { Widgets18.CHARGE_SLOT_BACKGROUND.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 a1361b096..4d8ab5c90 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 @@ -4,14 +4,13 @@ package ru.dbotthepony.mc.otm.client.screen.panels.slot import com.mojang.blaze3d.systems.RenderSystem import net.minecraft.ChatFormatting -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.renderer.GameRenderer import net.minecraft.world.inventory.AbstractContainerMenu import net.minecraft.world.inventory.Slot import net.minecraft.world.item.ItemStack +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.Widgets18 -import ru.dbotthepony.mc.otm.client.render.renderRect import ru.dbotthepony.mc.otm.client.screen.MatteryScreen import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel import ru.dbotthepony.mc.otm.client.screen.panels.ISlotPanel @@ -52,7 +51,7 @@ open class SlotPanel, out T : Slot> @JvmOverloads const } } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { slot.x = absoluteX.roundToInt() - screen.guiLeft slot.y = absoluteY.roundToInt() - screen.guiTop renderSlotBackground(graphics, mouseX, mouseY, partialTick) @@ -99,7 +98,7 @@ open class SlotPanel, out T : Slot> @JvmOverloads const if (icon != null) { val texture = minecraft.getTextureAtlas(icon.first).apply(icon.second) RenderSystem.setShaderTexture(0, texture.atlasLocation()) - graphics.blit(1, 1, 0, 16, 16, texture) + graphics.renderSprite(texture, 1f, 1f, 16f, 16f) } else { slotBackgroundEmpty?.render(graphics, 0f, 0f, width = width, height = height) } @@ -112,7 +111,7 @@ open class SlotPanel, out T : Slot> @JvmOverloads const } } - override fun innerRenderTooltips(@Nonnull graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { + override fun innerRenderTooltips(@Nonnull graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { // no op, screen does it for us (completely) return false } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/UserFilteredSlotPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/UserFilteredSlotPanel.kt index 7c9ce2e35..bede6f80d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/UserFilteredSlotPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/UserFilteredSlotPanel.kt @@ -9,10 +9,10 @@ import net.minecraft.world.item.Item import net.minecraft.world.item.ItemStack import net.minecraft.world.item.Items import net.minecraftforge.client.extensions.common.IClientItemExtensions +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.isCtrlDown import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.playGuiClickSound -import ru.dbotthepony.mc.otm.client.render.renderRect import ru.dbotthepony.mc.otm.client.screen.MatteryScreen import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel import ru.dbotthepony.mc.otm.core.GetterSetter @@ -32,9 +32,9 @@ abstract class UserFilteredSlotPanel, out T : Slot>( ) : SlotPanel(screen, parent, slot, x, y, width, height) { abstract var slotFilter: Item? - protected open fun renderBackgroundBeforeFilter(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {} + protected open fun renderBackgroundBeforeFilter(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {} - override fun renderSlotBackground(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun renderSlotBackground(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { super.renderSlotBackground(graphics, mouseX, mouseY, partialTick) renderBackgroundBeforeFilter(graphics, mouseX, mouseY, partialTick) @@ -53,7 +53,7 @@ abstract class UserFilteredSlotPanel, out T : Slot>( } } - override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { + override fun innerRenderTooltips(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { if (isHovered && slotFilter != null && slotFilter !== Items.AIR && itemStack.isEmpty) { val itemstack = ItemStack(slotFilter!!, 1) 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 3338d0506..6b494bae7 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 @@ -1,9 +1,8 @@ package ru.dbotthepony.mc.otm.client.screen.panels.util import com.mojang.blaze3d.platform.InputConstants -import com.mojang.blaze3d.vertex.PoseStack -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel import ru.dbotthepony.mc.otm.core.math.linearInterpolation @@ -27,7 +26,7 @@ open class AnalogScrollBarPanel( var isScrolling = false private set - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + 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) @@ -99,7 +98,7 @@ open class AnalogScrollBarPanel( private var lastRender = milliTimeD - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + 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_TOP.render(graphics) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/util/BackgroundPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/util/BackgroundPanel.kt index 62ec2595b..12db90e3f 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/util/BackgroundPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/util/BackgroundPanel.kt @@ -1,7 +1,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.util -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.sprites.StretchingRectangleElement import ru.dbotthepony.mc.otm.client.render.WidgetLocation import ru.dbotthepony.mc.otm.client.screen.panels.DockProperty @@ -19,7 +19,7 @@ open class BackgroundPanel( dockPadding = DockProperty(3f, 3f, 3f, 3f) } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { RECTANGLE.render(graphics, width = width, height = height) } 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 c5944e053..317b65d2c 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 @@ -1,9 +1,8 @@ package ru.dbotthepony.mc.otm.client.screen.panels.util import com.mojang.blaze3d.platform.InputConstants -import com.mojang.blaze3d.vertex.PoseStack -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel import kotlin.math.roundToInt @@ -21,7 +20,7 @@ open class DiscreteScrollBarPanel( var isScrolling = false private set - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + 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) @@ -91,7 +90,7 @@ open class DiscreteScrollBarPanel( val scrollButton = Button() - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + 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_TOP.render(graphics) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/ItemMonitorScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/ItemMonitorScreen.kt index 028c70702..d1541921a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/ItemMonitorScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/ItemMonitorScreen.kt @@ -1,12 +1,11 @@ package ru.dbotthepony.mc.otm.client.screen.storage -import net.minecraft.client.gui.GuiGraphics import net.minecraft.network.chat.Component import net.minecraft.world.entity.player.Inventory import net.minecraft.world.item.ItemStack import net.minecraft.world.item.Items import ru.dbotthepony.mc.otm.block.entity.storage.ItemMonitorPlayerSettings -import ru.dbotthepony.mc.otm.client.render.Widgets18 +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.screen.MatteryScreen import ru.dbotthepony.mc.otm.client.screen.panels.Dock import ru.dbotthepony.mc.otm.client.screen.panels.DockResizeMode @@ -14,8 +13,6 @@ import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel import ru.dbotthepony.mc.otm.client.screen.panels.NetworkedItemGridPanel import ru.dbotthepony.mc.otm.client.screen.panels.button.DeviceControls -import ru.dbotthepony.mc.otm.client.screen.panels.button.LargeBooleanRectangleButtonPanel -import ru.dbotthepony.mc.otm.client.screen.panels.button.LargeEnumRectangleButtonPanel import ru.dbotthepony.mc.otm.client.screen.panels.button.SmallEnumRectangleButtonPanel import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel import ru.dbotthepony.mc.otm.client.screen.panels.slot.BatterySlotPanel @@ -24,7 +21,6 @@ import ru.dbotthepony.mc.otm.client.screen.panels.util.BackgroundPanel import ru.dbotthepony.mc.otm.client.screen.panels.util.DiscreteScrollBarPanel import ru.dbotthepony.mc.otm.client.screen.panels.util.GridPanel import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel -import ru.dbotthepony.mc.otm.client.screen.widget.WidePowerGaugePanel import ru.dbotthepony.mc.otm.client.screen.widget.WideProfiledPowerGaugePanel import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.core.asGetterSetter @@ -73,7 +69,7 @@ class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Comp } val arrowAndButtons = object : EditablePanel(this@ItemMonitorScreen, bottomPanel, width = ProgressGaugePanel.GAUGE_BACKGROUND.width) { - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { ProgressGaugePanel.GAUGE_BACKGROUND.render(graphics, y = height / 2f - ProgressGaugePanel.GAUGE_BACKGROUND.height / 2f) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt index e1894af55..afdfb4583 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt @@ -6,7 +6,6 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectFunction import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap import net.minecraft.ChatFormatting import net.minecraft.client.Minecraft -import net.minecraft.client.gui.GuiGraphics import net.minecraft.network.chat.Component import net.minecraft.world.entity.player.Inventory import net.minecraft.world.item.ItemStack @@ -14,15 +13,13 @@ import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.android.AndroidResearch import ru.dbotthepony.mc.otm.android.AndroidResearchManager import ru.dbotthepony.mc.otm.android.AndroidResearchType -import ru.dbotthepony.mc.otm.block.entity.tech.AndroidStationBlockEntity import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.capability.MatteryCapability +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.playGuiClickSound import ru.dbotthepony.mc.otm.client.render.RenderGravity import ru.dbotthepony.mc.otm.client.render.Widgets18 -import ru.dbotthepony.mc.otm.client.render.drawLine -import ru.dbotthepony.mc.otm.client.render.renderRect import ru.dbotthepony.mc.otm.client.screen.MatteryScreen import ru.dbotthepony.mc.otm.client.screen.panels.* import ru.dbotthepony.mc.otm.client.screen.panels.button.ButtonPanel @@ -287,7 +284,7 @@ private class AndroidResearchButton( } } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { val hovered = screen.hoveredResearch val isBlockedByHovered = hovered != null && node.type in hovered.type.allBlocking @@ -314,7 +311,7 @@ private class AndroidResearchButton( } else if (itemIcon != null) { val itemstack = ItemStack(itemIcon, 1) - val stack = graphics.pose() + val stack = graphics.pose stack.pushPose() stack.translate(1f, 1f, 0f) screen.renderItemStack(graphics, itemstack) @@ -334,7 +331,7 @@ private class AndroidResearchButton( val text = node.type.iconText if (text != null) { - graphics.drawString(font, text.visualOrderText, width - font.width(text), height - font.lineHeight, -0x1, true) + graphics.draw(font, text.visualOrderText, width - font.width(text), height - font.lineHeight, color = RGBAColor.WHITE, drawShadow = true) } for (line in lines) { @@ -408,7 +405,7 @@ private class AndroidResearchButton( return true } - override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { + override fun innerRenderTooltips(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { if (isHovered) { val list = ArrayList().also { it.addAll(node.screenTooltipLines) } @@ -501,7 +498,7 @@ class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: I private var scroller: PreviewScrollers = PreviewScrollers.values().let { it[random.nextInt(it.size)] } private var firstTick = false - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { graphics.renderRect(0f, 0f, width, height, color = RGBAColor.BLACK) } @@ -648,7 +645,7 @@ class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: I gravity = RenderGravity.TOP_RIGHT } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { if (menu.energyWidget.level >= MachinesConfig.AndroidStation.ENERGY_PER_RESEARCH) { text = POWER_OK color = RGBAColor.LIGHT_GREEN diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EnergyServoScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EnergyServoScreen.kt index e6a65370d..9d88499be 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EnergyServoScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EnergyServoScreen.kt @@ -1,8 +1,8 @@ package ru.dbotthepony.mc.otm.client.screen.tech -import net.minecraft.client.gui.GuiGraphics import net.minecraft.network.chat.Component import net.minecraft.world.entity.player.Inventory +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.screen.MatteryScreen import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel import ru.dbotthepony.mc.otm.client.screen.panels.slot.BatterySlotPanel @@ -61,7 +61,7 @@ class EnergyServoScreen(menu: EnergyServoMenu, inventory: Inventory, title: Comp width = ProgressGaugePanel.GAUGE_BACKGROUND.width } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { ProgressGaugePanel.GAUGE_BACKGROUND.render(graphics) } } 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 9d8a4d725..c3cec2b2d 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 @@ -1,12 +1,12 @@ package ru.dbotthepony.mc.otm.client.screen.tech import net.minecraft.ChatFormatting -import net.minecraft.client.gui.GuiGraphics 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.MGUIGraphics import ru.dbotthepony.mc.otm.client.isShiftDown import ru.dbotthepony.mc.otm.client.playGuiClickSound import ru.dbotthepony.mc.otm.client.render.sprites.MatteryAtlas @@ -57,7 +57,7 @@ class EssenceStorageScreen(menu: EssenceStorageMenu, inventory: Inventory, title dockMargin = DockProperty(bottom = 3f) } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { BAR_BACKGROUND.render(graphics, width = width, height = height) val level = getLevelFromXp(menu.experienceStored) val progress = (menu.experienceStored - getTotalXpRequiredForLevel(level)).toDouble() / getXpRequiredForLevelUp(level).toDouble() 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 12dee13b7..2a7eb8e2e 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 @@ -3,7 +3,6 @@ package ru.dbotthepony.mc.otm.client.screen.widget import com.mojang.blaze3d.systems.RenderSystem import com.mojang.blaze3d.vertex.DefaultVertexFormat import com.mojang.blaze3d.vertex.VertexFormat -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen import net.minecraft.client.renderer.GameRenderer import net.minecraft.network.chat.Component @@ -12,6 +11,7 @@ import net.minecraft.world.inventory.InventoryMenu import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions import org.lwjgl.opengl.GL11 import ru.dbotthepony.mc.otm.OverdriveThatMatters +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.ShiftPressedCond import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.sprites.MatterySprite @@ -43,7 +43,7 @@ open class FluidGaugePanel( ) } - override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { + override fun innerRenderTooltips(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { if (isHovered) { graphics.renderComponentTooltip(font, makeTooltip(), mouseX.toInt(), mouseY.toInt()) return true @@ -52,7 +52,7 @@ open class FluidGaugePanel( return false } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { if (widget.percentage > 0.01f && widget.fluid.isNotEmpty) { val data = IClientFluidTypeExtensions.of(widget.fluid.fluid) val texture = data.stillTexture!! @@ -61,7 +61,7 @@ open class FluidGaugePanel( var height = (height * widget.percentage) / 16f var bottom = this.height - val matrix = graphics.pose().last().pose() + val matrix = graphics.pose.last().pose() val builder = tesselator.builder builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX) 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 6664b16c3..ba802387e 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 @@ -2,13 +2,14 @@ package ru.dbotthepony.mc.otm.client.screen.widget import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.UVWindingOrder import ru.dbotthepony.mc.otm.client.render.WidgetLocation import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget import ru.dbotthepony.mc.otm.menu.widget.ProfiledLevelGaugeWidget -private fun PowerGaugePanel<*>.doRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float, flop: Boolean) { +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) @@ -43,7 +44,7 @@ open class HorizontalPowerGaugePanel( ) : PowerGaugePanel(screen, parent, widget, x, y, width, height) { var flop = false - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { doRender(graphics, mouseX, mouseY, partialTick, flop) } @@ -81,7 +82,7 @@ open class HorizontalProfiledPowerGaugePanel( ) : ProfiledPowerGaugePanel(screen, parent, widget, x, y, width, height) { var flop = false - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { doRender(graphics, mouseX, mouseY, partialTick, flop) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/MatterGaugePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/MatterGaugePanel.kt index 4a94e9d9c..6a4e7a8e6 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/MatterGaugePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/MatterGaugePanel.kt @@ -3,7 +3,6 @@ package ru.dbotthepony.mc.otm.client.screen.widget import com.mojang.blaze3d.systems.RenderSystem import com.mojang.blaze3d.vertex.BufferUploader import com.mojang.blaze3d.vertex.DefaultVertexFormat -import com.mojang.blaze3d.vertex.PoseStack import com.mojang.blaze3d.vertex.VertexFormat import it.unimi.dsi.fastutil.ints.IntArrayList import net.minecraft.ChatFormatting @@ -13,7 +12,7 @@ import net.minecraft.client.renderer.GameRenderer import net.minecraft.network.chat.Component import org.lwjgl.opengl.GL11 import ru.dbotthepony.mc.otm.capability.AbstractProfiledStorage -import ru.dbotthepony.mc.otm.capability.matter.ProfiledMatterStorage +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.ShiftPressedCond import ru.dbotthepony.mc.otm.client.isShiftDown import ru.dbotthepony.mc.otm.client.minecraft @@ -25,7 +24,6 @@ import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.core.math.Decimal import ru.dbotthepony.mc.otm.core.util.formatMatter import ru.dbotthepony.mc.otm.core.util.formatMatterLevel -import ru.dbotthepony.mc.otm.core.util.formatPower import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget import ru.dbotthepony.mc.otm.menu.widget.ProfiledLevelGaugeWidget import ru.dbotthepony.mc.otm.nanoTime @@ -61,7 +59,7 @@ open class MatterGaugePanel @JvmOverloads constructor( ) } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { if (lastAbsoluteX == 0f && lastAbsoluteY == 0f) { lastAbsoluteX = absoluteX lastAbsoluteY = absoluteY @@ -85,7 +83,7 @@ open class MatterGaugePanel @JvmOverloads constructor( } } - override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { + override fun innerRenderTooltips(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { if (isHovered) { graphics.renderComponentTooltip(font, makeTooltip(), mouseX.toInt(), mouseY.toInt()) return true @@ -98,9 +96,9 @@ open class MatterGaugePanel @JvmOverloads constructor( val GAUGE_BACKGROUND = WidgetLocation.VERTICAL_GAUGES.sprite(x = 18f, width = 9f) val GAUGE_FOREGROUND = WidgetLocation.VERTICAL_GAUGES.sprite(x = 27f, width = 9f) - fun renderLevel(graphics: GuiGraphics, x: Float, y: Float, width: Float, height: Float, percentage: Float, wavesStrength: Float = 0.5f) { - graphics.pose().pushPose() - graphics.pose().translate(x, y, 0f) + fun renderLevel(graphics: MGUIGraphics, x: Float, y: Float, width: Float, height: Float, percentage: Float, wavesStrength: Float = 0.5f) { + graphics.pose.pushPose() + graphics.pose.translate(x, y, 0f) RenderSystem.setShader(GameRenderer::getPositionTexShader) RenderSystem.enableBlend() RenderSystem.defaultBlendFunc() @@ -112,7 +110,7 @@ open class MatterGaugePanel @JvmOverloads constructor( val u1 = GAUGE_FOREGROUND.u1 val v1 = GAUGE_FOREGROUND.v1 - val matrix = graphics.pose().last().pose() + val matrix = graphics.pose.last().pose() val builder = tesselator.builder builder.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_TEX) @@ -134,7 +132,7 @@ open class MatterGaugePanel @JvmOverloads constructor( } BufferUploader.drawWithShader(builder.end()) - graphics.pose().popPose() + graphics.pose.popPose() } } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/PatternGaugePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/PatternGaugePanel.kt index de68b55bf..445f1dd77 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/PatternGaugePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/PatternGaugePanel.kt @@ -1,9 +1,8 @@ package ru.dbotthepony.mc.otm.client.screen.widget -import com.mojang.blaze3d.vertex.PoseStack -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen import net.minecraft.network.chat.Component +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.WidgetLocation import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel import ru.dbotthepony.mc.otm.core.TranslatableComponent @@ -30,13 +29,13 @@ open class PatternGaugePanel @JvmOverloads constructor( ) } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { GAUGE_BACKGROUND.render(graphics) val height = this.height * widget.percentage GAUGE_FOREGROUND.renderPartial(graphics, y = this.height - height, height = height) } - override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { + override fun innerRenderTooltips(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { if (isHovered) { graphics.renderComponentTooltip(font, makeTooltip(), mouseX.toInt(), mouseY.toInt()) return true 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 4af6f338f..a5c9018d9 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 @@ -2,11 +2,10 @@ package ru.dbotthepony.mc.otm.client.screen.widget import it.unimi.dsi.fastutil.ints.IntArrayList import net.minecraft.ChatFormatting -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen import net.minecraft.network.chat.Component import ru.dbotthepony.mc.otm.capability.AbstractProfiledStorage -import ru.dbotthepony.mc.otm.capability.energy.ProfiledEnergyStorage +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.ShiftPressedCond import ru.dbotthepony.mc.otm.client.isShiftDown import ru.dbotthepony.mc.otm.client.minecraft @@ -15,7 +14,6 @@ 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.stream import ru.dbotthepony.mc.otm.core.util.formatPower import ru.dbotthepony.mc.otm.core.util.formatPowerLevel import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget @@ -41,7 +39,7 @@ open class PowerGaugePanel( ) } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { val height = this.height * widget.percentage if (width >= 18f) { @@ -63,7 +61,7 @@ open class PowerGaugePanel( } } - override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { + override fun innerRenderTooltips(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { if (isHovered) { graphics.renderComponentTooltip(font, makeTooltip(), mouseX.toInt(), mouseY.toInt()) return true 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 790691806..77627dafa 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 @@ -2,12 +2,11 @@ package ru.dbotthepony.mc.otm.client.screen.widget import com.mojang.blaze3d.platform.InputConstants import com.mojang.blaze3d.systems.RenderSystem -import com.mojang.blaze3d.vertex.PoseStack import mezz.jei.api.recipe.RecipeType import net.minecraft.ChatFormatting -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen import net.minecraft.network.chat.Component +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.UVWindingOrder import ru.dbotthepony.mc.otm.client.render.WidgetLocation import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel @@ -62,7 +61,7 @@ open class ProgressGaugePanel( return tooltip } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { if (widget.isStuck && tickCount % 40 <= 20) { RenderSystem.setShaderColor(0.75f, 0.4f, 0.4f, 1f) } @@ -82,7 +81,7 @@ open class ProgressGaugePanel( } } - override fun innerRenderTooltips(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { + override fun innerRenderTooltips(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { if (shouldRenderTooltips(graphics, mouseX, mouseY, partialTick)) { graphics.renderComponentTooltip(font, makeTooltip(), mouseX.toInt(), mouseY.toInt()) return true 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 8a3c76fa4..4be4d81a8 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 @@ -5,7 +5,6 @@ import lain.mods.cos.impl.ModObjects import lain.mods.cos.impl.client.PlayerRenderHandler import lain.mods.cos.impl.client.gui.GuiCosArmorInventory import lain.mods.cos.impl.network.packet.PacketSetSkinArmor -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen import net.minecraft.resources.ResourceLocation import net.minecraft.server.level.ServerPlayer @@ -16,6 +15,7 @@ import net.minecraft.world.inventory.InventoryMenu import net.minecraft.world.inventory.Slot import net.minecraft.world.item.ItemStack import net.minecraftforge.fml.ModList +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.sprites.MatterySprite import ru.dbotthepony.mc.otm.client.render.sprites.sprite @@ -175,7 +175,7 @@ class CosmeticToggleButton( } } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { val inv = ModObjects.invMan.getCosArmorInventoryClient(minecraft.player?.uuid ?: throw ConcurrentModificationException()) if (inv.isSkinArmor(index)) { @@ -214,7 +214,7 @@ class CosmeticToggleRenderButton( } } - override fun innerRender(graphics: GuiGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { + override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { if (PlayerRenderHandler.Disabled) { BUTTON_ACTIVE.render(graphics, width = width, height = height) } else { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/Gauges.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/Gauges.kt index 47c690e47..0f95d5934 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/Gauges.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/Gauges.kt @@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.compat.jei import net.minecraft.client.gui.GuiGraphics import net.minecraft.network.chat.Component +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.ShiftPressedCond import ru.dbotthepony.mc.otm.client.screen.widget.MatterGaugePanel import ru.dbotthepony.mc.otm.client.screen.widget.PowerGaugePanel @@ -12,7 +13,7 @@ import ru.dbotthepony.mc.otm.core.util.formatPower import ru.dbotthepony.mc.otm.systemTime fun renderMatterGauge( - guiGraphics: GuiGraphics, + guiGraphics: MGUIGraphics, x: Float, y: Float, width: Float = MatterGaugePanel.GAUGE_BACKGROUND.width, @@ -25,7 +26,7 @@ fun renderMatterGauge( } fun renderEnergyGauge( - guiGraphics: GuiGraphics, + guiGraphics: MGUIGraphics, x: Float, y: Float, width: Float = PowerGaugePanel.GAUGE_BACKGROUND.width, diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/IGUIRenderable2IDrawable.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/IGUIRenderable2IDrawable.kt index 7b168ca96..78cf691fc 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/IGUIRenderable2IDrawable.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/IGUIRenderable2IDrawable.kt @@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.compat.jei import mezz.jei.api.gui.drawable.IDrawable import net.minecraft.client.gui.GuiGraphics +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.IGUIRenderable class IGUIRenderable2IDrawable(val parent: IGUIRenderable) : IDrawable { @@ -14,6 +15,6 @@ class IGUIRenderable2IDrawable(val parent: IGUIRenderable) : IDrawable { } override fun draw(guiGraphics: GuiGraphics, xOffset: Int, yOffset: Int) { - parent.render(guiGraphics, xOffset.toFloat(), yOffset.toFloat()) + parent.render(MGUIGraphics(guiGraphics), xOffset.toFloat(), yOffset.toFloat()) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MatterEntanglerRecipeCategory.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MatterEntanglerRecipeCategory.kt index c01c26672..babfab971 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MatterEntanglerRecipeCategory.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MatterEntanglerRecipeCategory.kt @@ -11,6 +11,7 @@ import net.minecraft.client.gui.GuiGraphics import net.minecraft.network.chat.Component import net.minecraft.world.item.ItemStack import ru.dbotthepony.mc.otm.OverdriveThatMatters +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.ItemStackIcon import ru.dbotthepony.mc.otm.client.render.draw @@ -63,21 +64,25 @@ object MatterEntanglerRecipeCategory : IRecipeCategory, } override fun draw(guiGraphics: GuiGraphics, xOffset: Int, yOffset: Int) { + val wrap = MGUIGraphics(guiGraphics) + for (x in 0 until 3) { for (y in 0 until 3) { - AbstractSlotPanel.SLOT_BACKGROUND.render(guiGraphics, xOffset + x * 18f + 29f, yOffset + y * 18f + 3f) + AbstractSlotPanel.SLOT_BACKGROUND.render(wrap, xOffset + x * 18f + 29f, yOffset + y * 18f + 3f) } } - AbstractSlotPanel.SLOT_BACKGROUND.render(guiGraphics, xOffset + 115f, yOffset + 18f + 3f) - ProgressGaugePanel.GAUGE_BACKGROUND.render(guiGraphics, xOffset + 89f, yOffset + 18f + 4f) + AbstractSlotPanel.SLOT_BACKGROUND.render(wrap, xOffset + 115f, yOffset + 18f + 3f) + ProgressGaugePanel.GAUGE_BACKGROUND.render(wrap, xOffset + 89f, yOffset + 18f + 4f) } override fun draw(recipe: IMatterEntanglerRecipe, recipeSlotsView: IRecipeSlotsView, guiGraphics: GuiGraphics, mouseX: Double, mouseY: Double) { - renderMatterGauge(guiGraphics, 13f, 6f, drainSpeed = (recipe.matter / Decimal(300)).toFloat()) - renderEnergyGauge(guiGraphics, 4f, 6f, drainSpeed = (recipe.ticks / 2000.0).toFloat()) + val wrap = MGUIGraphics(guiGraphics) - guiGraphics.draw(minecraft.font, x = 85f, y = 45f, text = TranslatableComponent("otm.gui.recipe.ticks", recipe.ticks), drawShadow = true) + renderMatterGauge(wrap, 13f, 6f, drainSpeed = (recipe.matter / Decimal(300)).toFloat()) + renderEnergyGauge(wrap, 4f, 6f, drainSpeed = (recipe.ticks / 2000.0).toFloat()) + + wrap.draw(wrap.font, x = 85f, y = 45f, text = TranslatableComponent("otm.gui.recipe.ticks", recipe.ticks), drawShadow = true) } override fun getTooltipStrings(recipe: IMatterEntanglerRecipe, recipeSlotsView: IRecipeSlotsView, mouseX: Double, mouseY: Double): MutableList { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MicrowaveRecipeCategory.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MicrowaveRecipeCategory.kt index aa44b00ca..b175faa32 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MicrowaveRecipeCategory.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MicrowaveRecipeCategory.kt @@ -13,6 +13,7 @@ import net.minecraft.resources.ResourceLocation import net.minecraft.world.item.ItemStack import net.minecraft.world.item.crafting.Ingredient import ru.dbotthepony.mc.otm.OverdriveThatMatters +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.RenderGravity import ru.dbotthepony.mc.otm.client.render.draw @@ -52,12 +53,14 @@ object MicrowaveRecipeCategory : IRecipeCategory, IDrawable { @Suppress("name_shadowing") val yOffset = yOffset.toFloat() - AbstractSlotPanel.SLOT_BACKGROUND.render(graphics, X_INPUT + xOffset, Y_INPUT + yOffset) - AbstractSlotPanel.SLOT_BACKGROUND.render(graphics, X_OUTPUT + xOffset, Y_OUTPUT + yOffset) - ProgressGaugePanel.GAUGE_BACKGROUND.render(graphics, X_ARROW + xOffset, Y_ARROW + yOffset) + val wrap = MGUIGraphics(graphics) + + AbstractSlotPanel.SLOT_BACKGROUND.render(wrap, X_INPUT + xOffset, Y_INPUT + yOffset) + AbstractSlotPanel.SLOT_BACKGROUND.render(wrap, X_OUTPUT + xOffset, Y_OUTPUT + yOffset) + ProgressGaugePanel.GAUGE_BACKGROUND.render(wrap, X_ARROW + xOffset, Y_ARROW + yOffset) ProgressGaugePanel.GAUGE_FOREGROUND.renderPartial( - graphics, + wrap, X_ARROW + xOffset, Y_ARROW + yOffset, width = (((System.currentTimeMillis() % 4000L) / 4000f) * ProgressGaugePanel.GAUGE_FOREGROUND.width).roundToInt().toFloat()) @@ -70,12 +73,13 @@ object MicrowaveRecipeCategory : IRecipeCategory, IDrawable { mouseX: Double, mouseY: Double ) { - graphics.draw(minecraft.font, TranslatableComponent("otm.gui.recipe.ticks", recipe.workTime), 40f, 30f, gravity = RenderGravity.TOP_CENTER, color = RGBAColor.BLACK) + val wrap = MGUIGraphics(graphics) + wrap.draw(minecraft.font, TranslatableComponent("otm.gui.recipe.ticks", recipe.workTime), 40f, 30f, gravity = RenderGravity.TOP_CENTER, color = RGBAColor.BLACK) val average = recipe.experience.toString() if (average != "0.0") { - graphics.draw(minecraft.font, TranslatableComponent("gui.jei.category.smelting.experience", average), 40f, 1f, gravity = RenderGravity.TOP_CENTER, color = RGBAColor.BLACK) + wrap.draw(minecraft.font, TranslatableComponent("gui.jei.category.smelting.experience", average), 40f, 1f, gravity = RenderGravity.TOP_CENTER, color = RGBAColor.BLACK) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/PainterRecipeCategory.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/PainterRecipeCategory.kt index d6dfafbe4..8318337ea 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/PainterRecipeCategory.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/PainterRecipeCategory.kt @@ -14,6 +14,7 @@ import net.minecraft.world.item.ItemStack import net.minecraft.world.item.Items import net.minecraft.world.item.crafting.Ingredient import ru.dbotthepony.mc.otm.OverdriveThatMatters +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ItemStackIcon import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel @@ -71,15 +72,17 @@ object PainterRecipeCategory : IRecipeCategory, IDrawable { } override fun draw(guiGraphics: GuiGraphics, xOffset: Int, yOffset: Int) { + val wrap = MGUIGraphics(guiGraphics) + for (x in 0 .. 1) { for (y in 0 .. 2) { - AbstractSlotPanel.SLOT_BACKGROUND.render(guiGraphics, xOffset.toFloat() + x * 18f, yOffset.toFloat() + y * 18f) + AbstractSlotPanel.SLOT_BACKGROUND.render(wrap, xOffset.toFloat() + x * 18f, yOffset.toFloat() + y * 18f) } } - AbstractSlotPanel.SLOT_BACKGROUND.render(guiGraphics, xOffset.toFloat() + 49f, yOffset.toFloat() + 21f) - AbstractSlotPanel.SLOT_BACKGROUND.render(guiGraphics, xOffset.toFloat() + 99f, yOffset.toFloat() + 21f) + AbstractSlotPanel.SLOT_BACKGROUND.render(wrap, xOffset.toFloat() + 49f, yOffset.toFloat() + 21f) + AbstractSlotPanel.SLOT_BACKGROUND.render(wrap, xOffset.toFloat() + 99f, yOffset.toFloat() + 21f) - ProgressGaugePanel.GAUGE_BACKGROUND.render(guiGraphics, xOffset.toFloat() + 73f, yOffset.toFloat() + 22f) + ProgressGaugePanel.GAUGE_BACKGROUND.render(wrap, xOffset.toFloat() + 73f, yOffset.toFloat() + 22f) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/PlatePressRecipeCategory.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/PlatePressRecipeCategory.kt index b3955b5e1..4d2c5f4c2 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/PlatePressRecipeCategory.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/PlatePressRecipeCategory.kt @@ -13,6 +13,7 @@ import net.minecraft.resources.ResourceLocation import net.minecraft.world.item.ItemStack import net.minecraft.world.item.crafting.Ingredient import ru.dbotthepony.mc.otm.OverdriveThatMatters +import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.RenderGravity import ru.dbotthepony.mc.otm.client.render.draw @@ -52,12 +53,14 @@ object PlatePressRecipeCategory : IRecipeCategory, IDrawable { @Suppress("name_shadowing") val yOffset = yOffset.toFloat() - AbstractSlotPanel.SLOT_BACKGROUND.render(graphics, X_INPUT + xOffset, Y_INPUT + yOffset) - AbstractSlotPanel.SLOT_BACKGROUND.render(graphics, X_OUTPUT + xOffset, Y_OUTPUT + yOffset) - ProgressGaugePanel.GAUGE_BACKGROUND.render(graphics, X_ARROW + xOffset, Y_ARROW + yOffset) + val wrap = MGUIGraphics(graphics) + + AbstractSlotPanel.SLOT_BACKGROUND.render(wrap, X_INPUT + xOffset, Y_INPUT + yOffset) + AbstractSlotPanel.SLOT_BACKGROUND.render(wrap, X_OUTPUT + xOffset, Y_OUTPUT + yOffset) + ProgressGaugePanel.GAUGE_BACKGROUND.render(wrap, X_ARROW + xOffset, Y_ARROW + yOffset) ProgressGaugePanel.GAUGE_FOREGROUND.renderPartial( - graphics, + wrap, X_ARROW + xOffset, Y_ARROW + yOffset, width = (((System.currentTimeMillis() % 4000L) / 4000f) * ProgressGaugePanel.GAUGE_FOREGROUND.width).roundToInt().toFloat()) @@ -70,12 +73,14 @@ object PlatePressRecipeCategory : IRecipeCategory, IDrawable { mouseX: Double, mouseY: Double ) { - graphics.draw(minecraft.font, TranslatableComponent("otm.gui.recipe.ticks", recipe.workTime), 40f, 30f, gravity = RenderGravity.TOP_CENTER, color = RGBAColor.BLACK) + val wrap = MGUIGraphics(graphics) + + wrap.draw(minecraft.font, TranslatableComponent("otm.gui.recipe.ticks", recipe.workTime), 40f, 30f, gravity = RenderGravity.TOP_CENTER, color = RGBAColor.BLACK) val average = recipe.experience.toString() if (average != "0.0") { - graphics.draw(minecraft.font, TranslatableComponent("gui.jei.category.smelting.experience", average), 40f, 1f, gravity = RenderGravity.TOP_CENTER, color = RGBAColor.BLACK) + wrap.draw(minecraft.font, TranslatableComponent("gui.jei.category.smelting.experience", average), 40f, 1f, gravity = RenderGravity.TOP_CENTER, color = RGBAColor.BLACK) } } From d81d7885c0018db2a580b0f378c7a97a866dcea2 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Mon, 1 Jan 2024 02:40:58 +0700 Subject: [PATCH 2/4] And move it to render subpackage --- .../mc/otm/android/AndroidSwitchableFeature.kt | 3 +-- .../android/feature/EnderTeleporterFeature.kt | 3 +-- .../mc/otm/android/feature/ItemMagnetFeature.kt | 3 +-- .../mc/otm/android/feature/JumpBoostFeature.kt | 3 +-- .../otm/android/feature/NightVisionFeature.kt | 3 +-- .../mc/otm/android/feature/ShockwaveFeature.kt | 3 +-- .../mc/otm/android/feature/StepAssistFeature.kt | 4 +--- .../otm/android/feature/SwimBoostersFeature.kt | 3 +-- .../mc/otm/client/AndroidAbilityKeyMapping.kt | 3 +-- .../mc/otm/client/AndroidMenuKeyMapping.kt | 3 +-- .../mc/otm/client/render/IGUIRenderable.kt | 4 ---- .../mc/otm/client/{ => render}/MGUIGraphics.kt | 17 ++++++----------- .../mc/otm/client/render/RenderHelper.kt | 1 - .../render/sprites/AbstractMatterySprite.kt | 3 +-- .../sprites/StretchingRectangleElement.kt | 3 +-- .../mc/otm/client/screen/MatteryScreen.kt | 2 +- .../client/screen/decorative/PainterScreen.kt | 2 +- .../client/screen/matter/MatterPanelScreen.kt | 2 +- .../mc/otm/client/screen/panels/ColorPicker.kt | 3 +-- .../otm/client/screen/panels/EditablePanel.kt | 2 +- .../otm/client/screen/panels/EffectListPanel.kt | 3 +-- .../client/screen/panels/EntityRendererPanel.kt | 2 +- .../mc/otm/client/screen/panels/FramePanel.kt | 2 +- .../mc/otm/client/screen/panels/Label.kt | 3 +-- .../screen/panels/NetworkedItemGridPanel.kt | 2 +- .../mc/otm/client/screen/panels/Panel2Widget.kt | 2 +- .../mc/otm/client/screen/panels/SpritePanel.kt | 2 +- .../mc/otm/client/screen/panels/Widget2Panel.kt | 2 +- .../screen/panels/button/AbstractButtonPanel.kt | 2 +- .../button/BooleanRectangleButtonPanel.kt | 2 +- .../client/screen/panels/button/ButtonPanel.kt | 4 +--- .../otm/client/screen/panels/button/Buttons.kt | 2 +- .../screen/panels/button/CheckBoxPanel.kt | 3 +-- .../panels/button/EnumRectangleButtonPanel.kt | 2 +- .../panels/button/LargeRectangleButtonPanel.kt | 2 +- .../panels/button/RectangleButtonPanel.kt | 3 +-- .../panels/button/SmallRectangleButtonPanel.kt | 2 +- .../screen/panels/input/TextInputPanel.kt | 3 +-- .../screen/panels/slot/AbstractSlotPanel.kt | 2 +- .../screen/panels/slot/InventorySlotPanel.kt | 3 +-- .../otm/client/screen/panels/slot/SlotPanel.kt | 2 +- .../screen/panels/slot/UserFilteredSlotPanel.kt | 3 +-- .../screen/panels/util/AnalogScrollBarPanel.kt | 2 +- .../screen/panels/util/BackgroundPanel.kt | 2 +- .../panels/util/DiscreteScrollBarPanel.kt | 2 +- .../client/screen/storage/ItemMonitorScreen.kt | 2 +- .../client/screen/tech/AndroidStationScreen.kt | 2 +- .../otm/client/screen/tech/EnergyServoScreen.kt | 2 +- .../client/screen/tech/EssenceStorageScreen.kt | 2 +- .../otm/client/screen/widget/FluidGaugePanel.kt | 2 +- .../screen/widget/HorizontalPowerGaugePanel.kt | 3 +-- .../client/screen/widget/MatterGaugePanel.kt | 3 +-- .../client/screen/widget/PatternGaugePanel.kt | 2 +- .../otm/client/screen/widget/PowerGaugePanel.kt | 2 +- .../client/screen/widget/ProgressGaugePanel.kt | 2 +- .../mc/otm/compat/cos/CosmeticArmorCompat.kt | 2 +- .../ru/dbotthepony/mc/otm/compat/jei/Gauges.kt | 3 +-- .../otm/compat/jei/IGUIRenderable2IDrawable.kt | 2 +- .../compat/jei/MatterEntanglerRecipeCategory.kt | 4 +--- .../otm/compat/jei/MicrowaveRecipeCategory.kt | 3 +-- .../mc/otm/compat/jei/PainterRecipeCategory.kt | 2 +- .../otm/compat/jei/PlatePressRecipeCategory.kt | 3 +-- 62 files changed, 65 insertions(+), 105 deletions(-) rename src/main/kotlin/ru/dbotthepony/mc/otm/client/{ => render}/MGUIGraphics.kt (88%) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidSwitchableFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidSwitchableFeature.kt index 180729b85..13ab36b84 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidSwitchableFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/AndroidSwitchableFeature.kt @@ -1,10 +1,9 @@ package ru.dbotthepony.mc.otm.android -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.multiplayer.ClientLevel import net.minecraft.nbt.CompoundTag import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.core.math.RGBAColor import ru.dbotthepony.mc.otm.core.nbt.set diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt index fc5610e7f..a8b1dd50d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/EnderTeleporterFeature.kt @@ -3,7 +3,6 @@ package ru.dbotthepony.mc.otm.android.feature import com.mojang.blaze3d.systems.RenderSystem import com.mojang.blaze3d.vertex.PoseStack import net.minecraft.client.Camera -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.renderer.LevelRenderer import net.minecraft.core.BlockPos import net.minecraft.core.Direction @@ -30,7 +29,7 @@ import ru.dbotthepony.mc.otm.android.AndroidActiveFeature import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.capability.matteryPlayer -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.DynamicBufferSource import ru.dbotthepony.mc.otm.client.render.ResearchIcons import ru.dbotthepony.mc.otm.client.render.linesIgnoreZRenderType diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ItemMagnetFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ItemMagnetFeature.kt index 68f0eed77..1ddcd7f3b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ItemMagnetFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ItemMagnetFeature.kt @@ -1,6 +1,5 @@ package ru.dbotthepony.mc.otm.android.feature -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.multiplayer.ClientLevel import net.minecraft.network.FriendlyByteBuf import net.minecraft.world.entity.Entity @@ -9,7 +8,7 @@ import ru.dbotthepony.mc.otm.config.AndroidConfig import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.ResearchIcons import ru.dbotthepony.mc.otm.core.math.Vector diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/JumpBoostFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/JumpBoostFeature.kt index 910214ce3..d92f68fbe 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/JumpBoostFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/JumpBoostFeature.kt @@ -1,6 +1,5 @@ package ru.dbotthepony.mc.otm.android.feature -import net.minecraft.client.gui.GuiGraphics import net.minecraft.network.FriendlyByteBuf import net.minecraft.server.level.ServerPlayer import net.minecraft.sounds.SoundSource @@ -8,7 +7,7 @@ import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.capability.matteryPlayer -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons import ru.dbotthepony.mc.otm.config.AndroidConfig import ru.dbotthepony.mc.otm.config.ClientConfig diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NightVisionFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NightVisionFeature.kt index 9c124ea68..ad3ead63a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NightVisionFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/NightVisionFeature.kt @@ -1,12 +1,11 @@ package ru.dbotthepony.mc.otm.android.feature -import net.minecraft.client.gui.GuiGraphics import net.minecraft.world.effect.MobEffectInstance import net.minecraft.world.effect.MobEffects import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons import ru.dbotthepony.mc.otm.config.AndroidConfig import ru.dbotthepony.mc.otm.core.math.RGBAColor diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt index b987457e8..fe37b9113 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/ShockwaveFeature.kt @@ -1,7 +1,6 @@ package ru.dbotthepony.mc.otm.android.feature import it.unimi.dsi.fastutil.objects.ReferenceArraySet -import net.minecraft.client.gui.GuiGraphics import net.minecraft.network.FriendlyByteBuf import net.minecraft.server.level.ServerPlayer import net.minecraft.sounds.SoundSource @@ -12,7 +11,7 @@ import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.capability.energy.extractEnergyExact import ru.dbotthepony.mc.otm.capability.matteryPlayer -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons import ru.dbotthepony.mc.otm.config.AndroidConfig import ru.dbotthepony.mc.otm.core.damageType diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/StepAssistFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/StepAssistFeature.kt index ead87ccd9..74a4f7a3b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/StepAssistFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/StepAssistFeature.kt @@ -1,12 +1,10 @@ package ru.dbotthepony.mc.otm.android.feature -import com.mojang.blaze3d.vertex.PoseStack -import net.minecraft.client.gui.GuiGraphics import net.minecraft.world.entity.ai.attributes.AttributeModifier import net.minecraftforge.common.ForgeMod import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons import ru.dbotthepony.mc.otm.core.math.RGBAColor import ru.dbotthepony.mc.otm.registry.AndroidFeatures diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/SwimBoostersFeature.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/SwimBoostersFeature.kt index 8938b8a23..3129d4a24 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/SwimBoostersFeature.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/android/feature/SwimBoostersFeature.kt @@ -1,11 +1,10 @@ package ru.dbotthepony.mc.otm.android.feature -import net.minecraft.client.gui.GuiGraphics import net.minecraft.world.entity.ai.attributes.AttributeModifier import net.minecraftforge.common.ForgeMod import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ResearchIcons import ru.dbotthepony.mc.otm.config.AndroidConfig import ru.dbotthepony.mc.otm.core.math.RGBAColor diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidAbilityKeyMapping.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidAbilityKeyMapping.kt index d6882919d..d3301a692 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidAbilityKeyMapping.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidAbilityKeyMapping.kt @@ -1,7 +1,6 @@ package ru.dbotthepony.mc.otm.client import com.mojang.blaze3d.platform.InputConstants -import com.mojang.blaze3d.systems.RenderSystem import net.minecraft.client.KeyMapping import net.minecraftforge.client.event.RegisterKeyMappingsEvent import net.minecraftforge.client.event.RenderGuiEvent @@ -10,8 +9,8 @@ import net.minecraftforge.client.settings.KeyConflictContext import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.android.AndroidActiveFeature import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.Widgets18 -import ru.dbotthepony.mc.otm.client.render.renderRect import ru.dbotthepony.mc.otm.client.render.is3DContext import ru.dbotthepony.mc.otm.core.math.RGBAColor import ru.dbotthepony.mc.otm.network.ActivateAndroidFeaturePacket diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt index 086aaf640..4e1ffa3f3 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt @@ -13,10 +13,9 @@ import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.android.AndroidFeature import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature import ru.dbotthepony.mc.otm.capability.matteryPlayer +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.RenderGravity -import ru.dbotthepony.mc.otm.client.render.draw import ru.dbotthepony.mc.otm.client.render.drawArc -import ru.dbotthepony.mc.otm.core.TextComponent import ru.dbotthepony.mc.otm.core.math.RGBAColor import ru.dbotthepony.mc.otm.core.math.angleDifference import ru.dbotthepony.mc.otm.core.math.normalizeAngle 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 acb2bc00d..e73213175 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 @@ -1,11 +1,7 @@ package ru.dbotthepony.mc.otm.client.render -import net.minecraft.client.gui.GuiGraphics import net.minecraft.world.item.ItemStack -import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.core.math.RGBAColor -import ru.dbotthepony.mc.otm.systemTime -import kotlin.math.sin interface IGUIRenderable { /** diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/MGUIGraphics.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MGUIGraphics.kt similarity index 88% rename from src/main/kotlin/ru/dbotthepony/mc/otm/client/MGUIGraphics.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MGUIGraphics.kt index 868fb7354..398106369 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/MGUIGraphics.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MGUIGraphics.kt @@ -1,4 +1,4 @@ -package ru.dbotthepony.mc.otm.client +package ru.dbotthepony.mc.otm.client.render import com.mojang.blaze3d.vertex.PoseStack import net.minecraft.client.gui.Font @@ -9,12 +9,7 @@ import net.minecraft.network.chat.Component import net.minecraft.resources.ResourceLocation import net.minecraft.util.FormattedCharSequence import net.minecraft.world.item.ItemStack -import ru.dbotthepony.mc.otm.client.render.GravityRounding -import ru.dbotthepony.mc.otm.client.render.IUVCoords -import ru.dbotthepony.mc.otm.client.render.RenderGravity -import ru.dbotthepony.mc.otm.client.render.UVCoords -import ru.dbotthepony.mc.otm.client.render.UVWindingOrder -import ru.dbotthepony.mc.otm.client.render.draw +import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.core.math.RGBAColor // polyfill class for 1.19.4 and older @@ -42,7 +37,7 @@ class MGUIGraphics(val parent: GuiGraphics) { z: Float = 0f, color: RGBAColor = RGBAColor.WHITE ) { - ru.dbotthepony.mc.otm.client.render.drawLine(pose.last().pose(), startX, startY, endX, endY, width, z, color) + drawLine(pose.last().pose(), startX, startY, endX, endY, width, z, color) } fun renderRect( @@ -53,7 +48,7 @@ class MGUIGraphics(val parent: GuiGraphics) { z: Float = 0f, color: RGBAColor = RGBAColor.WHITE ) { - ru.dbotthepony.mc.otm.client.render.renderRect(pose.last().pose(), x, y, width, height, z, color) + renderRect(pose.last().pose(), x, y, width, height, z, color) } fun renderTexturedRect( @@ -67,7 +62,7 @@ class MGUIGraphics(val parent: GuiGraphics) { color: RGBAColor = RGBAColor.WHITE, texture: ResourceLocation? = null ) { - ru.dbotthepony.mc.otm.client.render.renderTexturedRect(pose.last().pose(), x, y, width, height, z, uv, uvWinding, color, texture) + renderTexturedRect(pose.last().pose(), x, y, width, height, z, uv, uvWinding, color, texture) } fun renderCheckerboard( @@ -78,7 +73,7 @@ class MGUIGraphics(val parent: GuiGraphics) { z: Float = 0f, color: RGBAColor = RGBAColor.WHITE ) { - ru.dbotthepony.mc.otm.client.render.renderCheckerboard(pose.last().pose(), x, y, width, height, z, color) + renderCheckerboard(pose.last().pose(), x, y, width, height, z, color) } fun renderComponentTooltip(font: Font, lines: MutableList, x: Int, y: Int, itemStack: ItemStack = ItemStack.EMPTY) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/RenderHelper.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/RenderHelper.kt index 4e5d00d33..26738c334 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/RenderHelper.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/RenderHelper.kt @@ -17,7 +17,6 @@ import org.joml.Matrix4f import org.lwjgl.opengl.GL11.GL_ALWAYS import org.lwjgl.opengl.GL11.GL_LESS import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.client.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.core.math.RGBAColor import java.util.* 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 aced04306..09013d598 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 @@ -6,14 +6,13 @@ 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.gui.GuiGraphics 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.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.IGUIRenderable import ru.dbotthepony.mc.otm.client.render.IUVCoords import ru.dbotthepony.mc.otm.client.render.UVWindingOrder diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/sprites/StretchingRectangleElement.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/sprites/StretchingRectangleElement.kt index 9a37f6359..bc68a78e1 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/sprites/StretchingRectangleElement.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/sprites/StretchingRectangleElement.kt @@ -1,9 +1,8 @@ package ru.dbotthepony.mc.otm.client.render.sprites import com.mojang.blaze3d.vertex.PoseStack -import net.minecraft.client.gui.GuiGraphics import net.minecraft.resources.ResourceLocation -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.screen.panels.DockProperty data class StretchingRectangleElement( diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatteryScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatteryScreen.kt index 7f4165f5a..1121a8146 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatteryScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatteryScreen.kt @@ -17,7 +17,7 @@ import net.minecraftforge.client.event.ContainerScreenEvent.Render.Foreground import net.minecraftforge.common.MinecraftForge import org.lwjgl.opengl.GL11 import ru.dbotthepony.mc.otm.capability.matteryPlayer -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.moveMousePosScaled import ru.dbotthepony.mc.otm.client.render.WidgetLocation import ru.dbotthepony.mc.otm.client.render.Widgets18 diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/decorative/PainterScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/decorative/PainterScreen.kt index 8ea0afa09..1d278384c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/decorative/PainterScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/decorative/PainterScreen.kt @@ -10,7 +10,7 @@ import net.minecraft.world.item.Items import net.minecraftforge.common.Tags import net.minecraftforge.registries.ForgeRegistries import ru.dbotthepony.mc.otm.block.entity.decorative.PainterBlockEntity -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.FlatRectangleIcon import ru.dbotthepony.mc.otm.client.render.ItemStackIcon import ru.dbotthepony.mc.otm.client.screen.MatteryScreen diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/matter/MatterPanelScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/matter/MatterPanelScreen.kt index fe58af574..0bf986089 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/matter/MatterPanelScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/matter/MatterPanelScreen.kt @@ -6,7 +6,7 @@ import net.minecraft.world.entity.player.Inventory import net.minecraft.world.item.ItemStack import ru.dbotthepony.mc.otm.capability.matter.PatternState import ru.dbotthepony.mc.otm.capability.matter.ReplicationTask -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.ShiftPressedCond import ru.dbotthepony.mc.otm.client.render.* import ru.dbotthepony.mc.otm.client.screen.MatteryScreen 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 e37365d4b..bd2fa0f0c 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 @@ -3,12 +3,11 @@ package ru.dbotthepony.mc.otm.client.screen.panels import com.mojang.blaze3d.platform.InputConstants import com.mojang.datafixers.util.Either import it.unimi.dsi.fastutil.floats.FloatConsumer -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen import net.minecraft.network.chat.Component import net.minecraft.resources.ResourceLocation import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.playGuiClickSound import ru.dbotthepony.mc.otm.client.render.sprites.MatterySprite import ru.dbotthepony.mc.otm.client.render.RenderGravity diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EditablePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EditablePanel.kt index f4c776c13..bde047208 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EditablePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EditablePanel.kt @@ -17,7 +17,7 @@ import net.minecraft.world.inventory.Slot import net.minecraft.world.item.ItemStack import org.apache.logging.log4j.LogManager import ru.dbotthepony.mc.otm.SystemTime -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.moveMousePosScaled import ru.dbotthepony.mc.otm.client.render.currentScissorRect 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 faea0c2f1..dbd05d60d 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 @@ -8,11 +8,10 @@ import net.minecraft.resources.ResourceLocation import net.minecraft.world.effect.MobEffect import net.minecraft.world.effect.MobEffectInstance import net.minecraft.world.entity.LivingEntity -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.RenderGravity import ru.dbotthepony.mc.otm.client.render.determineTooltipPosition -import ru.dbotthepony.mc.otm.client.render.draw import ru.dbotthepony.mc.otm.client.render.sprites.sprite import ru.dbotthepony.mc.otm.client.render.render import ru.dbotthepony.mc.otm.client.screen.panels.util.DiscreteScrollBarPanel diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt index 59cc05a94..002ba34d3 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EntityRendererPanel.kt @@ -7,7 +7,7 @@ import net.minecraft.world.entity.LivingEntity import net.minecraft.world.entity.player.Player import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.capability.matteryPlayer -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.Widgets8 import ru.dbotthepony.mc.otm.client.render.sprites.sprite import ru.dbotthepony.mc.otm.client.screen.ExopackInventoryScreen diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/FramePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/FramePanel.kt index adcb9d5b0..dfd6eb4fe 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/FramePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/FramePanel.kt @@ -8,7 +8,7 @@ import net.minecraft.client.gui.narration.NarrationElementOutput import net.minecraft.client.gui.screens.Screen import net.minecraft.network.chat.Component import org.lwjgl.opengl.GL30 -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.* import ru.dbotthepony.mc.otm.client.render.sprites.StretchingRectangleElement import ru.dbotthepony.mc.otm.client.screen.panels.button.AbstractButtonPanel diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Label.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Label.kt index 413eb8510..d1559d418 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Label.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Label.kt @@ -2,9 +2,8 @@ package ru.dbotthepony.mc.otm.client.screen.panels import net.minecraft.client.gui.screens.Screen import net.minecraft.network.chat.Component -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.RenderGravity -import ru.dbotthepony.mc.otm.client.render.draw import ru.dbotthepony.mc.otm.core.TextComponent import ru.dbotthepony.mc.otm.core.math.RGBAColor diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/NetworkedItemGridPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/NetworkedItemGridPanel.kt index 4c6463c0c..31c78b628 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/NetworkedItemGridPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/NetworkedItemGridPanel.kt @@ -3,7 +3,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels import net.minecraft.ChatFormatting import net.minecraft.network.chat.Component import net.minecraft.world.item.ItemStack -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.RenderGravity import ru.dbotthepony.mc.otm.client.screen.MatteryScreen import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Panel2Widget.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Panel2Widget.kt index 722af0a2b..e4664f2bd 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Panel2Widget.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Panel2Widget.kt @@ -4,7 +4,7 @@ import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.components.Renderable import net.minecraft.client.gui.components.events.GuiEventListener import net.minecraft.client.gui.screens.Screen -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics // before 1.19.3 Renderable was Widget class Panel2Widget>( diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/SpritePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/SpritePanel.kt index 14a17b776..2e2b610e3 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/SpritePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/SpritePanel.kt @@ -1,7 +1,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels import net.minecraft.client.gui.screens.Screen -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.sprites.AbstractMatterySprite import ru.dbotthepony.mc.otm.client.render.UVWindingOrder diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Widget2Panel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Widget2Panel.kt index 4b6a35793..ca49c74fb 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Widget2Panel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Widget2Panel.kt @@ -4,7 +4,7 @@ import com.mojang.blaze3d.systems.RenderSystem import net.minecraft.client.gui.components.AbstractWidget import net.minecraft.client.gui.screens.Screen import org.lwjgl.opengl.GL11 -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics abstract class Widget2Panel( screen: S, diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/AbstractButtonPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/AbstractButtonPanel.kt index f2ebc5a4c..e1da380a4 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/AbstractButtonPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/AbstractButtonPanel.kt @@ -2,7 +2,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.button import com.mojang.blaze3d.platform.InputConstants import net.minecraft.client.gui.screens.Screen -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.playGuiClickSound import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel import java.util.function.IntPredicate 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 4a8469438..2ca9ba092 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 @@ -3,7 +3,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.button import net.minecraft.ChatFormatting import net.minecraft.client.gui.screens.Screen import net.minecraft.network.chat.Component -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.IGUIRenderable import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/ButtonPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/ButtonPanel.kt index ea5b0185b..266022db8 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/ButtonPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/ButtonPanel.kt @@ -1,12 +1,10 @@ package ru.dbotthepony.mc.otm.client.screen.panels.button -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen import net.minecraft.network.chat.Component -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.RenderGravity import ru.dbotthepony.mc.otm.client.render.Widgets18 -import ru.dbotthepony.mc.otm.client.render.draw import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel import ru.dbotthepony.mc.otm.core.math.RGBAColor import java.util.function.IntConsumer diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/Buttons.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/Buttons.kt index a1c78aebe..9d6c1ded8 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/Buttons.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/Buttons.kt @@ -9,7 +9,7 @@ import ru.dbotthepony.mc.otm.block.entity.MatteryDeviceBlockEntity import ru.dbotthepony.mc.otm.block.entity.RedstoneSetting import ru.dbotthepony.mc.otm.capability.FlowDirection import ru.dbotthepony.mc.otm.capability.addUpgradeTooltipLines -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.isCtrlDown import ru.dbotthepony.mc.otm.client.isShiftDown import ru.dbotthepony.mc.otm.client.minecraft 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 e92a13106..7e7fa776f 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 @@ -1,8 +1,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.button -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.sprites.AbstractMatterySprite import ru.dbotthepony.mc.otm.client.render.WidgetLocation import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/EnumRectangleButtonPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/EnumRectangleButtonPanel.kt index d2af01f0d..ede8a66dd 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/EnumRectangleButtonPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/EnumRectangleButtonPanel.kt @@ -4,7 +4,7 @@ import com.mojang.blaze3d.platform.InputConstants import net.minecraft.ChatFormatting import net.minecraft.client.gui.screens.Screen import net.minecraft.network.chat.Component -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.IGUIRenderable import ru.dbotthepony.mc.otm.client.render.UVWindingOrder 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 718230f23..be7a3cc60 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 @@ -1,7 +1,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.button import net.minecraft.client.gui.screens.Screen -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.IGUIRenderable import ru.dbotthepony.mc.otm.client.render.UVWindingOrder diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/RectangleButtonPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/RectangleButtonPanel.kt index 16afdc8c9..3f862a190 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/RectangleButtonPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/RectangleButtonPanel.kt @@ -1,8 +1,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.button -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.IGUIRenderable import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel import java.util.function.IntConsumer 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 a6bf44fb3..b7b5a1cf6 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 @@ -1,7 +1,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.button import net.minecraft.client.gui.screens.Screen -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.sprites.MatterySprite import ru.dbotthepony.mc.otm.client.render.UVWindingOrder import ru.dbotthepony.mc.otm.client.render.Widgets8 diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/input/TextInputPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/input/TextInputPanel.kt index b1a63bc0a..fe39fa45c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/input/TextInputPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/input/TextInputPanel.kt @@ -13,14 +13,13 @@ import net.minecraft.client.gui.screens.Screen import net.minecraft.client.renderer.GameRenderer import net.minecraft.network.chat.Component import org.joml.Vector2i -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.isCtrlDown import ru.dbotthepony.mc.otm.client.isShiftDown import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.playGuiClickSound import ru.dbotthepony.mc.otm.client.render.DynamicBufferSource import ru.dbotthepony.mc.otm.client.render.RenderGravity -import ru.dbotthepony.mc.otm.client.render.draw import ru.dbotthepony.mc.otm.client.render.tesselator import ru.dbotthepony.mc.otm.client.screen.panels.DockProperty import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel 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 6d4f7bbb6..1ce1d3d89 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 @@ -6,7 +6,7 @@ import net.minecraft.client.renderer.GameRenderer import net.minecraft.network.chat.Component import net.minecraft.world.item.ItemStack import net.minecraftforge.client.extensions.common.IClientItemExtensions -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.* import ru.dbotthepony.mc.otm.client.screen.MatteryScreen import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/InventorySlotPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/InventorySlotPanel.kt index 5e044dc99..caa01f6aa 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/InventorySlotPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/InventorySlotPanel.kt @@ -1,9 +1,8 @@ package ru.dbotthepony.mc.otm.client.screen.panels.slot import com.mojang.blaze3d.platform.InputConstants -import net.minecraft.client.gui.GuiGraphics import net.minecraft.world.item.Item -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.isAltDown import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.playGuiClickSound 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 4d8ab5c90..41da7dc50 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 @@ -8,7 +8,7 @@ import net.minecraft.client.renderer.GameRenderer import net.minecraft.world.inventory.AbstractContainerMenu import net.minecraft.world.inventory.Slot import net.minecraft.world.item.ItemStack -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.Widgets18 import ru.dbotthepony.mc.otm.client.screen.MatteryScreen diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/UserFilteredSlotPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/UserFilteredSlotPanel.kt index bede6f80d..a1a1989f5 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/UserFilteredSlotPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/slot/UserFilteredSlotPanel.kt @@ -2,14 +2,13 @@ package ru.dbotthepony.mc.otm.client.screen.panels.slot import com.mojang.blaze3d.platform.InputConstants import net.minecraft.ChatFormatting -import net.minecraft.client.gui.GuiGraphics import net.minecraft.network.chat.Component import net.minecraft.world.inventory.Slot import net.minecraft.world.item.Item import net.minecraft.world.item.ItemStack import net.minecraft.world.item.Items import net.minecraftforge.client.extensions.common.IClientItemExtensions -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.isCtrlDown import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.playGuiClickSound 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 6b494bae7..83a7f8f7d 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 @@ -2,7 +2,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.util import com.mojang.blaze3d.platform.InputConstants import net.minecraft.client.gui.screens.Screen -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel import ru.dbotthepony.mc.otm.core.math.linearInterpolation diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/util/BackgroundPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/util/BackgroundPanel.kt index 12db90e3f..c2f416be8 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/util/BackgroundPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/util/BackgroundPanel.kt @@ -1,7 +1,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.util import net.minecraft.client.gui.screens.Screen -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.sprites.StretchingRectangleElement import ru.dbotthepony.mc.otm.client.render.WidgetLocation import ru.dbotthepony.mc.otm.client.screen.panels.DockProperty 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 317b65d2c..e5f9a23f2 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 @@ -2,7 +2,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels.util import com.mojang.blaze3d.platform.InputConstants import net.minecraft.client.gui.screens.Screen -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel import kotlin.math.roundToInt diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/ItemMonitorScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/ItemMonitorScreen.kt index d1541921a..03ea70ec7 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/ItemMonitorScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/storage/ItemMonitorScreen.kt @@ -5,7 +5,7 @@ import net.minecraft.world.entity.player.Inventory import net.minecraft.world.item.ItemStack import net.minecraft.world.item.Items import ru.dbotthepony.mc.otm.block.entity.storage.ItemMonitorPlayerSettings -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.screen.MatteryScreen import ru.dbotthepony.mc.otm.client.screen.panels.Dock import ru.dbotthepony.mc.otm.client.screen.panels.DockResizeMode diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt index afdfb4583..1b83c199e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt @@ -15,7 +15,7 @@ import ru.dbotthepony.mc.otm.android.AndroidResearchManager import ru.dbotthepony.mc.otm.android.AndroidResearchType import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability import ru.dbotthepony.mc.otm.capability.MatteryCapability -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.playGuiClickSound import ru.dbotthepony.mc.otm.client.render.RenderGravity diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EnergyServoScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EnergyServoScreen.kt index 9d88499be..658283ef4 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EnergyServoScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/EnergyServoScreen.kt @@ -2,7 +2,7 @@ package ru.dbotthepony.mc.otm.client.screen.tech import net.minecraft.network.chat.Component import net.minecraft.world.entity.player.Inventory -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.screen.MatteryScreen import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel import ru.dbotthepony.mc.otm.client.screen.panels.slot.BatterySlotPanel 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 c3cec2b2d..ae05cd7f8 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 @@ -6,7 +6,7 @@ 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.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.isShiftDown import ru.dbotthepony.mc.otm.client.playGuiClickSound import ru.dbotthepony.mc.otm.client.render.sprites.MatteryAtlas 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 2a7eb8e2e..670246d22 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 @@ -11,7 +11,7 @@ import net.minecraft.world.inventory.InventoryMenu import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions import org.lwjgl.opengl.GL11 import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.ShiftPressedCond import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.sprites.MatterySprite 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 ba802387e..60cbc2ed8 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 @@ -1,8 +1,7 @@ package ru.dbotthepony.mc.otm.client.screen.widget -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.UVWindingOrder import ru.dbotthepony.mc.otm.client.render.WidgetLocation import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/MatterGaugePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/MatterGaugePanel.kt index 6a4e7a8e6..c31f5db8a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/MatterGaugePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/MatterGaugePanel.kt @@ -6,13 +6,12 @@ import com.mojang.blaze3d.vertex.DefaultVertexFormat import com.mojang.blaze3d.vertex.VertexFormat import it.unimi.dsi.fastutil.ints.IntArrayList import net.minecraft.ChatFormatting -import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.screens.Screen import net.minecraft.client.renderer.GameRenderer import net.minecraft.network.chat.Component import org.lwjgl.opengl.GL11 import ru.dbotthepony.mc.otm.capability.AbstractProfiledStorage -import ru.dbotthepony.mc.otm.client.MGUIGraphics +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 diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/PatternGaugePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/PatternGaugePanel.kt index 445f1dd77..669a3d969 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/PatternGaugePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/PatternGaugePanel.kt @@ -2,7 +2,7 @@ package ru.dbotthepony.mc.otm.client.screen.widget import net.minecraft.client.gui.screens.Screen import net.minecraft.network.chat.Component -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.WidgetLocation import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel import ru.dbotthepony.mc.otm.core.TranslatableComponent 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 a5c9018d9..51bc1a6c4 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 @@ -5,7 +5,7 @@ import net.minecraft.ChatFormatting import net.minecraft.client.gui.screens.Screen import net.minecraft.network.chat.Component import ru.dbotthepony.mc.otm.capability.AbstractProfiledStorage -import ru.dbotthepony.mc.otm.client.MGUIGraphics +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 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 77627dafa..97f7e4205 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 @@ -6,7 +6,7 @@ import mezz.jei.api.recipe.RecipeType import net.minecraft.ChatFormatting import net.minecraft.client.gui.screens.Screen import net.minecraft.network.chat.Component -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.UVWindingOrder import ru.dbotthepony.mc.otm.client.render.WidgetLocation import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel 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 4be4d81a8..9ad73c8cd 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 @@ -15,7 +15,7 @@ import net.minecraft.world.inventory.InventoryMenu import net.minecraft.world.inventory.Slot import net.minecraft.world.item.ItemStack import net.minecraftforge.fml.ModList -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.sprites.MatterySprite import ru.dbotthepony.mc.otm.client.render.sprites.sprite diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/Gauges.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/Gauges.kt index 0f95d5934..e6751c646 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/Gauges.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/Gauges.kt @@ -1,8 +1,7 @@ package ru.dbotthepony.mc.otm.compat.jei -import net.minecraft.client.gui.GuiGraphics import net.minecraft.network.chat.Component -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.ShiftPressedCond import ru.dbotthepony.mc.otm.client.screen.widget.MatterGaugePanel import ru.dbotthepony.mc.otm.client.screen.widget.PowerGaugePanel diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/IGUIRenderable2IDrawable.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/IGUIRenderable2IDrawable.kt index 78cf691fc..540c861cb 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/IGUIRenderable2IDrawable.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/IGUIRenderable2IDrawable.kt @@ -2,7 +2,7 @@ package ru.dbotthepony.mc.otm.compat.jei import mezz.jei.api.gui.drawable.IDrawable import net.minecraft.client.gui.GuiGraphics -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.IGUIRenderable class IGUIRenderable2IDrawable(val parent: IGUIRenderable) : IDrawable { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MatterEntanglerRecipeCategory.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MatterEntanglerRecipeCategory.kt index babfab971..bb65b63b0 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MatterEntanglerRecipeCategory.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MatterEntanglerRecipeCategory.kt @@ -11,10 +11,8 @@ import net.minecraft.client.gui.GuiGraphics import net.minecraft.network.chat.Component import net.minecraft.world.item.ItemStack import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.client.MGUIGraphics -import ru.dbotthepony.mc.otm.client.minecraft +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ItemStackIcon -import ru.dbotthepony.mc.otm.client.render.draw import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel import ru.dbotthepony.mc.otm.config.MachinesConfig diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MicrowaveRecipeCategory.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MicrowaveRecipeCategory.kt index b175faa32..bd723a9a9 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MicrowaveRecipeCategory.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MicrowaveRecipeCategory.kt @@ -13,10 +13,9 @@ import net.minecraft.resources.ResourceLocation import net.minecraft.world.item.ItemStack import net.minecraft.world.item.crafting.Ingredient import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.RenderGravity -import ru.dbotthepony.mc.otm.client.render.draw import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel import ru.dbotthepony.mc.otm.core.math.RGBAColor diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/PainterRecipeCategory.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/PainterRecipeCategory.kt index 8318337ea..50bb55cea 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/PainterRecipeCategory.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/PainterRecipeCategory.kt @@ -14,7 +14,7 @@ import net.minecraft.world.item.ItemStack import net.minecraft.world.item.Items import net.minecraft.world.item.crafting.Ingredient import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.render.ItemStackIcon import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/PlatePressRecipeCategory.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/PlatePressRecipeCategory.kt index 4d2c5f4c2..cda8914e9 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/PlatePressRecipeCategory.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/PlatePressRecipeCategory.kt @@ -13,10 +13,9 @@ import net.minecraft.resources.ResourceLocation import net.minecraft.world.item.ItemStack import net.minecraft.world.item.crafting.Ingredient import ru.dbotthepony.mc.otm.OverdriveThatMatters -import ru.dbotthepony.mc.otm.client.MGUIGraphics +import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.RenderGravity -import ru.dbotthepony.mc.otm.client.render.draw import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel import ru.dbotthepony.mc.otm.core.math.RGBAColor From 1dab485d29e61e2755f0c3a01f12ad37d73b26e0 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Mon, 1 Jan 2024 02:46:00 +0700 Subject: [PATCH 3/4] Specify font implicitly --- .../mc/otm/client/AndroidMenuKeyMapping.kt | 8 ++--- .../dbotthepony/mc/otm/client/MatteryGUI.kt | 12 +++---- .../mc/otm/client/render/MGUIGraphics.kt | 6 ++-- .../client/screen/matter/MatterPanelScreen.kt | 1 - .../client/screen/panels/EffectListPanel.kt | 6 ++-- .../mc/otm/client/screen/panels/FramePanel.kt | 2 +- .../mc/otm/client/screen/panels/Label.kt | 36 +++++++++---------- .../screen/panels/NetworkedItemGridPanel.kt | 2 +- .../screen/panels/button/ButtonPanel.kt | 2 +- .../screen/panels/input/TextInputPanel.kt | 6 ---- .../screen/tech/AndroidStationScreen.kt | 2 +- .../jei/MatterEntanglerRecipeCategory.kt | 2 +- .../otm/compat/jei/MicrowaveRecipeCategory.kt | 4 +-- .../compat/jei/PlatePressRecipeCategory.kt | 4 +-- 14 files changed, 43 insertions(+), 50 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt index 4e1ffa3f3..cfbb165af 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt @@ -259,15 +259,15 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon val shift = size * 0.6f feature.renderIcon(wrap, -iconSize / 2f + shift * cos, -shift * sin - iconSize / 2f, iconSize, iconSize) - wrap.draw(minecraft.font, feature.type.displayName, shift * cos + 1f, -shift * sin - iconSize / 1.5f + 1f, color = RGBAColor.BLACK, gravity = RenderGravity.CENTER_CENTER) - wrap.draw(minecraft.font, feature.type.displayName, shift * cos, -shift * sin - iconSize / 1.5f, color = if (feature.isActive) RGBAColor.DARK_GREEN else RGBAColor.DARK_RED, gravity = RenderGravity.CENTER_CENTER) + wrap.draw(feature.type.displayName, shift * cos + 1f, -shift * sin - iconSize / 1.5f + 1f, color = RGBAColor.BLACK, gravity = RenderGravity.CENTER_CENTER) + wrap.draw(feature.type.displayName, shift * cos, -shift * sin - iconSize / 1.5f, color = if (feature.isActive) RGBAColor.DARK_GREEN else RGBAColor.DARK_RED, gravity = RenderGravity.CENTER_CENTER) if (feature.isOnCooldown && feature.cooldownPercent > 0.0f) { RenderSystem.setShaderColor(1f, 1f, 1f, 0.5f) drawArc(event.guiGraphics, shift * cos, -shift * sin, iconSize / 2f, 0f, PI / 2.0, PI / 2.0 + PI * 2.0 * feature.cooldownPercent.toDouble()) RenderSystem.setShaderColor(1f, 1f, 1f, 1f) - wrap.draw(minecraft.font, formatTickDuration(feature.cooldown), shift * cos, -shift * sin + iconSize / 1.5f, color = RGBAColor.WHITE, gravity = RenderGravity.CENTER_CENTER) + wrap.draw(formatTickDuration(feature.cooldown), shift * cos, -shift * sin + iconSize / 1.5f, color = RGBAColor.WHITE, gravity = RenderGravity.CENTER_CENTER) } } @@ -305,7 +305,7 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon drawArc(event.guiGraphics, x, y, COOLDOWN_ICON_SIZE / 2f, 0f, PI / 2.0, PI / 2.0 + PI * 2.0 * feature.cooldownPercent, alignAtCenter = false) RenderSystem.setShaderColor(1f, 1f, 1f, 1f) - wrap.draw(font, formatTickDuration(feature.cooldown), x + COOLDOWN_ICON_SIZE / 2f, y + COOLDOWN_ICON_SIZE + 1f, color = RGBAColor.WHITE, gravity = RenderGravity.TOP_CENTER) + wrap.draw(formatTickDuration(feature.cooldown), x + COOLDOWN_ICON_SIZE / 2f, y + COOLDOWN_ICON_SIZE + 1f, color = RGBAColor.WHITE, gravity = RenderGravity.TOP_CENTER) x += COOLDOWN_ICON_SIZE + COOLDOWN_ICON_MARGIN } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt index 737b26927..d92fe7610 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt @@ -174,8 +174,8 @@ object MatteryGUI { val text = TranslatableComponent("otm.iteration", iteration) - guiGraphics.draw(minecraft.font, text, x + 1f, y + 1f, color = RGBAColor.BLACK, gravity = RenderGravity.CENTER_CENTER) - guiGraphics.draw(minecraft.font, text, x, y, color = RGBAColor.WHITE, gravity = RenderGravity.CENTER_CENTER) + guiGraphics.draw(text, x + 1f, y + 1f, color = RGBAColor.BLACK, gravity = RenderGravity.CENTER_CENTER) + guiGraphics.draw(text, x, y, color = RGBAColor.WHITE, gravity = RenderGravity.CENTER_CENTER) stack.scale(0.35f, 0.35f, 0.35f) @@ -191,8 +191,8 @@ object MatteryGUI { for (i in deathLog.indices.reversed()) { val component = deathLog[i] - guiGraphics.draw(minecraft.font, component.second, x + 1f, y + 1f, color = RGBAColor.BLACK, gravity = RenderGravity.CENTER_CENTER) - guiGraphics.draw(minecraft.font, component.second, x, y, color = RGBAColor(color, color, color), gravity = RenderGravity.CENTER_CENTER) + guiGraphics.draw(component.second, x + 1f, y + 1f, color = RGBAColor.BLACK, gravity = RenderGravity.CENTER_CENTER) + guiGraphics.draw(component.second, x, y, color = RGBAColor(color, color, color), gravity = RenderGravity.CENTER_CENTER) y += minecraft.font.lineHeight color = (color - 0x20).coerceAtLeast(0x0) @@ -266,7 +266,7 @@ object MatteryGUI { val formattedPower = mattery.androidEnergy.batteryLevel.formatPower() val scale = ClientConfig.HUD.BAR_TEXT_SCALE.toFloat() - guiGraphics.draw(gui.font, formattedPower, left + CHARGE_BG.width + 2f + scale, top + CHARGE_BG.height / 2f + scale, scale = scale, gravity = RenderGravity.CENTER_LEFT, color = RGBAColor.YELLOW, drawOutline = true) + guiGraphics.draw(formattedPower, left + CHARGE_BG.width + 2f + scale, top + CHARGE_BG.height / 2f + scale, font = gui.font, scale = scale, gravity = RenderGravity.CENTER_LEFT, color = RGBAColor.YELLOW, drawOutline = true) } } @@ -345,7 +345,7 @@ object MatteryGUI { formattedHealth = TextComponent("%d+%d/%d".format(ply.health.toInt(), ply.absorptionAmount.toInt(), ply.maxHealth.toInt())) val scale = ClientConfig.HUD.BAR_TEXT_SCALE.toFloat() - guiGraphics.draw(minecraft.font, formattedHealth, left - 2f, top + HEALTH_BG.height / 2f + 1f * scale, scale = scale, gravity = RenderGravity.CENTER_RIGHT, color = getHealthColorForPlayer(ply), drawOutline = true) + guiGraphics.draw(formattedHealth, left - 2f, top + HEALTH_BG.height / 2f + 1f * scale, scale = scale, gravity = RenderGravity.CENTER_RIGHT, color = getHealthColorForPlayer(ply), drawOutline = true) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MGUIGraphics.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MGUIGraphics.kt index 398106369..198ca4cd9 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MGUIGraphics.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MGUIGraphics.kt @@ -85,7 +85,6 @@ class MGUIGraphics(val parent: GuiGraphics) { } fun draw( - font: Font, text: String, x: Float = 0f, y: Float = 0f, @@ -105,6 +104,7 @@ class MGUIGraphics(val parent: GuiGraphics) { drawOutline: Boolean = false, outlineColor: RGBAColor = RGBAColor.BLACK, outlineZ: Float = -0.1f, + font: Font = this.font, ): Float { val width = font.draw( poseStack = pose, @@ -135,7 +135,6 @@ class MGUIGraphics(val parent: GuiGraphics) { } fun draw( - font: Font, text: Component, x: Float = 0f, y: Float = 0f, @@ -155,6 +154,7 @@ class MGUIGraphics(val parent: GuiGraphics) { drawOutline: Boolean = false, outlineColor: RGBAColor = RGBAColor.BLACK, outlineZ: Float = -0.1f, + font: Font = this.font, ): Float { val width = font.draw( poseStack = pose, @@ -185,7 +185,6 @@ class MGUIGraphics(val parent: GuiGraphics) { } fun draw( - font: Font, text: FormattedCharSequence, x: Float = 0f, y: Float = 0f, @@ -205,6 +204,7 @@ class MGUIGraphics(val parent: GuiGraphics) { drawOutline: Boolean = false, outlineColor: RGBAColor = RGBAColor.BLACK, outlineZ: Float = -0.1f, + font: Font = this.font, ): Float { val width = font.draw( poseStack = pose, diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/matter/MatterPanelScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/matter/MatterPanelScreen.kt index 0bf986089..b1d960325 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/matter/MatterPanelScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/matter/MatterPanelScreen.kt @@ -212,7 +212,6 @@ class MatterPanelScreen( menu.patternsFiltered.getOrNull(index)?.let { if (it.researchPercent < 1f) { graphics.draw( - font, TextComponent((it.researchPercent * 100.0).toInt().toString() + "%"), width - 1f, height - 1f, scale = 0.5f, gravity = RenderGravity.BOTTOM_RIGHT, drawShadow = true, color = RGBAColor.WHITE) } 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 dbd05d60d..70155b260 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 @@ -115,7 +115,7 @@ open class EffectListPanel @JvmOverloads constructor( minecraft.mobEffectTextures.get(effect.effect).render(graphics, x = 3f, y = 3f, width = width - 6f, height = height - 6f) RenderSystem.setShaderColor(1f, 1f, 1f, 1f) - graphics.draw(font, formatTickDuration(effect.duration), width / 2f, height / 2f, scale = 0.75f, gravity = RenderGravity.CENTER_CENTER, color = RGBAColor.WHITE) + graphics.draw(formatTickDuration(effect.duration), width / 2f, height / 2f, scale = 0.75f, gravity = RenderGravity.CENTER_CENTER, color = RGBAColor.WHITE) } override fun innerRenderTooltips(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float): Boolean { @@ -143,8 +143,8 @@ open class EffectListPanel @JvmOverloads constructor( name.append(" ${effect.amplifier + 1}") } - graphics.draw(font, name, x + renderWidth + 12f, y + 7f, gravity = RenderGravity.TOP_LEFT, color = RGBAColor.WHITE) - graphics.draw(font, formatTickDuration(effect.duration, true), x + renderWidth + 12f, y + 7f + font.lineHeight + 2f, gravity = RenderGravity.TOP_LEFT, color = RGBAColor.LIGHT_GRAY) + graphics.draw(name, x + renderWidth + 12f, y + 7f, gravity = RenderGravity.TOP_LEFT, color = RGBAColor.WHITE) + graphics.draw(formatTickDuration(effect.duration, true), x + renderWidth + 12f, y + 7f + font.lineHeight + 2f, gravity = RenderGravity.TOP_LEFT, color = RGBAColor.LIGHT_GRAY) } return isHovered diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/FramePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/FramePanel.kt index dfd6eb4fe..a2b34e409 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/FramePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/FramePanel.kt @@ -370,7 +370,7 @@ open class FramePanel( // title val title = title ?: return RenderSystem.depthFunc(GL30.GL_ALWAYS) - graphics.draw(font, title, 8f, 5f, color = titleColor) + graphics.draw(title, 8f, 5f, color = titleColor) RenderSystem.depthFunc(GL30.GL_ALWAYS) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Label.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Label.kt index d1559d418..39dfe7e35 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Label.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/Label.kt @@ -35,28 +35,28 @@ open class Label @JvmOverloads constructor( if (shadow) { when (gravity) { - RenderGravity.TOP_LEFT -> graphics.draw(font, text, shadowX, shadowY, color = shadowColor, gravity = gravity) - RenderGravity.TOP_CENTER -> graphics.draw(font, text, shadowX + width / 2f, shadowY, color = shadowColor, gravity = gravity) - RenderGravity.TOP_RIGHT -> graphics.draw(font, text, shadowX + width, shadowY, color = shadowColor, gravity = gravity) - RenderGravity.CENTER_LEFT -> graphics.draw(font, text, shadowX, height / 2f + shadowY, color = shadowColor, gravity = gravity) - RenderGravity.CENTER_CENTER -> graphics.draw(font, text, shadowX + width / 2f, height / 2f + shadowY, color = shadowColor, gravity = gravity) - RenderGravity.CENTER_RIGHT -> graphics.draw(font, text, shadowX + width, height / 2f + shadowY, color = shadowColor, gravity = gravity) - RenderGravity.BOTTOM_LEFT -> graphics.draw(font, text, shadowX, height + shadowY, color = shadowColor, gravity = gravity) - RenderGravity.BOTTOM_CENTER -> graphics.draw(font, text, shadowX + width / 2f, height + shadowY, color = shadowColor, gravity = gravity) - RenderGravity.BOTTOM_RIGHT -> graphics.draw(font, text, shadowX + width, height + shadowY, color = shadowColor, gravity = gravity) + RenderGravity.TOP_LEFT -> graphics.draw(text, shadowX, shadowY, color = shadowColor, gravity = gravity) + RenderGravity.TOP_CENTER -> graphics.draw(text, shadowX + width / 2f, shadowY, color = shadowColor, gravity = gravity) + RenderGravity.TOP_RIGHT -> graphics.draw(text, shadowX + width, shadowY, color = shadowColor, gravity = gravity) + RenderGravity.CENTER_LEFT -> graphics.draw(text, shadowX, height / 2f + shadowY, color = shadowColor, gravity = gravity) + RenderGravity.CENTER_CENTER -> graphics.draw(text, shadowX + width / 2f, height / 2f + shadowY, color = shadowColor, gravity = gravity) + RenderGravity.CENTER_RIGHT -> graphics.draw(text, shadowX + width, height / 2f + shadowY, color = shadowColor, gravity = gravity) + RenderGravity.BOTTOM_LEFT -> graphics.draw(text, shadowX, height + shadowY, color = shadowColor, gravity = gravity) + RenderGravity.BOTTOM_CENTER -> graphics.draw(text, shadowX + width / 2f, height + shadowY, color = shadowColor, gravity = gravity) + RenderGravity.BOTTOM_RIGHT -> graphics.draw(text, shadowX + width, height + shadowY, color = shadowColor, gravity = gravity) } } when (gravity) { - RenderGravity.TOP_LEFT -> graphics.draw(font, text, 0f, 0f, color = color, gravity = gravity) - RenderGravity.TOP_CENTER -> graphics.draw(font, text, width / 2f, 0f, color = color, gravity = gravity) - RenderGravity.TOP_RIGHT -> graphics.draw(font, text, width - (if (shadow) shadowX else 0f), 0f, color = color, gravity = gravity) - RenderGravity.CENTER_LEFT -> graphics.draw(font, text, 0f, height / 2f, color = color, gravity = gravity) - RenderGravity.CENTER_CENTER -> graphics.draw(font, text, width / 2f, height / 2f, color = color, gravity = gravity) - RenderGravity.CENTER_RIGHT -> graphics.draw(font, text, width - (if (shadow) shadowX else 0f), height / 2f, color = color, gravity = gravity) - RenderGravity.BOTTOM_LEFT -> graphics.draw(font, text, 0f, height, color = color, gravity = gravity) - RenderGravity.BOTTOM_CENTER -> graphics.draw(font, text, width / 2f, height, color = color, gravity = gravity) - RenderGravity.BOTTOM_RIGHT -> graphics.draw(font, text, width - (if (shadow) shadowX else 0f), height, color = color, gravity = gravity) + RenderGravity.TOP_LEFT -> graphics.draw(text, 0f, 0f, color = color, gravity = gravity) + RenderGravity.TOP_CENTER -> graphics.draw(text, width / 2f, 0f, color = color, gravity = gravity) + RenderGravity.TOP_RIGHT -> graphics.draw(text, width - (if (shadow) shadowX else 0f), 0f, color = color, gravity = gravity) + RenderGravity.CENTER_LEFT -> graphics.draw(text, 0f, height / 2f, color = color, gravity = gravity) + RenderGravity.CENTER_CENTER -> graphics.draw(text, width / 2f, height / 2f, color = color, gravity = gravity) + RenderGravity.CENTER_RIGHT -> graphics.draw(text, width - (if (shadow) shadowX else 0f), height / 2f, color = color, gravity = gravity) + RenderGravity.BOTTOM_LEFT -> graphics.draw(text, 0f, height, color = color, gravity = gravity) + RenderGravity.BOTTOM_CENTER -> graphics.draw(text, width / 2f, height, color = color, gravity = gravity) + RenderGravity.BOTTOM_RIGHT -> graphics.draw(text, width - (if (shadow) shadowX else 0f), height, color = color, gravity = gravity) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/NetworkedItemGridPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/NetworkedItemGridPanel.kt index 31c78b628..24bb4c00a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/NetworkedItemGridPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/NetworkedItemGridPanel.kt @@ -83,7 +83,7 @@ open class NetworkedItemGridPanel>( renderRegular(graphics, itemStack.toItemStack(), "") if (!itemStack.isEmpty) { - graphics.draw(font, itemStack.count.formatSiComponent(decimalPlaces = 1), x = width - 1f, y = height - 1f, gravity = RenderGravity.BOTTOM_RIGHT, scale = 0.75f, drawShadow = true) + graphics.draw(itemStack.count.formatSiComponent(decimalPlaces = 1), x = width - 1f, y = height - 1f, gravity = RenderGravity.BOTTOM_RIGHT, scale = 0.75f, drawShadow = true) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/ButtonPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/ButtonPanel.kt index 266022db8..ec7906a9d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/ButtonPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/ButtonPanel.kt @@ -52,7 +52,7 @@ open class ButtonPanel( override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) { renderStretchableBackground(graphics, mouseX, mouseY, partialTick) - graphics.draw(font, label, width / 2f, height / 2f, color = textColor, gravity = RenderGravity.CENTER_CENTER) + graphics.draw(label, width / 2f, height / 2f, color = textColor, gravity = RenderGravity.CENTER_CENTER) } override fun sizeToContents(performLayout: Boolean) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/input/TextInputPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/input/TextInputPanel.kt index fe39fa45c..a18bfcdf9 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/input/TextInputPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/input/TextInputPanel.kt @@ -1174,7 +1174,6 @@ open class TextInputPanel( val selection = selections[i] graphics.draw( - font = font, text = line, gravity = RenderGravity.TOP_LEFT, x = dockPadding.left, @@ -1228,7 +1227,6 @@ open class TextInputPanel( if (activeLine == null || cursorRow >= activeLine.length) { graphics.draw( - font = font, text = "_", gravity = RenderGravity.TOP_LEFT, x = dockPadding.left + (if (activeLine == null) 0f else font.width(activeLine).toFloat()), @@ -1237,7 +1235,6 @@ open class TextInputPanel( ) } else { graphics.draw( - font = font, text = "|", gravity = RenderGravity.TOP_LEFT, x = dockPadding.left + font.width(activeLine.substring(0, cursorRow)).toFloat() - 1f, @@ -1251,7 +1248,6 @@ open class TextInputPanel( if (debugDraw) { graphics.draw( - font = font, text = cursorLine.toString(), gravity = RenderGravity.TOP_RIGHT, x = width, @@ -1260,7 +1256,6 @@ open class TextInputPanel( ) graphics.draw( - font = font, text = cursorRow.toString(), gravity = RenderGravity.TOP_RIGHT, x = width - dockPadding.right, @@ -1269,7 +1264,6 @@ open class TextInputPanel( ) graphics.draw( - font = font, text = lines.size.toString(), gravity = RenderGravity.TOP_RIGHT, x = width - dockPadding.right, diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt index 1b83c199e..989e501af 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/AndroidStationScreen.kt @@ -331,7 +331,7 @@ private class AndroidResearchButton( val text = node.type.iconText if (text != null) { - graphics.draw(font, text.visualOrderText, width - font.width(text), height - font.lineHeight, color = RGBAColor.WHITE, drawShadow = true) + graphics.draw(text.visualOrderText, width - font.width(text), height - font.lineHeight, color = RGBAColor.WHITE, drawShadow = true) } for (line in lines) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MatterEntanglerRecipeCategory.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MatterEntanglerRecipeCategory.kt index bb65b63b0..a079ac8f7 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MatterEntanglerRecipeCategory.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MatterEntanglerRecipeCategory.kt @@ -80,7 +80,7 @@ object MatterEntanglerRecipeCategory : IRecipeCategory, renderMatterGauge(wrap, 13f, 6f, drainSpeed = (recipe.matter / Decimal(300)).toFloat()) renderEnergyGauge(wrap, 4f, 6f, drainSpeed = (recipe.ticks / 2000.0).toFloat()) - wrap.draw(wrap.font, x = 85f, y = 45f, text = TranslatableComponent("otm.gui.recipe.ticks", recipe.ticks), drawShadow = true) + wrap.draw(x = 85f, y = 45f, text = TranslatableComponent("otm.gui.recipe.ticks", recipe.ticks), drawShadow = true) } override fun getTooltipStrings(recipe: IMatterEntanglerRecipe, recipeSlotsView: IRecipeSlotsView, mouseX: Double, mouseY: Double): MutableList { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MicrowaveRecipeCategory.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MicrowaveRecipeCategory.kt index bd723a9a9..622c59349 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MicrowaveRecipeCategory.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MicrowaveRecipeCategory.kt @@ -73,12 +73,12 @@ object MicrowaveRecipeCategory : IRecipeCategory, IDrawable { mouseY: Double ) { val wrap = MGUIGraphics(graphics) - wrap.draw(minecraft.font, TranslatableComponent("otm.gui.recipe.ticks", recipe.workTime), 40f, 30f, gravity = RenderGravity.TOP_CENTER, color = RGBAColor.BLACK) + wrap.draw(TranslatableComponent("otm.gui.recipe.ticks", recipe.workTime), 40f, 30f, gravity = RenderGravity.TOP_CENTER, color = RGBAColor.BLACK) val average = recipe.experience.toString() if (average != "0.0") { - wrap.draw(minecraft.font, TranslatableComponent("gui.jei.category.smelting.experience", average), 40f, 1f, gravity = RenderGravity.TOP_CENTER, color = RGBAColor.BLACK) + wrap.draw(TranslatableComponent("gui.jei.category.smelting.experience", average), 40f, 1f, gravity = RenderGravity.TOP_CENTER, color = RGBAColor.BLACK) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/PlatePressRecipeCategory.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/PlatePressRecipeCategory.kt index cda8914e9..506fd5382 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/PlatePressRecipeCategory.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/PlatePressRecipeCategory.kt @@ -74,12 +74,12 @@ object PlatePressRecipeCategory : IRecipeCategory, IDrawable { ) { val wrap = MGUIGraphics(graphics) - wrap.draw(minecraft.font, TranslatableComponent("otm.gui.recipe.ticks", recipe.workTime), 40f, 30f, gravity = RenderGravity.TOP_CENTER, color = RGBAColor.BLACK) + wrap.draw(TranslatableComponent("otm.gui.recipe.ticks", recipe.workTime), 40f, 30f, gravity = RenderGravity.TOP_CENTER, color = RGBAColor.BLACK) val average = recipe.experience.toString() if (average != "0.0") { - wrap.draw(minecraft.font, TranslatableComponent("gui.jei.category.smelting.experience", average), 40f, 1f, gravity = RenderGravity.TOP_CENTER, color = RGBAColor.BLACK) + wrap.draw(TranslatableComponent("gui.jei.category.smelting.experience", average), 40f, 1f, gravity = RenderGravity.TOP_CENTER, color = RGBAColor.BLACK) } } From 716d251ca09a4f0cd883413cd0ac524d9dd7d1ed Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Mon, 1 Jan 2024 02:51:17 +0700 Subject: [PATCH 4/4] More MGUIGraphics moves --- .../mc/otm/client/AndroidMenuKeyMapping.kt | 12 +++--- .../dbotthepony/mc/otm/client/MatteryGUI.kt | 2 +- .../mc/otm/client/render/MGUIGraphics.kt | 13 +++++++ .../mc/otm/client/render/RenderHelper.kt | 38 ------------------- .../client/screen/panels/EffectListPanel.kt | 7 ++-- 5 files changed, 22 insertions(+), 50 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt index cfbb165af..f81bd9c01 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/AndroidMenuKeyMapping.kt @@ -155,9 +155,9 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon RenderSystem.setShaderColor(0f, 0f, 0f, 0.6f) val size = minecraft.window.guiScaledHeight.coerceAtMost(minecraft.window.guiScaledWidth).toFloat() * 0.35f + val wrap = MGUIGraphics(event.guiGraphics) - drawArc( - event.guiGraphics, + wrap.drawArc( minecraft.window.guiScaledWidth / 2f, minecraft.window.guiScaledHeight / 2f, size, @@ -226,8 +226,7 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon if (lastSelectedDegree != null && lastSelectedFeature != null) { RenderSystem.setShaderColor(85 / 255f, 197 / 255f, 255 / 255f, 0.3f * lastSelectProgressGlobal) - drawArc( - event.guiGraphics, + wrap.drawArc( minecraft.window.guiScaledWidth / 2f, minecraft.window.guiScaledHeight / 2f, ru.dbotthepony.mc.otm.core.math.linearInterpolation(lastSelectProgressGlobal, size, size * 1.2f), @@ -245,7 +244,6 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon val poseStack = event.guiGraphics.pose() poseStack.pushPose() poseStack.translate(minecraft.window.guiScaledWidth.toDouble() / 2f, minecraft.window.guiScaledHeight.toDouble() / 2f, 0.0) - val wrap = MGUIGraphics(event.guiGraphics) for ((index, feature) in features.withIndex()) { var sin = sin((index + 0.5) * degreePerSlice).toFloat() @@ -264,7 +262,7 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon if (feature.isOnCooldown && feature.cooldownPercent > 0.0f) { RenderSystem.setShaderColor(1f, 1f, 1f, 0.5f) - drawArc(event.guiGraphics, shift * cos, -shift * sin, iconSize / 2f, 0f, PI / 2.0, PI / 2.0 + PI * 2.0 * feature.cooldownPercent.toDouble()) + wrap.drawArc(shift * cos, -shift * sin, iconSize / 2f, 0f, PI / 2.0, PI / 2.0 + PI * 2.0 * feature.cooldownPercent.toDouble()) RenderSystem.setShaderColor(1f, 1f, 1f, 1f) wrap.draw(formatTickDuration(feature.cooldown), shift * cos, -shift * sin + iconSize / 1.5f, color = RGBAColor.WHITE, gravity = RenderGravity.CENTER_CENTER) @@ -302,7 +300,7 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon feature.renderIcon(wrap, x, y, COOLDOWN_ICON_SIZE, COOLDOWN_ICON_SIZE) RenderSystem.setShaderColor(1f, 1f, 1f, 0.5f) - drawArc(event.guiGraphics, x, y, COOLDOWN_ICON_SIZE / 2f, 0f, PI / 2.0, PI / 2.0 + PI * 2.0 * feature.cooldownPercent, alignAtCenter = false) + wrap.drawArc(x, y, COOLDOWN_ICON_SIZE / 2f, 0f, PI / 2.0, PI / 2.0 + PI * 2.0 * feature.cooldownPercent, alignAtCenter = false) RenderSystem.setShaderColor(1f, 1f, 1f, 1f) wrap.draw(formatTickDuration(feature.cooldown), x + COOLDOWN_ICON_SIZE / 2f, y + COOLDOWN_ICON_SIZE + 1f, color = RGBAColor.WHITE, gravity = RenderGravity.TOP_CENTER) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt index d92fe7610..4588b2b7c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/MatteryGUI.kt @@ -369,7 +369,7 @@ object MatteryGUI { val percent = ((stack.item.getUseDuration(stack) - ply.useItemRemainingTicks + minecraft.partialTick) / 5f).coerceIn(0f, 1f) RenderSystem.setShaderColor(1f, 1f, 1f, 0.5f) - drawArc(graphics, x + 8f, y + 8f, 8f, 0f, PI / 2.0, PI / 2.0 + PI * 2.0 * percent, alignAtCenter = true) + drawArc(graphics.pose(), x + 8f, y + 8f, 8f, 0f, PI / 2.0, PI / 2.0 + PI * 2.0 * percent, alignAtCenter = true) RenderSystem.setShaderColor(1f, 1f, 1f, 1f) return true diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MGUIGraphics.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MGUIGraphics.kt index 198ca4cd9..3c2dcc7a9 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MGUIGraphics.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MGUIGraphics.kt @@ -11,6 +11,8 @@ import net.minecraft.util.FormattedCharSequence import net.minecraft.world.item.ItemStack import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.core.math.RGBAColor +import kotlin.math.PI +import kotlin.math.roundToInt // polyfill class for 1.19.4 and older class MGUIGraphics(val parent: GuiGraphics) { @@ -248,6 +250,17 @@ class MGUIGraphics(val parent: GuiGraphics) { ) } + fun drawArc( + x: Float, + y: Float, + outerRadius: Float, + innerRadius: Float = 0f, + startDegree: Double = 0.0, + endDegree: Double = PI * 2.0, + steps: Int = (outerRadius * (endDegree - startDegree) * 4.0).roundToInt().coerceAtLeast(12), + alignAtCenter: Boolean = true + ) = drawArc(pose, x, y, outerRadius, innerRadius, startDegree, endDegree, steps, alignAtCenter) + companion object { private val defaultUV = UVCoords(0f, 0f, 1f, 1f) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/RenderHelper.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/RenderHelper.kt index 26738c334..84d7d1da4 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/RenderHelper.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/RenderHelper.kt @@ -381,32 +381,6 @@ fun popScissorRect() { val currentScissorRect get() = scissorStack.lastOrNull() -fun TextureAtlasSprite.render( - stack: PoseStack, - x: Float = 0f, - y: Float = 0f, - width: Float, - height: Float, - winding: UVWindingOrder = UVWindingOrder.NORMAL -) { - RenderSystem.setShaderTexture(0, atlasLocation()) - - if (winding.isIdentity) { - renderTexturedRect(stack.last().pose(), x, y, width, height, uv = UVCoords(u0, v0, u1, v1)) - } else { - renderTexturedRect(stack.last().pose(), x, y, width, height, uv = winding.translate(u0, v0, u1, v1)) - } -} - -fun TextureAtlasSprite.render( - graphics: MGUIGraphics, - x: Float = 0f, - y: Float = 0f, - width: Float, - height: Float, - winding: UVWindingOrder = UVWindingOrder.NORMAL -) = render(graphics.pose, x, y, width, height, winding) - fun determineTooltipPosition(x: Float, y: Float, width: Float, height: Float): Pair { val windowWidth = minecraft.window.guiScaledWidth.toFloat() val windowHeight = minecraft.window.guiScaledHeight.toFloat() @@ -479,18 +453,6 @@ fun drawArc( alignAtCenter: Boolean = true ) = drawArc(stack.last().pose(), x, y, outerRadius, innerRadius, startDegree, endDegree, steps, alignAtCenter) -fun drawArc( - graphics: GuiGraphics, - x: Float, - y: Float, - outerRadius: Float, - innerRadius: Float = 0f, - startDegree: Double = 0.0, - endDegree: Double = PI * 2.0, - steps: Int = (outerRadius * (endDegree - startDegree) * 4.0).roundToInt().coerceAtLeast(12), - alignAtCenter: Boolean = true -) = drawArc(graphics.pose(), x, y, outerRadius, innerRadius, startDegree, endDegree, steps, alignAtCenter) - fun uploadArc( matrix: Matrix4f, builder: VertexConsumer, 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 70155b260..d682f52f7 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 @@ -13,7 +13,6 @@ import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.render.RenderGravity import ru.dbotthepony.mc.otm.client.render.determineTooltipPosition import ru.dbotthepony.mc.otm.client.render.sprites.sprite -import ru.dbotthepony.mc.otm.client.render.render import ru.dbotthepony.mc.otm.client.screen.panels.util.DiscreteScrollBarPanel import ru.dbotthepony.mc.otm.core.math.RGBAColor import ru.dbotthepony.mc.otm.core.TranslatableComponent @@ -112,7 +111,7 @@ open class EffectListPanel @JvmOverloads constructor( SQUARE_THIN.render(graphics, width = width, height = height) RenderSystem.setShaderColor(1f, 1f, 1f, 0.5f) - minecraft.mobEffectTextures.get(effect.effect).render(graphics, x = 3f, y = 3f, width = width - 6f, height = height - 6f) + graphics.renderSprite(minecraft.mobEffectTextures.get(effect.effect), x = 3f, y = 3f, width = width - 6f, height = height - 6f) RenderSystem.setShaderColor(1f, 1f, 1f, 1f) graphics.draw(formatTickDuration(effect.duration), width / 2f, height / 2f, scale = 0.75f, gravity = RenderGravity.CENTER_CENTER, color = RGBAColor.WHITE) @@ -128,8 +127,8 @@ open class EffectListPanel @JvmOverloads constructor( val renderWidth = 18f val renderHeight = 18f - minecraft.mobEffectTextures.get(effect.effect).render( - graphics.pose, + graphics.renderSprite( + minecraft.mobEffectTextures.get(effect.effect), x = x + 8f, y = y + BAR.height / 2f - renderHeight / 2f, width = renderWidth,