aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/FirstMinionTier.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt18
-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
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/craft/CraftableItemList.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt9
6 files changed, 29 insertions, 35 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/FirstMinionTier.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/FirstMinionTier.kt
index e4bae4f05..e94fb8d84 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/FirstMinionTier.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/FirstMinionTier.kt
@@ -1,13 +1,12 @@
package at.hannibal2.skyhanni.features.bingo
import at.hannibal2.skyhanni.test.command.ErrorManager
-import at.hannibal2.skyhanni.utils.ItemUtils.name
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.getCachedIngredients
+import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull
+import at.hannibal2.skyhanni.utils.PrimitiveRecipe
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
-import io.github.moulberry.notenoughupdates.recipes.CraftingRecipe
object FirstMinionTier {
@@ -30,20 +29,20 @@ object FirstMinionTier {
) {
for (minionId in tierOneMinionsFiltered) {
for (recipe in NEUItems.getRecipes(minionId)) {
- if (recipe !is CraftingRecipe) continue
+ if (!recipe.isCraftingRecipe()) continue
checkOne(recipe, help, minions, minionId)
}
}
}
private fun checkOne(
- recipe: CraftingRecipe,
+ recipe: PrimitiveRecipe,
help: Map<NEUInternalName, Int>,
minions: MutableMap<String, NEUInternalName>,
minionId: NEUInternalName,
) {
- if (recipe.getCachedIngredients().any { help.contains(it.internalItemId.asInternalName()) }) {
- val name = recipe.output.itemStack.name.removeColor()
+ if (recipe.getCachedIngredients().any { help.contains(it.internalName) }) {
+ val name = recipe.output?.internalName?.getItemStackOrNull()?.displayName?.removeColor() ?: return
val abc = name.replace(" I", " 0")
minions[abc] = minionId.replace("_1", "_0")
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt
index c12bafc39..dbec4ea57 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt
@@ -24,7 +24,6 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import com.google.gson.JsonArray
import com.google.gson.JsonObject
-import io.github.moulberry.notenoughupdates.recipes.CraftingRecipe
import net.minecraft.client.Minecraft
import net.minecraft.item.ItemStack
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -139,7 +138,7 @@ object MinionCraftHelper {
for (recipe in recipes) {
for (ingredient in recipe.getCachedIngredients()) {
- val ingredientInternalName = ingredient.internalItemId.asInternalName()
+ val ingredientInternalName = ingredient.internalName
if (ingredientInternalName == internalName) return true
val ingredientPrimitive = NEUItems.getPrimitiveMultiplier(ingredientInternalName)
@@ -169,10 +168,10 @@ object MinionCraftHelper {
if (internalName.contains("_GENERATOR_")) {
for (recipe in NEUItems.getRecipes(internalName)) {
- if (recipe !is CraftingRecipe) continue
+ if (!recipe.isCraftingRecipe()) continue
for (ingredient in recipe.getCachedIngredients()) {
- val id = ingredient.internalItemId.asInternalName()
+ val id = ingredient.internalName
if (!id.contains("_GENERATOR_") && !allIngredients.contains(id)) {
allIngredients.add(id)
}
@@ -194,13 +193,12 @@ object MinionCraftHelper {
newDisplay.add(minionName)
val nextMinionId = minionId.addOneToId()
for (recipe in NEUItems.getRecipes(nextMinionId)) {
- if (recipe !is CraftingRecipe) continue
- val output = recipe.output
- val internalItemId = output.internalItemId.asInternalName()
- if (!internalItemId.contains("_GENERATOR_")) continue
+ if (!recipe.isCraftingRecipe()) continue
+ val output = recipe.output ?: continue
+ if (!output.internalName.contains("_GENERATOR_")) continue
val map = mutableMapOf<NEUInternalName, Int>()
- for (input in recipe.inputs) {
- val itemId = input.internalItemId.asInternalName()
+ for (input in recipe.ingredients) {
+ val itemId = input.internalName
if (minionId != itemId) {
val count = input.count.toInt()
val old = map.getOrDefault(itemId, 0)
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
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/craft/CraftableItemList.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/craft/CraftableItemList.kt
index 6b841f5a4..8612c9795 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/craft/CraftableItemList.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/craft/CraftableItemList.kt
@@ -20,12 +20,12 @@ import at.hannibal2.skyhanni.utils.NEUItems.isVanillaItem
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
import at.hannibal2.skyhanni.utils.PrimitiveItemStack.Companion.toPrimitiveStackOrNull
+import at.hannibal2.skyhanni.utils.PrimitiveRecipe
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables
import at.hannibal2.skyhanni.utils.StringUtils
import at.hannibal2.skyhanni.utils.renderables.Renderable
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
-import io.github.moulberry.notenoughupdates.recipes.CraftingRecipe
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.math.floor
@@ -71,7 +71,7 @@ object CraftableItemList {
val recipes = NEUItems.getRecipes(internalName)
for (recipe in recipes) {
- if (recipe !is CraftingRecipe) continue
+ if (!recipe.isCraftingRecipe()) continue
val renderable = createItemRenderable(recipe, availableMaterial, pricePer, internalName) ?: continue
lines[internalName] = renderable
}
@@ -79,7 +79,7 @@ object CraftableItemList {
}
private fun createItemRenderable(
- recipe: CraftingRecipe,
+ recipe: PrimitiveRecipe,
availableMaterial: Map<NEUInternalName, Long>,
pricePer: MutableMap<NEUInternalName, Double>,
internalName: NEUInternalName,
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt
index 953809b96..81e12f913 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt
@@ -20,13 +20,13 @@ import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzRarity
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.getItemStackOrNull
import at.hannibal2.skyhanni.utils.NEUItems.getNpcPriceOrNull
import at.hannibal2.skyhanni.utils.NEUItems.getPriceOrNull
import at.hannibal2.skyhanni.utils.NEUItems.getRawCraftCostOrNull
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
+import at.hannibal2.skyhanni.utils.PrimitiveIngredient
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getAbilityScrolls
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getArmorDye
@@ -58,7 +58,6 @@ import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.hasJalapenoBook
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.hasWoodSingularity
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.isRecombobulated
import at.hannibal2.skyhanni.utils.StringUtils.allLettersFirstUppercase
-import io.github.moulberry.notenoughupdates.recipes.Ingredient
import io.github.notenoughupdates.moulconfig.observer.Property
import net.minecraft.item.ItemStack
import java.util.Locale
@@ -889,12 +888,12 @@ object EstimatedItemValueCalculator {
val previousTotal = totalPrice
for (ingredients in slot.value) {
- val ingredient = Ingredient(NEUItems.manager, ingredients)
+ val ingredient = PrimitiveIngredient(ingredients)
- totalPrice += if (ingredient.isCoins) {
+ totalPrice += if (ingredient.isCoin()) {
ingredient.count
} else {
- ingredient.internalItemId.asInternalName().getPrice() * ingredient.count
+ ingredient.internalName.getPrice() * ingredient.count
}
}