diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-02-27 18:26:56 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-02-27 18:26:56 +0100 |
commit | 694d5334afbc3bfed8baf6e4f20de9c322f3423e (patch) | |
tree | 86baaf26d7000b5d81e11d0e1d303f4fce6c5ba8 /src/main | |
parent | 59d47ebac12a31ba327862805ec9fa98a626fe0f (diff) | |
download | skyhanni-694d5334afbc3bfed8baf6e4f20de9c322f3423e.tar.gz skyhanni-694d5334afbc3bfed8baf6e4f20de9c322f3423e.tar.bz2 skyhanni-694d5334afbc3bfed8baf6e4f20de9c322f3423e.zip |
Fixed Anita Medal Profit shop detecting wrong items.
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt index 19d658c2a..9ec66e9f8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt @@ -12,6 +12,8 @@ import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.ItemUtils.itemName +import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName @@ -20,6 +22,7 @@ import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NEUItems.getPrice import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems +import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -76,7 +79,7 @@ class AnitaMedalProfit { } private fun readItem(item: ItemStack, table: MutableMap<Pair<String, String>, Pair<Double, NEUInternalName>>) { - val itemName = item.nameWithEnchantment ?: return + val itemName = getItemName(item) ?: return if (itemName == " ") return if (itemName == "§cClose") return if (itemName == "§eUnique Gold Medals") return @@ -101,6 +104,14 @@ class AnitaMedalProfit { table[Pair(itemName, "$color$format")] = Pair(profit, internalName) } + private fun getItemName(item: ItemStack): String? { + val name = item.name ?: return null + val isEnchantedBook = name.removeColor() == "Enchanted Book" + return if (isEnchantedBook) { + item.itemName + } else name + } + private fun getFullCost(requiredItems: MutableList<String>): Double { val jacobTicketPrice = "JACOBS_TICKET".asInternalName().getPrice() var otherItemsPrice = 0.0 |