aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-02 14:05:02 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-02 14:05:02 +0200
commitd60e47a53690d8b337f9f08b893741c3581e4356 (patch)
tree52ced6fe46a6709919371698115d1bcad7ed5d4b /src/main/java/at
parent48972f7ac5f686fd93f17de3692f3e4888453ad7 (diff)
downloadskyhanni-d60e47a53690d8b337f9f08b893741c3581e4356.tar.gz
skyhanni-d60e47a53690d8b337f9f08b893741c3581e4356.tar.bz2
skyhanni-d60e47a53690d8b337f9f08b893741c3581e4356.zip
Fixed garden visitor time needed display not working with mushroom items
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt2
4 files changed, 11 insertions, 11 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt
index bfc20a7cd..a09102033 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt
@@ -202,7 +202,7 @@ class CropMoneyDisplay {
val (newId, amount) = NEUItems.getMultiplier(internalName)
if (amount < 10) continue
val itemName = NEUItems.getItemStack(newId).name?.removeColor() ?: continue
- val crop = GardenAPI.itemNameToCropName(itemName)
+ val crop = CropType.getByItemName(itemName)
crop?.let {
multipliers[internalName] = amount
cropNames[internalName] = it
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt
index d81702ffd..d83399c77 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt
@@ -21,9 +21,17 @@ enum class CropType(val cropName: String, val toolName: String, iconSupplier: ()
val icon by lazy { iconSupplier() }
companion object {
- fun getByName(name: String) = values().firstOrNull { it.cropName == name }
+ fun getByName(cropName: String) = values().firstOrNull { it.cropName == cropName }
// TODO find better name for this method
fun getByNameNoNull(name: String) = getByName(name) ?: throw RuntimeException("No valid crop type '$name'")
+
+
+ fun getByItemName(itemName: String): CropType? {
+ if (itemName == "Red Mushroom" || itemName == "Brown Mushroom") {
+ return MUSHROOM
+ }
+ return getByName(itemName)
+ }
}
} \ No newline at end of file
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 67b543c03..4218056e9 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt
@@ -5,7 +5,6 @@ import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.NEUItems
import net.minecraft.client.Minecraft
import net.minecraft.item.ItemStack
import net.minecraft.network.play.client.C09PacketHeldItemChange
@@ -121,13 +120,6 @@ class GardenAPI {
cropsPerSecond[this] = speed
}
- fun itemNameToCropName(itemName: String): CropType? {
- if (itemName == "Red Mushroom" || itemName == "Brown Mushroom") {
- return CropType.MUSHROOM
- }
- return CropType.getByName(itemName)
- }
-
fun addGardenCropToList(crop: CropType, list: MutableList<Any>) {
try {
list.add(crop.icon)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
index 917b40b85..41f8a0ba2 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
@@ -274,7 +274,7 @@ class GardenVisitorFeatures {
if (config.visitorExactAmountAndTime) {
val multiplier = NEUItems.getMultiplier(internalName)
val rawName = NEUItems.getItemStack(multiplier.first).name?.removeColor() ?: continue
- CropType.getByName(rawName)?.let {
+ CropType.getByItemName(rawName)?.let {
val speed = it.getSpeed()
val cropAmount = multiplier.second.toLong() * amount
val formatAmount = LorenzUtils.formatInteger(cropAmount)