Search in sources :

Example 1 with KilnRecipe

use of knightminer.ceramics.recipe.KilnRecipe in project Ceramics by KnightMiner.

the class JEIPlugin method registerRecipes.

@Override
public void registerRecipes(IRecipeRegistration registration) {
    ClientWorld world = Minecraft.getInstance().world;
    assert world != null;
    RecipeManager recipeManager = world.getRecipeManager();
    List<KilnRecipe> results = new ArrayList<>();
    for (IRecipe<IInventory> recipe : recipeManager.getRecipes(Registration.KILN_RECIPE).values()) {
        // ignore dynamic
        if (recipe.isDynamic()) {
            continue;
        }
        // validate output
        ItemStack output = recipe.getRecipeOutput();
        if (output.isEmpty()) {
            Ceramics.LOG.error("Invalid kiln recipe {}, no output", recipe.getId());
            continue;
        }
        List<Ingredient> ingredients = recipe.getIngredients();
        if (ingredients.size() != 1) {
            Ceramics.LOG.error("Invalid kiln recipe {}, wrong number of inputs", recipe.getId());
            continue;
        }
        // recipe type
        if (!(recipe instanceof KilnRecipe)) {
            Ceramics.LOG.error("Invalid kiln recipe {}, wrong class", recipe.getId());
            continue;
        }
        // add to list
        results.add((KilnRecipe) recipe);
    }
    registration.addRecipes(results, KilnCategory.UID);
    // clay repair info
    List<ItemStack> clayRepair = CeramicsTags.Items.TERRACOTTA_CRACK_REPAIR.getAllElements().stream().map(ItemStack::new).collect(Collectors.toList());
    registration.addIngredientInfo(clayRepair, VanillaTypes.ITEM, Ceramics.lang("jei", "clay_repair"));
}
Also used : IInventory(net.minecraft.inventory.IInventory) KilnRecipe(knightminer.ceramics.recipe.KilnRecipe) Ingredient(net.minecraft.item.crafting.Ingredient) RecipeManager(net.minecraft.item.crafting.RecipeManager) ArrayList(java.util.ArrayList) ClientWorld(net.minecraft.client.world.ClientWorld) ItemStack(net.minecraft.item.ItemStack)

Aggregations

ArrayList (java.util.ArrayList)1 KilnRecipe (knightminer.ceramics.recipe.KilnRecipe)1 ClientWorld (net.minecraft.client.world.ClientWorld)1 IInventory (net.minecraft.inventory.IInventory)1 ItemStack (net.minecraft.item.ItemStack)1 Ingredient (net.minecraft.item.crafting.Ingredient)1 RecipeManager (net.minecraft.item.crafting.RecipeManager)1