aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/misc
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-05-24 20:42:02 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-05-24 20:42:02 +0200
commitd6df4f69afbe547a8e9373b0be4baa69d9e02a54 (patch)
treebd32a3c8cdbd535498c53c76f9959165ec75e687 /src/main/java/at/hannibal2/skyhanni/features/misc
parent4dec09c6d96567f69ca92199bc263a8fbd9cd166 (diff)
downloadskyhanni-d6df4f69afbe547a8e9373b0be4baa69d9e02a54.tar.gz
skyhanni-d6df4f69afbe547a8e9373b0be4baa69d9e02a54.tar.bz2
skyhanni-d6df4f69afbe547a8e9373b0be4baa69d9e02a54.zip
Added Pet Candies Used number
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt
new file mode 100644
index 000000000..b09ec0896
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt
@@ -0,0 +1,44 @@
+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.getPetCandyUsed
+import net.minecraft.client.renderer.GlStateManager
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class PetCandyUsedDisplay {
+
+ @SubscribeEvent
+ fun onRenderItemOverlayPost(event: GuiRenderItemEvent.RenderOverlayEvent.GuiRenderItemPost) {
+ val stack = event.stack ?: return
+ if (!LorenzUtils.inSkyBlock || stack.stackSize != 1) return
+ if (!SkyHanniMod.feature.misc.petCandyUsed) return
+
+ val petCandyUsed = stack.getPetCandyUsed() ?: return
+ if (petCandyUsed == 0) return
+
+ val stackTip = "§c$petCandyUsed"
+
+ 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()
+ }
+
+}