aboutsummaryrefslogtreecommitdiff
path: root/src
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
parent4dec09c6d96567f69ca92199bc263a8fbd9cd166 (diff)
downloadskyhanni-d6df4f69afbe547a8e9373b0be4baa69d9e02a54.tar.gz
skyhanni-d6df4f69afbe547a8e9373b0be4baa69d9e02a54.tar.bz2
skyhanni-d6df4f69afbe547a8e9373b0be4baa69d9e02a54.zip
Added Pet Candies Used number
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Misc.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt44
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt4
4 files changed, 54 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index f7ec83601..555761bbe 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -276,6 +276,7 @@ class SkyHanniMod {
loadModule(GardenVisitorDropStatistics)
loadModule(SackDisplay())
loadModule(GardenStartLocation)
+ loadModule(PetCandyUsedDisplay())
init()
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java
index 69cc53b4a..f5ad1513c 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java
@@ -412,6 +412,11 @@ public class Misc {
public Position playerMovementSpeedPos = new Position(394, 124, false, true);
@Expose
+ @ConfigOption(name = "Pet Candy Used", desc = "Show numbers of pet candies used on a pet.")
+ @ConfigEditorBoolean
+ public boolean petCandyUsed = true;
+
+ @Expose
@ConfigOption(name = "Config Button", desc = "Add a button to the pause menu to configure SkyHanni.")
@ConfigEditorBoolean
public boolean configButtonOnPause = true;
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()
+ }
+
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
index dc59d832a..678772499 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
@@ -1,7 +1,9 @@
package at.hannibal2.skyhanni.utils
+import at.hannibal2.skyhanni.config.ConfigManager
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.name
+import com.google.gson.JsonObject
import net.minecraft.item.ItemStack
object SkyBlockItemModifierUtils {
@@ -23,6 +25,8 @@ object SkyBlockItemModifierUtils {
fun ItemStack.getManaDisintegrators() = getAttributeInt("mana_disintegrator_count")
+ fun ItemStack.getPetCandyUsed() = ConfigManager.gson.fromJson(getExtraAttributes()?.getString("petInfo"), JsonObject::class.java)?.get("candyUsed")?.asInt
+
fun ItemStack.getMasterStars(): Int {
val stars = mapOf(
"➊" to 1,