aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
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
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')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/misc/pets/PetConfig.java7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/PetItemDisplay.kt12
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)
}
}