<commit_before>package codechicken.lib.recipe;

import com.google.gson.JsonObject;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.JsonUtils;
import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.common.crafting.IIngredientFactory;
import net.minecraftforge.common.crafting.JsonContext;

import javax.annotation.Nonnull;

/**
 * Simple conditional ingredient.
 *
 * Created by covers1624 on 18/10/2017.
 */
public class ConditionalIngredientFactory implements IIngredientFactory {

    @Nonnull
    @Override
    public Ingredient parse(JsonContext context, JsonObject json) {
        if (!CraftingHelper.processConditions(JsonUtils.getJsonArray(json, "conditions"), context)) {
            if (json.has("fail")) {
                CraftingHelper.getIngredient(JsonUtils.getJsonObject(json, "fail"), context);
            }
            return Ingredient.EMPTY;
        }
        return CraftingHelper.getIngredient(JsonUtils.getJsonObject(json, "pass"), context);
    }
}<commit_msg>Actually fix Conditional ingredient parsing.<commit_after>package codechicken.lib.recipe;

import com.google.gson.JsonObject;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.JsonUtils;
import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.common.crafting.IIngredientFactory;
import net.minecraftforge.common.crafting.JsonContext;

import javax.annotation.Nonnull;

/**
 * Simple conditional ingredient.
 *
 * Created by covers1624 on 18/10/2017.
 */
public class ConditionalIngredientFactory implements IIngredientFactory {

    @Nonnull
    @Override
    public Ingredient parse(JsonContext context, JsonObject json) {
        if (!CraftingHelper.processConditions(JsonUtils.getJsonArray(json, "conditions"), context)) {
            if (json.has("fail")) {
                return CraftingHelper.getIngredient(JsonUtils.getJsonObject(json, "fail"), context);
            }
            return Ingredient.EMPTY;
        }
        return CraftingHelper.getIngredient(JsonUtils.getJsonObject(json, "pass"), context);
    }
}
{'fraction_non_alphanumeric': 0.10085227272727272, 'fraction_numerical': 0.011363636363636364, 'mean_word_length': 4.091566265060241, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5397280', 'n_tokens_mistral': 644, 'n_tokens_neox': 622, 'n_words': 109}