aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-12 16:39:15 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-12 16:39:15 +0100
commitdf1f284d375ae8332958b805515fa76d024bbef6 (patch)
treeadb163534811f515a2270b187ce88f9b33c75a1a /src/main/java
parentd55d143f8d4c1e03d092d8f33f26ce9d3a605935 (diff)
downloadskyhanni-df1f284d375ae8332958b805515fa76d024bbef6.tar.gz
skyhanni-df1f284d375ae8332958b805515fa76d024bbef6.tar.bz2
skyhanni-df1f284d375ae8332958b805515fa76d024bbef6.zip
Added support for /neucustomize
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt39
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenCustomKeybinds.kt11
2 files changed, 22 insertions, 28 deletions
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 9c4b46fb8..44298a16d 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,7 @@ import at.hannibal2.skyhanni.data.GardenCropMilestones
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.events.GardenToolChangeEvent
import at.hannibal2.skyhanni.events.ProfileJoinEvent
-import at.hannibal2.skyhanni.utils.ItemUtils.name
+import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.LorenzUtils
import net.minecraft.client.Minecraft
import net.minecraft.item.ItemStack
@@ -47,30 +47,33 @@ class GardenAPI {
}
companion object {
- // TODO use everywhere instead of IslandType.GARDEN
fun inGarden() = LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == IslandType.GARDEN
var cropInHand: String? = null
val cropsPerSecond: MutableMap<String, Int> get() = SkyHanniMod.feature.hidden.gardenCropsPerSecond
- fun getCropTypeFromItem(heldItem: ItemStack): String? {
- val name = heldItem.name ?: return null
- return getCropTypeFromItem(name)
- }
+ fun getCropTypeFromItem(item: ItemStack, withDaedalus: Boolean = false): String? {
+ val internalName = item.getInternalName()
- fun getCropTypeFromItem(itemName: String): String? {
- for ((crop, _) in GardenCropMilestones.cropCounter) {
- if (itemName.contains(crop)) {
- return crop
- }
- }
- if (itemName.contains("Coco Chopper")) {
- return "Cocoa Beans"
- }
- if (itemName.contains("Fungi Cutter")) {
- return "Mushroom"
+ return when {
+ internalName.startsWith("THEORETICAL_HOE_WHEAT") -> "Wheat"
+ internalName.startsWith("THEORETICAL_HOE_CARROT") -> "Carrot"
+ internalName.startsWith("THEORETICAL_HOE_POTATO") -> "Potato"
+ internalName.startsWith("PUMPKIN_DICER") -> "Pumpkin"
+ internalName.startsWith("THEORETICAL_HOE_CANE") -> "Sugar Cane"
+ internalName.startsWith("MELON_DICER") -> "Melon"
+ internalName == "CACTUS_KNIFE" -> "Cactus"
+ internalName == "COCO_CHOPPER" -> "Cocoa Beans"
+ internalName == "FUNGI_CUTTER" -> "Mushroom"
+ internalName.startsWith("ENCHANTED_NETHER_STALK") -> "Nether Wart"
+ internalName.startsWith("THEORETICAL_HOE_WHEAT") -> "Wheat"
+ internalName.startsWith("THEORETICAL_HOE_CARROT") -> "Carrot"
+ internalName.startsWith("PUMPKIN_DICER") -> "Pumpkin"
+
+ internalName.startsWith("DAEDALUS_AXE") && withDaedalus -> "Daedalus Axe"
+
+ else -> null
}
- return null
}
fun readCounter(itemStack: ItemStack): Int {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCustomKeybinds.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCustomKeybinds.kt
index 7130bac5b..8ec5319d5 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCustomKeybinds.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCustomKeybinds.kt
@@ -4,7 +4,6 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.core.config.KeybindHelper
import at.hannibal2.skyhanni.config.features.Garden
import at.hannibal2.skyhanni.mixins.transformers.AccessorKeyBinding
-import at.hannibal2.skyhanni.utils.ItemUtils.name
import net.minecraft.client.Minecraft
import net.minecraft.client.settings.KeyBinding
import net.minecraftforge.event.world.WorldEvent
@@ -56,15 +55,7 @@ class GardenCustomKeybinds {
private fun loadItemInHand(): String {
val heldItem = Minecraft.getMinecraft().thePlayer.heldItem ?: return ""
- val name = heldItem.name ?: return ""
- if (GardenAPI.readCounter(heldItem) == -1) {
- if (name.contains("Daedalus Axe")) {
- return "Daedalus Axe"
- }
- return ""
- }
-
- return GardenAPI.getCropTypeFromItem(name) ?: ""
+ return GardenAPI.getCropTypeFromItem(heldItem, true) ?: ""
}
@SubscribeEvent