// Path: src/main/java/com/gmail/jannyboy11/customrecipes/impl/crafting/custom/ingredient/NBTIngredient.java
// public class NBTIngredient extends CombinedIngredient {
// 	
// 	private final RecipeItemStack basePredicate;
// 
// 	public NBTIngredient(RecipeItemStack basePredicate, NBTTagCompound tag) {
// 		super(basePredicate, itemStack -> Objects.equals(itemStack.getTag(), tag), Boolean::logicalAnd);
// 		this.basePredicate = basePredicate;
// 	}
// 
// 	@Override
// 	public RecipeItemStack asNMSIngredient() {
// 		RecipeItemStack recipeItemStack = super.asNMSIngredient();
// 		ReflectionUtil.setFinalFieldValue(recipeItemStack, "choices", basePredicate.choices);
// 		return recipeItemStack;
// 	}
// 	
// }


import com.gmail.jannyboy11.customrecipes.impl.crafting.custom.ingredient.NBTIngredient;
import net.minecraft.server.v1_12_R1.ItemStack;
import net.minecraft.server.v1_12_R1.NonNullList;
import net.minecraft.server.v1_12_R1.RecipeItemStack;
import net.minecraft.server.v1_12_R1.ShapedRecipes;
package com.gmail.jannyboy11.customrecipes.impl.crafting.custom.recipe;



public class NBTRecipe extends ShapedRecipes {

	public NBTRecipe(String group, int width, int height, NonNullList<RecipeItemStack> ingredients, ItemStack result) {
		super(group, width, height, makeNbtSpecific(ingredients), result);
	}
	
	public static NonNullList<RecipeItemStack> makeNbtSpecific(NonNullList<RecipeItemStack> ingredients) {
		NonNullList<RecipeItemStack> result = NonNullList.a(ingredients.size(), RecipeItemStack.a);
		for (int i = 0; i < ingredients.size(); i++) {
			RecipeItemStack ingr = ingredients.get(i);
			if (ingr == RecipeItemStack.a) {
				result.set(i, RecipeItemStack.a);
				continue;
			}
			
			ItemStack[] choices = ingr.choices;
			if (choices.length == 0) {
// Path: src/main/java/com/gmail/jannyboy11/customrecipes/impl/crafting/custom/ingredient/NBTIngredient.java
// public class NBTIngredient extends CombinedIngredient {
// 	
// 	private final RecipeItemStack basePredicate;
// 
// 	public NBTIngredient(RecipeItemStack basePredicate, NBTTagCompound tag) {
// 		super(basePredicate, itemStack -> Objects.equals(itemStack.getTag(), tag), Boolean::logicalAnd);
// 		this.basePredicate = basePredicate;
// 	}
// 
// 	@Override
// 	public RecipeItemStack asNMSIngredient() {
// 		RecipeItemStack recipeItemStack = super.asNMSIngredient();
// 		ReflectionUtil.setFinalFieldValue(recipeItemStack, "choices", basePredicate.choices);
// 		return recipeItemStack;
// 	}
// 	
// }


// Path: src/main/java/com/gmail/jannyboy11/customrecipes/impl/crafting/custom/recipe/NBTRecipe.java
import com.gmail.jannyboy11.customrecipes.impl.crafting.custom.ingredient.NBTIngredient;
import net.minecraft.server.v1_12_R1.ItemStack;
import net.minecraft.server.v1_12_R1.NonNullList;
import net.minecraft.server.v1_12_R1.RecipeItemStack;
import net.minecraft.server.v1_12_R1.ShapedRecipes;

package com.gmail.jannyboy11.customrecipes.impl.crafting.custom.recipe;



public class NBTRecipe extends ShapedRecipes {

	public NBTRecipe(String group, int width, int height, NonNullList<RecipeItemStack> ingredients, ItemStack result) {
		super(group, width, height, makeNbtSpecific(ingredients), result);
	}
	
	public static NonNullList<RecipeItemStack> makeNbtSpecific(NonNullList<RecipeItemStack> ingredients) {
		NonNullList<RecipeItemStack> result = NonNullList.a(ingredients.size(), RecipeItemStack.a);
		for (int i = 0; i < ingredients.size(); i++) {
			RecipeItemStack ingr = ingredients.get(i);
			if (ingr == RecipeItemStack.a) {
				result.set(i, RecipeItemStack.a);
				continue;
			}
			
			ItemStack[] choices = ingr.choices;
			if (choices.length == 0) {
				result.set(i, new NBTIngredient(ingr, null).asNMSIngredient());