From 940d8333de5d67cb26c7a04d478b646ec00163ac Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Thu, 16 Nov 2023 21:44:20 +0700 Subject: [PATCH] Handle vanilla-like trim cloning recipes --- .../mc/otm/matter/MatterManager.kt | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterManager.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterManager.kt index 097f8d008..39e139b7a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterManager.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterManager.kt @@ -731,7 +731,7 @@ object MatterManager { private fun doTryToBacktrack(item: Item, makeCommentary: Boolean): Result { 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) comment(item, TextComponent("Item '${item.registryName}' has no recipes")) @@ -859,14 +859,20 @@ object MatterManager { } } } else if (ivalue.isSkipped) { - comment(item, TextComponent("Input $entry at input slot $i in ${recipe.formattedName} is recursive")) - recursiveSkips.add(entry) - - if (inputs.size == 1) { - hadSkips = true - continue@recipesLoop - } else { + 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")) + recursiveSkips.add(entry) + + if (inputs.size == 1) { + hadSkips = true + continue@recipesLoop + } else { + continue@innerInputsLoop + } } }