aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/garden
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2024-09-23 15:48:19 +1000
committerGitHub <noreply@github.com>2024-09-23 07:48:19 +0200
commitb0735ffc3ed655838de6d0d0eb6376cde92483d1 (patch)
treeb98308044ce17e6df360bfc4058756fed4594b64 /src/main/java/at/hannibal2/skyhanni/features/garden
parent8f7b79a0b4953bb64f342ccc21d962c8aacbc169 (diff)
downloadskyhanni-b0735ffc3ed655838de6d0d0eb6376cde92483d1.tar.gz
skyhanni-b0735ffc3ed655838de6d0d0eb6376cde92483d1.tar.bz2
skyhanni-b0735ffc3ed655838de6d0d0eb6376cde92483d1.zip
Backend: Create and use primitive recipe and ingredient (#2460)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt10
2 files changed, 8 insertions, 10 deletions
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 aed4f7e7c..2e8d78966 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
@@ -46,7 +46,6 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.NEUItems
-import at.hannibal2.skyhanni.utils.NEUItems.allIngredients
import at.hannibal2.skyhanni.utils.NEUItems.getItemStack
import at.hannibal2.skyhanni.utils.NEUItems.getPrice
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
@@ -250,13 +249,14 @@ object GardenVisitorFeatures {
val ingredients = NEUItems.getRecipes(internalName)
// TODO describe what this line does
- .firstOrNull() { !it.allIngredients().first().internalItemId.contains("PEST") }
- ?.allIngredients() ?: emptySet()
+ .firstOrNull { !it.ingredients.first().internalName.contains("PEST") }
+ ?.ingredients ?: emptySet()
if (ingredients.isEmpty()) return
+ // TODO change key to NEUInternalName
val requiredIngredients = mutableMapOf<String, Int>()
for (ingredient in ingredients) {
- val key = ingredient.internalItemId
+ val key = ingredient.internalName.asString()
requiredIngredients[key] =
requiredIngredients.getOrDefault(key, 0) + ingredient.count.toInt()
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt
index f441d17ab..26bfa7f26 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt
@@ -8,14 +8,11 @@ import at.hannibal2.skyhanni.events.render.gui.ReplaceItemEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.HypixelCommands
-import at.hannibal2.skyhanni.utils.ItemUtils.itemName
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.NEUItems
-import at.hannibal2.skyhanni.utils.NEUItems.allIngredients
import at.hannibal2.skyhanni.utils.NEUItems.getItemStack
import at.hannibal2.skyhanni.utils.SimpleTimeMark
-import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import io.github.moulberry.notenoughupdates.util.Utils
import net.minecraft.entity.player.InventoryPlayer
import net.minecraftforge.fml.common.eventhandler.EventPriority
@@ -74,11 +71,12 @@ object GardenVisitorSupercraft {
private fun getSupercraftForSacks(internalName: NEUInternalName, amount: Int) {
val ingredients = NEUItems.getRecipes(internalName)
// TODO describe what this line does
- .firstOrNull { !it.allIngredients().first().internalItemId.contains("PEST") }
- ?.allIngredients() ?: return
+ .firstOrNull { !it.ingredients.first().internalName.contains("PEST") }
+ ?.ingredients ?: return
+ // TODO change key to NEUInternalName
val ingredientReqs = mutableMapOf<String, Int>()
for (ingredient in ingredients) {
- val key = ingredient.internalItemId
+ val key = ingredient.internalName.asString()
ingredientReqs[key] = ingredientReqs.getOrDefault(key, 0) + ingredient.count.toInt()
}
hasIngredients = true