diff options
author | Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> | 2024-01-16 19:02:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-16 19:02:43 +0100 |
commit | ec1aefdaae5490d264d4d932394896f861981045 (patch) | |
tree | 0efa87285ee1488a4de0dc7423e6115f0c0eb249 /src/main/java/at/hannibal2/skyhanni/features/misc | |
parent | 69cfa25c720884f44d6ed99e24d2eb4176f09e37 (diff) | |
download | skyhanni-ec1aefdaae5490d264d4d932394896f861981045.tar.gz skyhanni-ec1aefdaae5490d264d4d932394896f861981045.tar.bz2 skyhanni-ec1aefdaae5490d264d4d932394896f861981045.zip |
Feature: Pet Item Display (#850)
Show Pet Items Xp Share core and Tier Boost as small icon next to the pet in an inventory. #850
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/PetItemDisplay.kt | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PetItemDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PetItemDisplay.kt new file mode 100644 index 000000000..35d0c81cc --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PetItemDisplay.kt @@ -0,0 +1,28 @@ +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.drawSlotText +import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetItem +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class PetItemDisplay { + + private val configList get() = SkyHanniMod.feature.misc.pets.petItemDisplay + + @SubscribeEvent + fun onRenderItemOverlayPost(event: GuiRenderItemEvent.RenderOverlayEvent.GuiRenderItemPost) { + val stack = event.stack ?: return + if (!LorenzUtils.inSkyBlock || stack.stackSize != 1) return + if (configList.isEmpty()) return + + val petItem = stack.getPetItem() ?: return + val icon = configList.firstOrNull { it.item == petItem }?.icon ?: return + + val x = event.x + 17 + val y = event.y - 1 + + event.drawSlotText(x, y, icon, .9f) + } +} |