From dd8f864bae8e0bee81b8be9b791598f764d5df6f Mon Sep 17 00:00:00 2001 From: Walker Selby Date: Fri, 20 Oct 2023 18:50:12 +0100 Subject: Internal Changes: getInternalName Pt 1 (#546) Internal Changes: getInternalName Pt 1 #546 --- .../features/event/diana/GriffinBurrowParticleFinder.kt | 5 +++-- .../skyhanni/features/garden/FarmingFortuneDisplay.kt | 5 ++--- .../java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt | 11 ++++++----- .../at/hannibal2/skyhanni/features/rift/area/RiftLarva.kt | 4 ++-- .../skyhanni/features/rift/area/westvillage/KloonHacking.kt | 4 ++-- src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt | 2 +- src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt | 4 ++-- 7 files changed, 18 insertions(+), 17 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt index dcc0e9593..403581862 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt @@ -8,7 +8,8 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt -import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.toLorenzVec import net.minecraft.init.Blocks @@ -130,7 +131,7 @@ class GriffinBurrowParticleFinder { } private val ItemStack.isSpade - get() = getInternalName_old() == "ANCESTRAL_SPADE" + get() = getInternalName().equals("ANCESTRAL_SPADE") class Burrow( var location: LorenzVec, diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt index 03771efc8..9b57e1fe1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt @@ -17,7 +17,6 @@ import at.hannibal2.skyhanni.features.garden.CropType.Companion.getTurboCrop import at.hannibal2.skyhanni.features.garden.GardenAPI.addCropIcon import at.hannibal2.skyhanni.features.garden.GardenAPI.getCropType import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName -import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList @@ -257,9 +256,9 @@ class FarmingFortuneDisplay { displayedFortune = match[1]!!.value.toDouble() reforgeFortune = match[2]?.value?.toDouble() ?: 0.0 - itemBaseFortune = if (tool.getInternalName_old().contains("LOTUS")) 5.0 + itemBaseFortune = if (tool.getInternalName().contains("LOTUS")) 5.0 else displayedFortune - reforgeFortune - enchantmentFortune - (tool.getFarmingForDummiesCount() ?: 0 ) * 1.0 - greenThumbFortune = if (tool.getInternalName_old().contains("LOTUS")) { + greenThumbFortune = if (tool.getInternalName().contains("LOTUS")) { displayedFortune - reforgeFortune - itemBaseFortune } else 0.0 } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt index 2f398f6ce..e67de332f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt @@ -23,11 +23,12 @@ import at.hannibal2.skyhanni.features.garden.inventory.SkyMartCopperPrice import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI import at.hannibal2.skyhanni.utils.BlockUtils.isBabyCrop import at.hannibal2.skyhanni.utils.InventoryUtils -import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LocationUtils.isPlayerInside import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.MinecraftDispatcher +import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getCultivatingCounter import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getHoeCounter import at.hannibal2.skyhanni.utils.jsonobjects.GardenJson @@ -122,11 +123,11 @@ object GardenAPI { private fun getToolInHand(toolItem: ItemStack?, crop: CropType?): String? { if (crop != null) return crop.cropName - val internalName = toolItem?.getInternalName_old() ?: return null - return if (isOtherTool(internalName)) internalName else null + val internalName = toolItem?.getInternalName() ?: return null + return if (isOtherTool(internalName)) internalName.asString() else null } - private fun isOtherTool(internalName: String): Boolean { + private fun isOtherTool(internalName: NEUInternalName): Boolean { if (internalName.startsWith("DAEDALUS_AXE")) return true if (internalName.startsWith("BASIC_GARDENING_HOE")) return true @@ -145,7 +146,7 @@ object GardenAPI { fun inGarden() = LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == IslandType.GARDEN fun ItemStack.getCropType(): CropType? { - val internalName = getInternalName_old() + val internalName = getInternalName() return CropType.entries.firstOrNull { internalName.startsWith(it.toolName) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/RiftLarva.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/RiftLarva.kt index 78e95fa84..c68e6d2f5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/RiftLarva.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/RiftLarva.kt @@ -7,7 +7,7 @@ import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper import at.hannibal2.skyhanni.utils.EntityUtils.getEntities import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture import at.hannibal2.skyhanni.utils.InventoryUtils -import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -31,7 +31,7 @@ class RiftLarva { } private fun checkHand() { - hasHookInHand = InventoryUtils.getItemInHand()?.getInternalName_old() == "LARVA_HOOK" + hasHookInHand = InventoryUtils.getItemInHand()?.getInternalName()?.equals("LARVA_HOOK") ?: false } private fun findLarvas() { diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/KloonHacking.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/KloonHacking.kt index eb4c5f7e3..78c3c4275 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/KloonHacking.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/KloonHacking.kt @@ -11,7 +11,7 @@ import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.InventoryUtils -import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzColor @@ -39,7 +39,7 @@ class KloonHacking { } private fun checkHelmet() { - wearingHelmet = InventoryUtils.getArmor()[3]?.getInternalName_old() == "RETRO_ENCABULATING_VISOR" + wearingHelmet = InventoryUtils.getArmor()[3]?.getInternalName()?.equals("RETRO_ENCABULATING_VISOR") ?: false } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt index 50f5c0110..506f557b7 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt @@ -239,7 +239,7 @@ object ItemUtils { } else it } - fun isSkyBlockMenuItem(stack: ItemStack?): Boolean = stack?.getInternalName_old() == "SKYBLOCK_MENU" + fun isSkyBlockMenuItem(stack: ItemStack?): Boolean = stack?.getInternalName()?.equals("SKYBLOCK_MENU") ?: false private val patternInFront = "(?: *§8(\\+§[\\d\\w])?(?[\\d\\.km,]+)(x )?)?(?.*)".toPattern() private val patternBehind = "(?(?:['\\w-]+ ?)+)(?:§8x(?[\\d,]+))?".toPattern() diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index dd4e21dc1..fdbe8c995 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.features.bazaar.BazaarDataHolder import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ItemBlink.checkBlinkItem -import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -191,7 +191,7 @@ object NEUItems { fallbackItem } - fun isVanillaItem(item: ItemStack) = manager.auctionManager.isVanillaItem(item.getInternalName_old()) + fun isVanillaItem(item: ItemStack) = manager.auctionManager.isVanillaItem(item.getInternalName().asString()) fun ItemStack.renderOnScreen(x: Float, y: Float, scaleMultiplier: Double = 1.0) { val item = checkBlinkItem() -- cgit