Handle vanilla-like trim cloning recipes

This commit is contained in:
DBotThePony 2023-11-16 21:44:20 +07:00
parent 280a8f3431
commit 940d8333de
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -731,7 +731,7 @@ object MatterManager {
private fun doTryToBacktrack(item: Item, makeCommentary: Boolean): Result { private fun doTryToBacktrack(item: Item, makeCommentary: Boolean): Result {
val recipes = input2Recipes[item] val recipes = input2Recipes[item]
if (recipes == null || recipes.isEmpty() || !recipes.all { it.allowBacktrack } || !recipes.all { it.inputs.all { it.all { it.input.item == item } } }) { if (recipes.isNullOrEmpty() || !recipes.all { it.allowBacktrack } || !recipes.all { it.inputs.all { it.all { it.input.item == item } } }) {
if (makeCommentary) if (makeCommentary)
comment(item, TextComponent("Item '${item.registryName}' has no recipes")) comment(item, TextComponent("Item '${item.registryName}' has no recipes"))
@ -859,6 +859,11 @@ object MatterManager {
} }
} }
} else if (ivalue.isSkipped) { } else if (ivalue.isSkipped) {
if (recipes.size == 1 && entry.input.item == recipe.output.item) {
// assume cloning and/or catalyst?
comment(item, TextComponent("Input $entry at input slot $i is assumed to be cloning/catalyst"))
continue@innerInputsLoop
} else {
comment(item, TextComponent("Input $entry at input slot $i in ${recipe.formattedName} is recursive")) comment(item, TextComponent("Input $entry at input slot $i in ${recipe.formattedName} is recursive"))
recursiveSkips.add(entry) recursiveSkips.add(entry)
@ -869,6 +874,7 @@ object MatterManager {
continue@innerInputsLoop continue@innerInputsLoop
} }
} }
}
var realValue = ivalue.value!! var realValue = ivalue.value!!
val ivalue2 = entry.remainder?.item?.let(::determineValue) val ivalue2 = entry.remainder?.item?.let(::determineValue)