From beb38f11b4309392c5a14bb6747b581f27a50ff8 Mon Sep 17 00:00:00 2001 From: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Date: Sat, 20 Jan 2024 12:25:15 +0100 Subject: Change: Pet item display scale (#939) Added option to change the size of the Pet Item Display Icon in inventories. #939 --- .../at/hannibal2/skyhanni/features/misc/PetItemDisplay.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc') 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) } } -- cgit