aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-01-20 12:25:15 +0100
committerGitHub <noreply@github.com>2024-01-20 12:25:15 +0100
commitbeb38f11b4309392c5a14bb6747b581f27a50ff8 (patch)
tree09c22575e626b99d5c6ee4cf17609f3cfdabf739 /src/main/java/at/hannibal2/skyhanni/features
parentb1b25111e714e370340efbd11abe87ba99748f69 (diff)
downloadskyhanni-beb38f11b4309392c5a14bb6747b581f27a50ff8.tar.gz
skyhanni-beb38f11b4309392c5a14bb6747b581f27a50ff8.tar.bz2
skyhanni-beb38f11b4309392c5a14bb6747b581f27a50ff8.zip
Change: Pet item display scale (#939)
Added option to change the size of the Pet Item Display Icon in inventories. #939
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/PetItemDisplay.kt12
1 files changed, 7 insertions, 5 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
index 35d0c81cc..2f6927083 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/PetItemDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PetItemDisplay.kt
@@ -5,24 +5,26 @@ 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.minecraft.client.Minecraft
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class PetItemDisplay {
- private val configList get() = SkyHanniMod.feature.misc.pets.petItemDisplay
+ private val config get() = SkyHanniMod.feature.misc.pets
@SubscribeEvent
fun onRenderItemOverlayPost(event: GuiRenderItemEvent.RenderOverlayEvent.GuiRenderItemPost) {
val stack = event.stack ?: return
if (!LorenzUtils.inSkyBlock || stack.stackSize != 1) return
- if (configList.isEmpty()) return
+ if (config.petItemDisplay.isEmpty()) return
val petItem = stack.getPetItem() ?: return
- val icon = configList.firstOrNull { it.item == petItem }?.icon ?: return
+ val icon = config.petItemDisplay.firstOrNull { it.item == petItem }?.icon ?: return
- val x = event.x + 17
+ val width = (Minecraft.getMinecraft().fontRendererObj.getStringWidth(icon) * config.petItemDisplayScale).toInt()
+ val x = event.x + 22 - width
val y = event.y - 1
- event.drawSlotText(x, y, icon, .9f)
+ event.drawSlotText(x, y, icon, config.petItemDisplayScale)
}
}