diff options
author | SeRaid <77941535+SeRaid743@users.noreply.github.com> | 2024-05-02 05:54:22 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-01 19:54:22 +0200 |
commit | f118964bd54b3f58ce00e4cb865dcf95cb20fed8 (patch) | |
tree | 02dcf7eeb9a20bfc6d15aa6409147e4bc6082a8c /src/main | |
parent | fbfb1f1bc461fed6ccfe480194966e02943f3315 (diff) | |
download | skyhanni-f118964bd54b3f58ce00e4cb865dcf95cb20fed8.tar.gz skyhanni-f118964bd54b3f58ce00e4cb865dcf95cb20fed8.tar.bz2 skyhanni-f118964bd54b3f58ce00e4cb865dcf95cb20fed8.zip |
added inventory background to gui editor (#1622)
Diffstat (limited to 'src/main')
3 files changed, 24 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt index 4c1ca6ca1..4378fe36e 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt @@ -24,18 +24,24 @@ import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsX import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsY import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getDummySize import at.hannibal2.skyhanni.data.OtherInventoryData +import at.hannibal2.skyhanni.mixins.transformers.gui.AccessorGuiContainer import at.hannibal2.skyhanni.utils.GuiRenderUtils import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.LorenzUtils.round import net.minecraft.client.Minecraft import net.minecraft.client.gui.GuiScreen import net.minecraft.client.gui.ScaledResolution +import net.minecraft.client.gui.inventory.GuiContainer import net.minecraft.client.renderer.GlStateManager import org.lwjgl.input.Keyboard import org.lwjgl.input.Mouse import java.io.IOException -class GuiPositionEditor(private val positions: List<Position>, private val border: Int) : GuiScreen() { +class GuiPositionEditor( + private val positions: List<Position>, + private val border: Int, + private val oldScreen: GuiContainer? = null +) : GuiScreen() { private var grabbedX = 0 private var grabbedY = 0 @@ -50,10 +56,17 @@ class GuiPositionEditor(private val positions: List<Position>, private val borde OtherInventoryData.close() } - override fun drawScreen(unusedX: Int, unusedY: Int, partialTicks: Float) { - super.drawScreen(unusedX, unusedY, partialTicks) + override fun drawScreen(mouseX: Int, mouseY: Int, partialTicks: Float) { + //Items aren't drawn due to a bug in neu rendering drawDefaultBackground() + if (oldScreen != null) { + val accessor = oldScreen as AccessorGuiContainer + accessor.invokeDrawGuiContainerBackgroundLayer_skyhanni(partialTicks, -1, -1) + } + + super.drawScreen(mouseX, mouseY, partialTicks) + GlStateManager.disableLighting() val hoveredPos = renderRectangles() renderLabels(hoveredPos) diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt index 967d27813..7519662a7 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt @@ -17,6 +17,7 @@ import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest +import net.minecraft.client.gui.inventory.GuiContainer import net.minecraft.client.gui.inventory.GuiEditSign import net.minecraft.client.gui.inventory.GuiInventory import net.minecraft.client.renderer.GlStateManager @@ -88,7 +89,11 @@ class GuiEditManager { @JvmStatic fun openGuiPositionEditor(hotkeyReminder: Boolean) { - SkyHanniMod.screenToOpen = GuiPositionEditor(latestPositions.values.toList(), 2) + SkyHanniMod.screenToOpen = GuiPositionEditor( + latestPositions.values.toList(), + 2, + Minecraft.getMinecraft().currentScreen as? GuiContainer + ) if (hotkeyReminder && lastHotkeyReminded.passedSince() > 30.minutes) { lastHotkeyReminded = SimpleTimeMark.now() ChatUtils.chat( diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/AccessorGuiContainer.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/AccessorGuiContainer.java index 8ca114a1c..5d9d6146d 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/AccessorGuiContainer.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/AccessorGuiContainer.java @@ -18,4 +18,6 @@ public interface AccessorGuiContainer { @Accessor("guiTop") int getGuiTop(); + @Invoker("drawGuiContainerBackgroundLayer") + void invokeDrawGuiContainerBackgroundLayer_skyhanni(float f, int i, int mouseY); } |