diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-02-19 13:29:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-19 13:29:45 +0100 |
commit | 7d9a6a101071c75773668e0881b37466506307dd (patch) | |
tree | 0f46abdd4375d2eeb1a5c8154a2cb72046fb7621 /src/main/java/at/hannibal2/skyhanni/features | |
parent | 4bb1419b90e424ac824042188f67a371a5c276da (diff) | |
download | skyhanni-7d9a6a101071c75773668e0881b37466506307dd.tar.gz skyhanni-7d9a6a101071c75773668e0881b37466506307dd.tar.bz2 skyhanni-7d9a6a101071c75773668e0881b37466506307dd.zip |
Item name rewrite and cache #1016
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
10 files changed, 33 insertions, 33 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt index 770c06ba9..3e409b0c6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt @@ -6,7 +6,7 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.features.bazaar.BazaarApi.Companion.getBazaarData import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName -import at.hannibal2.skyhanni.utils.ItemUtils.getNameWithEnchantment +import at.hannibal2.skyhanni.utils.ItemUtils.itemName import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NumberUtil @@ -59,7 +59,7 @@ class BazaarBestSellMethod { val totalDiff = (data.buyPrice - data.sellPrice) * having val result = NumberUtil.format(totalDiff.toInt()) - val name = internalName.getNameWithEnchantment() + val name = internalName.itemName return "$name§7 sell difference: §6$result coins" } diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt index dbdf73535..7ada19315 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt @@ -7,8 +7,8 @@ import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName -import at.hannibal2.skyhanni.utils.ItemUtils.getItemName import at.hannibal2.skyhanni.utils.ItemUtils.hasEnchantments +import at.hannibal2.skyhanni.utils.ItemUtils.itemName import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName @@ -210,7 +210,7 @@ class MinionCraftHelper { val needAmount = need * multiplier val have = otherItems.getOrDefault(itemId, 0) val percentage = have.toDouble() / needAmount - val itemName = rawId.getItemName() + val itemName = rawId.itemName val isTool = itemId.startsWith("WOOD_") if (percentage >= 1) { val color = if (isTool) "§7" else "§a" diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt index 42d417a5a..217b01259 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.features.garden.farming.CropMoneyDisplay import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.sorted -import at.hannibal2.skyhanni.utils.ItemUtils.getItemName +import at.hannibal2.skyhanni.utils.ItemUtils.itemName import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber @@ -45,10 +45,10 @@ object GardenCropTimeCommand { val map = mutableMapOf<String, Long>() for (entry in multipliers) { val internalName = entry.key - val itemName = internalName.getItemName() + val itemName = internalName.itemName if (itemName.removeColor().lowercase().contains(searchName)) { val (baseId, baseAmount) = NEUItems.getMultiplier(internalName) - val baseName = baseId.getItemName() + val baseName = baseId.itemName val crop = CropType.getByName(baseName.removeColor()) val fullAmount = baseAmount.toLong() * amount diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt index 4bf34a5ae..8523a7a58 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.features.garden.farming.CropMoneyDisplay import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.sorted -import at.hannibal2.skyhanni.utils.ItemUtils.getItemName +import at.hannibal2.skyhanni.utils.ItemUtils.itemName import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -44,10 +44,10 @@ object GardenCropsInCommand { val map = mutableMapOf<String, Long>() for (entry in multipliers) { val internalName = entry.key - val itemName = internalName.getItemName() + val itemName = internalName.itemName if (itemName.removeColor().lowercase().contains(searchName)) { val (baseId, baseAmount) = NEUItems.getMultiplier(internalName) - val baseName = baseId.getItemName() + val baseName = baseId.itemName val crop = CropType.getByName(baseName.removeColor()) val speed = crop.getSpeed() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt index c592b7837..771c1df2a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt @@ -24,7 +24,7 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName -import at.hannibal2.skyhanni.utils.ItemUtils.getItemNameOrNull +import at.hannibal2.skyhanni.utils.ItemUtils.itemNameWithoutColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName @@ -37,7 +37,6 @@ import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getReforgeName -import at.hannibal2.skyhanni.utils.StringUtils.removeColor import kotlinx.coroutines.launch import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -209,7 +208,7 @@ object CropMoneyDisplay { } if (!config.compact) { - val itemName = internalName.getItemNameOrNull()?.removeColor() ?: continue + val itemName = internalName.itemNameWithoutColor val currentColor = if (isCurrent) "§e" else "§7" val contestFormat = if (GardenNextJacobContest.isNextCrop(crop)) "§n" else "" list.add("$currentColor$contestFormat$itemName§7: ") @@ -408,7 +407,7 @@ object CropMoneyDisplay { if (!internalName.isBazaarItem()) continue val (newId, amount) = NEUItems.getMultiplier(internalName) - val itemName = newId.getItemNameOrNull()?.removeColor() ?: continue + val itemName = newId.itemNameWithoutColor val crop = getByNameOrNull(itemName) crop?.let { map[internalName] = amount diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt index f137651a0..2d33fd9b1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt @@ -12,8 +12,8 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI.getCropType import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI.Companion.currentPet import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI.Companion.getItem import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName -import at.hannibal2.skyhanni.utils.ItemUtils.getItemName import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarityOrCommon +import at.hannibal2.skyhanni.utils.ItemUtils.itemName import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NumberUtil.addSuffix import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getEnchantments @@ -84,7 +84,7 @@ object FortuneUpgrades { val nextTalisman = CropAccessory.entries[currentTalismanTier + 1] genericUpgrades.add( FortuneUpgrade( - "§7Upgrade your talisman to ${nextTalisman.internalName?.getItemName()}", + "§7Upgrade your talisman to ${nextTalisman.internalName?.itemName}", null, nextTalisman.upgradeCost?.first!!, nextTalisman.upgradeCost.second, 10.0 ) ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index d32b8e75d..4b659e9bf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -33,9 +33,9 @@ import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemBlink import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName -import at.hannibal2.skyhanni.utils.ItemUtils.getItemName -import at.hannibal2.skyhanni.utils.ItemUtils.getItemNameOrNull import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.ItemUtils.itemName +import at.hannibal2.skyhanni.utils.ItemUtils.itemNameWithoutColor import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils @@ -179,7 +179,7 @@ class GardenVisitorFeatures { var totalPrice = 0.0 addAsSingletonList("§7Visitor Shopping List:") for ((internalName, amount) in shoppingList) { - val name = internalName.getItemName() + val name = internalName.itemName val itemStack = internalName.getItemStack() val list = mutableListOf<Any>() @@ -410,7 +410,7 @@ class GardenVisitorFeatures { if (!readingShoppingList) continue val multiplier = NEUItems.getMultiplier(internalName) - val rawName = multiplier.first.getItemNameOrNull()?.removeColor() ?: continue + val rawName = multiplier.first.itemNameWithoutColor val cropType = getByNameOrNull(rawName) ?: continue val cropAmount = multiplier.second.toLong() * amount diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt index 35222706e..506f53b5b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt @@ -16,6 +16,7 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull +import at.hannibal2.skyhanni.utils.ItemUtils.itemName import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addButton import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland @@ -129,12 +130,12 @@ class ChestValue { if (total < config.hideBelow) continue val textAmount = " §7x$amount:" val width = Minecraft.getMinecraft().fontRendererObj.getStringWidth(textAmount) - val name = "${stack.displayName.reduceStringLength((config.nameLength - width), ' ')} $textAmount" + val name = "${stack.itemName.reduceStringLength((config.nameLength - width), ' ')} $textAmount" val price = "§6${(total).formatPrice()}" val text = if (config.alignedDisplay) "$name $price" else - "${stack.displayName} §7x$amount: §6${total.formatPrice()}" + "${stack.itemName} §7x$amount: §6${total.formatPrice()}" newDisplay.add(buildList { val renderable = Renderable.hoverTips( text, diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/PowerStoneGuideFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/PowerStoneGuideFeatures.kt index d0e1a80a3..bd97c298f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/PowerStoneGuideFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/PowerStoneGuideFeatures.kt @@ -7,8 +7,8 @@ import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.features.bazaar.BazaarApi import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter -import at.hannibal2.skyhanni.utils.ItemUtils.getItemName import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.ItemUtils.itemName import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName @@ -65,7 +65,7 @@ class PowerStoneGuideFeatures { if (!inInventory) return val internalName = missing[event.slotId] ?: return - BazaarApi.searchForBazaarItem(internalName.getItemName(), 9) + BazaarApi.searchForBazaarItem(internalName.itemName, 9) } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt index d0c0d74f2..8ea9195f8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt @@ -4,10 +4,11 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName -import at.hannibal2.skyhanni.utils.ItemUtils.getItemName import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarityOrNull import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.isRune +import at.hannibal2.skyhanni.utils.ItemUtils.itemName +import at.hannibal2.skyhanni.utils.ItemUtils.itemNameWithoutColor import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment import at.hannibal2.skyhanni.utils.LorenzRarity @@ -47,7 +48,6 @@ import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.hasJalapenoBook import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.hasWoodSingularity import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.isRecombobulated import at.hannibal2.skyhanni.utils.StringUtils.allLettersFirstUppercase -import at.hannibal2.skyhanni.utils.StringUtils.removeColor import com.google.gson.JsonObject import io.github.moulberry.notenoughupdates.recipes.Ingredient import io.github.moulberry.notenoughupdates.util.Constants @@ -173,7 +173,7 @@ object EstimatedItemValueCalculator { if (rawReforgeName == reforgeName.lowercase() || rawReforgeName == rawInternalName.lowercase()) { val internalName = rawInternalName.asInternalName() val reforgeStonePrice = internalName.getPrice() - val reforgeStoneName = internalName.getItemName() + val reforgeStoneName = internalName.itemName val reforgeCosts = stoneJson.get("reforgeCosts").asJsonObject val applyCost = getReforgeStoneApplyCost(stack, reforgeCosts, internalName) ?: return 0.0 @@ -412,7 +412,7 @@ object EstimatedItemValueCalculator { var totalPrice = 0.0 val map = mutableMapOf<String, Double>() for (internalName in drillUpgrades) { - val name = internalName.getItemName() + val name = internalName.itemName val price = internalName.getPriceOrNull() ?: continue totalPrice += price @@ -430,7 +430,7 @@ object EstimatedItemValueCalculator { val internalName = stack.getPowerScroll() ?: return 0.0 val price = internalName.getPrice() - val name = internalName.getItemName().removeColor() + val name = internalName.itemNameWithoutColor list.add("§7$name: §a§l✔ §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -469,7 +469,7 @@ object EstimatedItemValueCalculator { val internalName = "TALISMAN_ENRICHMENT_$enrichmentName".asInternalName() val price = internalName.getPrice() - val name = internalName.getItemName() + val name = internalName.itemName list.add("§7Enrichment: $name §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -492,7 +492,7 @@ object EstimatedItemValueCalculator { var totalPrice = 0.0 val map = mutableMapOf<String, Double>() for (internalName in abilityScrolls) { - val name = internalName.getItemName() + val name = internalName.itemName val price = internalName.getPriceOrNull() ?: continue totalPrice += price @@ -513,7 +513,7 @@ object EstimatedItemValueCalculator { price = 0.0 } - val name = internalName.getItemName() + val name = internalName.itemName if (internalName.startsWith("ENCHANTED_BOOK_BUNDLE_")) { list.add("§7Base item: $name") return 0.0 @@ -627,7 +627,7 @@ object EstimatedItemValueCalculator { val priceMap = mutableMapOf<String, Double>() for ((internalName, amount) in counterMap) { - val name = internalName.getItemName() + val name = internalName.itemName val price = internalName.getPrice() * amount totalPrice += price |