diff options
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/misc/pets/PetConfig.java | 7 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/PetItemDisplay.kt | 12 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/pets/PetConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/pets/PetConfig.java index cf5cda654..dc1919042 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/pets/PetConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/pets/PetConfig.java @@ -6,6 +6,7 @@ import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.Accordion; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorDraggableList; +import io.github.moulberry.moulconfig.annotations.ConfigEditorSlider; import io.github.moulberry.moulconfig.annotations.ConfigOption; import java.util.ArrayList; import java.util.Arrays; @@ -41,6 +42,12 @@ public class PetConfig { PetItemsDisplay.TIER_BOOST )); + @Expose + @ConfigOption(name = "Pet Item Scale", desc = "The scale at which the Pet Item will be displayed.") + @ConfigEditorSlider(minValue = 0.7f, maxValue = 1.5f, minStep = 0.05f) + public float petItemDisplayScale = 0.9f; + + public enum PetItemsDisplay { XP_SHARE("§5⚘", "Exp Share", "PET_ITEM_EXP_SHARE"), TIER_BOOST("§c●", "Tier Boost", "PET_ITEM_TIER_BOOST"), 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) } } |