aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-09 14:12:31 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-09 14:12:31 +0200
commit14e306e77902fdbf3564121f069028dd5f55fef8 (patch)
treefe44e859d2aaef231b46120e3fd3cd6c6547fc28 /src/main/java/at/hannibal2
parentd19350d4b0b99f6b04680aba9686ddbe1e7df780 (diff)
downloadskyhanni-14e306e77902fdbf3564121f069028dd5f55fef8.tar.gz
skyhanni-14e306e77902fdbf3564121f069028dd5f55fef8.tar.bz2
skyhanni-14e306e77902fdbf3564121f069028dd5f55fef8.zip
Using NEUInternalName in CropAccessory
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt25
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt2
4 files changed, 30 insertions, 13 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt
index f566c8d60..0fcc94bf8 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/CropAccessoryData.kt
@@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.features.garden.CropAccessory
import at.hannibal2.skyhanni.features.garden.GardenAPI
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
import at.hannibal2.skyhanni.utils.NEUItems
import com.google.gson.JsonElement
@@ -95,10 +95,9 @@ class CropAccessoryData {
}
- private fun bestCropAccessory(items: Iterable<ItemStack>): CropAccessory {
- return items.mapNotNull { item -> CropAccessory.getByName(item.getInternalName_old()) }
+ private fun bestCropAccessory(items: Iterable<ItemStack>) =
+ items.mapNotNull { item -> CropAccessory.getByName(item.getInternalName()) }
.maxOrNull() ?: CropAccessory.NONE
- }
companion object {
var accessoryBagPageCount = 0
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt
index c4269ce2e..22d553ea4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt
@@ -1,14 +1,27 @@
package at.hannibal2.skyhanni.features.garden
-enum class CropAccessory(val internalName: String, private val affectedCrops: Set<CropType>, private val fortune: Double, val upgradeCost: Pair<String, Int>?) {
- NONE("NONE", emptySet(), 0.0, null),
- CROPIE("CROPIE_TALISMAN", setOf(CropType.WHEAT, CropType.POTATO, CropType.CARROT), 10.0, Pair("CROPIE", 256)),
+import at.hannibal2.skyhanni.utils.NEUInternalName
+import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
+
+enum class CropAccessory(
+ val internalName: NEUInternalName?,
+ private val affectedCrops: Set<CropType>,
+ private val fortune: Double,
+ val upgradeCost: Pair<String, Int>?
+) {
+ NONE(null, emptySet(), 0.0, null),
+ CROPIE(
+ "CROPIE_TALISMAN".asInternalName(),
+ setOf(CropType.WHEAT, CropType.POTATO, CropType.CARROT),
+ 10.0,
+ Pair("CROPIE", 256)
+ ),
SQUASH(
- "SQUASH_RING",
+ "SQUASH_RING".asInternalName(),
setOf(CropType.WHEAT, CropType.POTATO, CropType.CARROT, CropType.COCOA_BEANS, CropType.MELON, CropType.PUMPKIN),
20.0, Pair("SQUASH", 128)
),
- FERMENTO("FERMENTO_ARTIFACT", CropType.entries.toSet(), 30.0, Pair("CONDENSED_FERMENTO", 8)),
+ FERMENTO("FERMENTO_ARTIFACT".asInternalName(), CropType.entries.toSet(), 30.0, Pair("CONDENSED_FERMENTO", 8)),
;
fun getFortune(cropType: CropType): Double {
@@ -16,6 +29,6 @@ enum class CropAccessory(val internalName: String, private val affectedCrops: Se
}
companion object {
- fun getByName(internalName: String) = entries.firstOrNull { it.internalName == internalName }
+ fun getByName(internalName: NEUInternalName) = entries.firstOrNull { internalName == it.internalName }
}
} \ No newline at end of file
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 2c1d66ba1..8f6a2c207 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,6 +12,7 @@ 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_old
+import at.hannibal2.skyhanni.utils.ItemUtils.getItemName
import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarity
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.NumberUtil.addSuffix
@@ -72,8 +73,12 @@ object FortuneUpgrades {
val currentTalismanTier = CropAccessoryData.cropAccessory?.ordinal ?: return
if (currentTalismanTier < 3) {
val nextTalisman = CropAccessory.entries[currentTalismanTier + 1]
- genericUpgrades.add(FortuneUpgrade("§7Upgrade your talisman to ${nextTalisman.internalName.replace("_", " ").lowercase()}",
- null, nextTalisman.upgradeCost?.first!!, nextTalisman.upgradeCost.second, 10.0))
+ genericUpgrades.add(
+ FortuneUpgrade(
+ "§7Upgrade your talisman to ${nextTalisman.internalName?.getItemName()}",
+ null, nextTalisman.upgradeCost?.first!!, nextTalisman.upgradeCost.second, 10.0
+ )
+ )
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
index 0e831e486..6aa6fa28c 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
@@ -137,7 +137,7 @@ object NEUItems {
.resolveInternalName()
fun getInternalNameOrNull(nbt: NBTTagCompound) =
- ItemResolutionQuery(manager).withItemNBT(nbt).resolveInternalName()
+ ItemResolutionQuery(manager).withItemNBT(nbt).resolveInternalName()?.asInternalName()
fun NEUInternalName.getPriceOrNull(useSellingPrice: Boolean = false): Double? {
val price = getPrice(useSellingPrice)