From 3241bab22facd1eae3a42487fc406504f82f8aaf Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 19 Jun 2023 11:35:13 +0200 Subject: added name to stacking display, support for maxed out stacking items --- .../skyhanni/features/misc/discordrpc/DiscordStatus.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt index 8bd590cf2..20f203bb7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt @@ -12,8 +12,11 @@ import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.features.garden.GardenAPI.getCropType import at.hannibal2.skyhanni.utils.InventoryUtils +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.colorCodeToRarity +import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TabListData.Companion.getTabList @@ -271,18 +274,20 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier?) STACKING({ // Logic for getting the currently held stacking enchant is from Skytils, except for getExtraAttributes() which they got from BiscuitDevelopment - fun getExtraAttributes(item: ItemStack?): NBTTagCompound? { return if (item == null || !item.hasTagCompound()) { null } else item.getSubCompound("ExtraAttributes", false) } - val extraAttributes = getExtraAttributes(Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem()) + val itemInHand = Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem() + val itemName = itemInHand?.let { NEUItems.getItemStack(it.getInternalName()).name?.removeColor() ?: "" } ?: "" + + val extraAttributes = getExtraAttributes(itemInHand) fun getProgressPercent(amount: Int, levels: List): String { var currentLevel = 0 - var percent = "" + var percent = "MAXED" for (level in levels.indices) { if (amount > levels[level]) { currentLevel++ @@ -315,7 +320,7 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier?) stackingReturn = if (stackingPercent == "" || amount == 0) "" // outdated info is useless for AUTO; empty strings are manually ignored - else "${stackingEnchant.firstLetterUppercase()} $level ($stackingPercent)" // Hecatomb 100: (55.55%) + else "$itemName: ${stackingEnchant.firstLetterUppercase()} $level ($stackingPercent)" // Hecatomb 100: (55.55%) } stackingReturn -- cgit