aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/misc
diff options
context:
space:
mode:
authorHiZe_ <superhize@hotmail.com>2023-06-04 13:13:06 +0200
committerGitHub <noreply@github.com>2023-06-04 13:13:06 +0200
commitfe815d80f1d995ebaa65c52da8f9efd9bf166cf3 (patch)
tree59ec51851c148de7444a170575422f44c0ab7b23 /src/main/java/at/hannibal2/skyhanni/features/misc
parent0d8183794b3342e7cc0a1f306612c18d10952693 (diff)
downloadskyhanni-fe815d80f1d995ebaa65c52da8f9efd9bf166cf3.tar.gz
skyhanni-fe815d80f1d995ebaa65c52da8f9efd9bf166cf3.tar.bz2
skyhanni-fe815d80f1d995ebaa65c52da8f9efd9bf166cf3.zip
Pocket sack in a sack display (#193)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt
new file mode 100644
index 000000000..3c4e4849c
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PocketSackInASackDisplay.kt
@@ -0,0 +1,41 @@
+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.SkyBlockItemModifierUtils.getAppliedPocketSackInASack
+import net.minecraft.client.renderer.GlStateManager
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class PocketSackInASackDisplay {
+
+ @SubscribeEvent
+ fun onRenderItemOverlayPost(event: GuiRenderItemEvent.RenderOverlayEvent.GuiRenderItemPost) {
+ val stack = event.stack ?: return
+ if (!LorenzUtils.inSkyBlock || stack.stackSize != 1) return
+ if (!SkyHanniMod.feature.misc.sackInASackApplied) return
+ val pocketSackInASackApplied = stack.getAppliedPocketSackInASack() ?: return
+
+ val stackTip = "§a$pocketSackInASackApplied"
+
+ GlStateManager.disableLighting()
+ GlStateManager.disableDepth()
+ GlStateManager.disableBlend()
+
+ val fontRenderer = event.fontRenderer
+ val x = event.x + 13 - fontRenderer.getStringWidth(stackTip)
+ val y = event.y + 1
+
+ val scale = 0.9
+ GlStateManager.pushMatrix()
+ GlStateManager.translate(x.toFloat(), y.toFloat(), 0f)
+ GlStateManager.scale(scale, scale, scale)
+ fontRenderer.drawStringWithShadow(stackTip, 0f, 0f, 16777215)
+ val reverseScale = 1 / 0.7
+ GlStateManager.scale(reverseScale, reverseScale, reverseScale)
+ GlStateManager.popMatrix()
+
+ GlStateManager.enableLighting()
+ GlStateManager.enableDepth()
+ }
+} \ No newline at end of file