Make Craft Tweaker removeInputRecipe less strict, https://github.com/FTBTeam/FTB-Continuum/issues/58

Hopefully this doesnt break scripts, let me know if it does ;)
This commit is contained in:
modmuss50 2018-05-24 11:36:43 +01:00
parent 1c6e26dd99
commit 7ab300a810

View file

@ -91,25 +91,31 @@ public class CTGeneric {
} }
public static class RemoveInput implements IAction { public static class RemoveInput implements IAction {
private final IIngredient output; private final IIngredient ingredient;
List<BaseRecipe> removedRecipes = new ArrayList<BaseRecipe>(); List<BaseRecipe> removedRecipes = new ArrayList<BaseRecipe>();
private final String name; private final String name;
public RemoveInput(IIngredient output, String machineName) { public RemoveInput(IIngredient ingredient, String machineName) {
this.output = output; this.ingredient = ingredient;
this.name = machineName; this.name = machineName;
} }
@Override @Override
public void apply() { public void apply() {
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(name)) { for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(name)) {
for (Object stack : recipeType.getInputs()) { for (Object recipeInput : recipeType.getInputs()) {
if (stack instanceof ItemStack) { ItemStack ingredientStack = CraftTweakerMC.getItemStack(ingredient);
if (output.matches(CraftTweakerMC.getIItemStack((ItemStack) stack))) { if (!ingredientStack.isEmpty()) {
if (ItemUtils.isInputEqual(recipeInput, ingredientStack, true, false, true)) {
removedRecipes.add((BaseRecipe) recipeType); removedRecipes.add((BaseRecipe) recipeType);
RecipeHandler.recipeList.remove(recipeType); RecipeHandler.recipeList.remove(recipeType);
break; break;
} }
//Old method of checking, just in case
} else if(recipeInput instanceof ItemStack && ingredient.matches(CraftTweakerMC.getIItemStack((ItemStack) recipeInput))){
removedRecipes.add((BaseRecipe) recipeType);
RecipeHandler.recipeList.remove(recipeType);
break;
} }
} }
} }