From c99dfe1b340b8dcb27c3df0b899d0ebd163b65fd Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 8 Sep 2023 11:56:05 +0200 Subject: Only allow calling drawSlotText inside the event --- src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt | 4 ++-- .../skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt | 4 ++-- .../java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt | 4 ++-- .../at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt | 4 ++-- src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt | 3 ++- 5 files changed, 10 insertions(+), 9 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni') diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt index a8ecdfc52..30f2b51b7 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ItemTipHelper.kt @@ -7,7 +7,7 @@ import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.mixins.transformers.gui.AccessorGuiContainer import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.RenderUtils +import at.hannibal2.skyhanni.utils.RenderUtils.drawSlotText import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.client.renderer.GlStateManager @@ -32,7 +32,7 @@ class ItemTipHelper { val x = event.x + 17 + renderObject.offsetX val y = event.y + 9 + renderObject.offsetY - RenderUtils.drawSlotText(x, y, text, 1f) + event.drawSlotText(x, y, text, 1f) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt index b62f86d85..29333d205 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt @@ -7,7 +7,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.RenderUtils +import at.hannibal2.skyhanni.utils.RenderUtils.drawSlotText import at.hannibal2.skyhanni.utils.RenderUtils.highlight import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.inventory.ContainerChest @@ -169,7 +169,7 @@ class JacobFarmingContestsInventory { scale = 1.3f } - RenderUtils.drawSlotText(x, y, stackTip, scale) + event.drawSlotText(x, y, stackTip, scale) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt index ea3246ac5..351e3123d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.GuiRenderItemEvent import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.RenderUtils +import at.hannibal2.skyhanni.utils.RenderUtils.drawSlotText import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetCandyUsed import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -23,6 +23,6 @@ class PetCandyUsedDisplay { val x = event.x + 13 val y = event.y + 1 - RenderUtils.drawSlotText(x, y, stackTip, .9f) + event.drawSlotText(x, y, stackTip, .9f) } } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt index a1c780199..58b7924b1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt @@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.events.GuiRenderItemEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.RenderUtils +import at.hannibal2.skyhanni.utils.RenderUtils.drawSlotText import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getAppliedPocketSackInASack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -25,7 +25,7 @@ class PocketSackInASackDisplay { val x = event.x + 13 val y = event.y + 1 - RenderUtils.drawSlotText(x, y, stackTip, .9f) + event.drawSlotText(x, y, stackTip, .9f) } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index 157ecb90f..760c4b946 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.config.core.config.Position import at.hannibal2.skyhanni.data.GuiEditManager import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsX import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsY +import at.hannibal2.skyhanni.events.GuiRenderItemEvent import at.hannibal2.skyhanni.utils.renderables.Renderable import io.github.moulberry.moulconfig.internal.TextRenderUtils import net.minecraft.client.Minecraft @@ -971,7 +972,7 @@ object RenderUtils { ) } - fun drawSlotText(xPos: Int, yPos: Int, text: String, scale: Float) { + fun GuiRenderItemEvent.RenderOverlayEvent.GuiRenderItemPost.drawSlotText(xPos: Int, yPos: Int, text: String, scale: Float) { val fontRenderer = Minecraft.getMinecraft().fontRendererObj GlStateManager.disableLighting() -- cgit