diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-06-19 11:35:13 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-06-19 11:35:13 +0200 |
commit | 3241bab22facd1eae3a42487fc406504f82f8aaf (patch) | |
tree | 08d265fd244dde95bee702fc4154066fad9587f0 /src | |
parent | ee7cd18b8c40d3fbb2825ff5c7178c22307d2698 (diff) | |
download | skyhanni-3241bab22facd1eae3a42487fc406504f82f8aaf.tar.gz skyhanni-3241bab22facd1eae3a42487fc406504f82f8aaf.tar.bz2 skyhanni-3241bab22facd1eae3a42487fc406504f82f8aaf.zip |
added name to stacking display, support for maxed out stacking items
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt | 13 |
1 files changed, 9 insertions, 4 deletions
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<String>?) 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<Int>): 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<String>?) 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 |