Search in sources :

Example 1 with IElvenTradeRecipe

use of vazkii.botania.api.recipe.IElvenTradeRecipe in project Botania by VazkiiMods.

the class JEIBotaniaPlugin method onRuntimeAvailable.

@Override
public void onRuntimeAvailable(IJeiRuntime jeiRuntime) {
    IRecipeManager recipeRegistry = jeiRuntime.getRecipeManager();
    // Hide the return recipes (iron ingot/diamond/ender pearl returns, not lexicon)
    for (IElvenTradeRecipe recipe : TileAlfPortal.elvenTradeRecipes(Minecraft.getInstance().level)) {
        if (recipe instanceof LexiconElvenTradeRecipe) {
            continue;
        }
        List<Ingredient> inputs = recipe.getIngredients();
        List<ItemStack> outputs = recipe.getOutputs();
        if (inputs.size() == 1 && outputs.size() == 1 && recipe.containsItem(outputs.get(0))) {
            recipeRegistry.hideRecipe(recipe, ElvenTradeRecipeCategory.UID);
        }
    }
    RecipeManager recipeManager = Minecraft.getInstance().level.getRecipeManager();
    recipeManager.byKey(prefix("petal_apothecary/daybloom_motif")).ifPresent(r -> recipeRegistry.hideRecipe(r, PetalApothecaryRecipeCategory.UID));
    recipeManager.byKey(prefix("petal_apothecary/nightshade_motif")).ifPresent(r -> recipeRegistry.hideRecipe(r, PetalApothecaryRecipeCategory.UID));
    CorporeaInputHandler.jeiPanelSupplier = () -> {
        ItemStack stack = jeiRuntime.getIngredientListOverlay().getIngredientUnderMouse(VanillaTypes.ITEM);
        if (stack == null && Minecraft.getInstance().screen == jeiRuntime.getRecipesGui()) {
            stack = jeiRuntime.getRecipesGui().getIngredientUnderMouse(VanillaTypes.ITEM);
        }
        if (stack == null) {
            stack = jeiRuntime.getBookmarkOverlay().getIngredientUnderMouse(VanillaTypes.ITEM);
        }
        if (stack != null) {
            return stack;
        }
        return ItemStack.EMPTY;
    };
    CorporeaInputHandler.supportedGuiFilter = gui -> gui instanceof AbstractContainerScreen<?> || gui instanceof IRecipesGui;
}
Also used : IRecipeManager(mezz.jei.api.recipe.IRecipeManager) IElvenTradeRecipe(vazkii.botania.api.recipe.IElvenTradeRecipe) StateIngredient(vazkii.botania.api.recipe.StateIngredient) Ingredient(net.minecraft.world.item.crafting.Ingredient) AbstractContainerScreen(net.minecraft.client.gui.screens.inventory.AbstractContainerScreen) RecipeManager(net.minecraft.world.item.crafting.RecipeManager) IRecipeManager(mezz.jei.api.recipe.IRecipeManager) LexiconElvenTradeRecipe(vazkii.botania.common.crafting.LexiconElvenTradeRecipe) ItemStack(net.minecraft.world.item.ItemStack) IRecipesGui(mezz.jei.api.runtime.IRecipesGui)

Example 2 with IElvenTradeRecipe

use of vazkii.botania.api.recipe.IElvenTradeRecipe in project Botania by VazkiiMods.

the class ElvenTradeProcessor method setup.

@Override
public void setup(IVariableProvider variables) {
    ImmutableList.Builder<IElvenTradeRecipe> builder = ImmutableList.builder();
    for (IVariable s : variables.get("recipes").asListOrSingleton()) {
        IElvenTradeRecipe recipe = PatchouliUtils.getRecipe(ModRecipeTypes.ELVEN_TRADE_TYPE, new ResourceLocation(s.asString()));
        if (recipe != null) {
            builder.add(recipe);
        }
    }
    recipes = builder.build();
    for (IElvenTradeRecipe recipe : recipes) {
        List<Ingredient> inputs = recipe.getIngredients();
        for (Ingredient ingredient : inputs) {
            int length = ingredient.getItems().length;
            if (length > longestIngredientSize) {
                longestIngredientSize = length;
            }
        }
        if (inputs.size() > mostInputs) {
            mostInputs = inputs.size();
        }
        if (recipe.getOutputs().size() > mostOutputs) {
            mostOutputs = recipe.getOutputs().size();
        }
    }
}
Also used : IElvenTradeRecipe(vazkii.botania.api.recipe.IElvenTradeRecipe) Ingredient(net.minecraft.world.item.crafting.Ingredient) ImmutableList(com.google.common.collect.ImmutableList) IVariable(vazkii.patchouli.api.IVariable) ResourceLocation(net.minecraft.resources.ResourceLocation)

Aggregations

Ingredient (net.minecraft.world.item.crafting.Ingredient)2 IElvenTradeRecipe (vazkii.botania.api.recipe.IElvenTradeRecipe)2 ImmutableList (com.google.common.collect.ImmutableList)1 IRecipeManager (mezz.jei.api.recipe.IRecipeManager)1 IRecipesGui (mezz.jei.api.runtime.IRecipesGui)1 AbstractContainerScreen (net.minecraft.client.gui.screens.inventory.AbstractContainerScreen)1 ResourceLocation (net.minecraft.resources.ResourceLocation)1 ItemStack (net.minecraft.world.item.ItemStack)1 RecipeManager (net.minecraft.world.item.crafting.RecipeManager)1 StateIngredient (vazkii.botania.api.recipe.StateIngredient)1 LexiconElvenTradeRecipe (vazkii.botania.common.crafting.LexiconElvenTradeRecipe)1 IVariable (vazkii.patchouli.api.IVariable)1