Search in sources :

Example 11 with IGuiFluidStackGroup

use of mezz.jei.api.gui.ingredient.IGuiFluidStackGroup in project ResourcefulBees by Resourceful-Bees.

the class CentrifugeRecipeCategory method setRecipe.

@Override
public void setRecipe(@NotNull IRecipeLayout iRecipeLayout, @NotNull CentrifugeRecipe centrifugeRecipe, @NotNull IIngredients iIngredients) {
    IGuiItemStackGroup guiItemStacks = iRecipeLayout.getItemStacks();
    IGuiFluidStackGroup guiFluidStacks = iRecipeLayout.getFluidStacks();
    guiItemStacks.init(CentrifugeTileEntity.HONEYCOMB_SLOT, true, 9, 5);
    guiItemStacks.set(CentrifugeTileEntity.HONEYCOMB_SLOT, iIngredients.getInputs(VanillaTypes.ITEM).get(0));
    if (!centrifugeRecipe.getItemOutputs().isEmpty()) {
        guiItemStacks.init(CentrifugeTileEntity.OUTPUT1, false, 108, 5);
        guiItemStacks.set(CentrifugeTileEntity.OUTPUT1, iIngredients.getOutputs(VanillaTypes.ITEM).get(0));
    }
    if (!centrifugeRecipe.getFluidOutputs().isEmpty()) {
        guiFluidStacks.init(CentrifugeTileEntity.OUTPUT1, false, 109, 6, 16, 16, iIngredients.getOutputs(VanillaTypes.FLUID).get(0).get(0).getAmount(), true, null);
        guiFluidStacks.set(CentrifugeTileEntity.OUTPUT1, iIngredients.getOutputs(VanillaTypes.FLUID).get(0));
    }
    guiItemStacks.init(CentrifugeTileEntity.OUTPUT2, false, 108, 23);
    guiItemStacks.set(CentrifugeTileEntity.OUTPUT2, iIngredients.getOutputs(VanillaTypes.ITEM).get(1));
}
Also used : IGuiFluidStackGroup(mezz.jei.api.gui.ingredient.IGuiFluidStackGroup) IGuiItemStackGroup(mezz.jei.api.gui.ingredient.IGuiItemStackGroup)

Example 12 with IGuiFluidStackGroup

use of mezz.jei.api.gui.ingredient.IGuiFluidStackGroup in project FrostedHeart by TeamMoegMC.

the class GeneratorSteamCategory method setRecipe.

@Override
public void setRecipe(IRecipeLayout recipeLayout, GeneratorSteamRecipe recipe, IIngredients ingredients) {
    IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
    IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
    guiFluidStacks.init(0, true, 26, 12, 16, 47, recipe.input.getAmount() * 5, false, TANK);
    guiFluidStacks.set(ingredients);
    guiItemStacks.init(0, true, 75, 7);
    guiItemStacks.init(1, false, 75, 46);
    guiItemStacks.set(0, GeneratorRecipe.listAll());
    guiItemStacks.set(1, GeneratorRecipe.listOut());
}
Also used : IGuiFluidStackGroup(mezz.jei.api.gui.ingredient.IGuiFluidStackGroup) IGuiItemStackGroup(mezz.jei.api.gui.ingredient.IGuiItemStackGroup)

Example 13 with IGuiFluidStackGroup

use of mezz.jei.api.gui.ingredient.IGuiFluidStackGroup in project AntimatterAPI by GregTech-Intergalactical.

the class RecipeMapCategory method setRecipe.

@Override
public void setRecipe(IRecipeLayout layout, Recipe recipe, @Nonnull IIngredients ingredients) {
    IGuiItemStackGroup itemGroup = layout.getItemStacks();
    IGuiFluidStackGroup fluidGroup = layout.getFluidStacks();
    List<SlotData> slots;
    int groupIndex = 0, slotCount;
    int offsetX = gui.getArea().x + JEI_OFFSET_X, offsetY = gui.getArea().y + JEI_OFFSET_Y;
    int inputItems = 0, inputFluids = 0;
    if (recipe.hasInputItems()) {
        slots = gui.getSlots(SlotType.IT_IN, guiTier);
        slotCount = slots.size();
        if (slotCount > 0) {
            int s = 0;
            List<List<ItemStack>> stacks = ingredients.getInputs(VanillaTypes.ITEM);
            if (stacks.size() > 0) {
                slotCount = Math.min(slotCount, stacks.size());
                for (; s < slotCount; s++) {
                    itemGroup.init(groupIndex, true, slots.get(s).getX() - offsetX, slots.get(s).getY() - offsetY);
                    List<ItemStack> input = stacks.get(s);
                    ItemStack whichStack = input.size() == 1 ? input.get(0) : input.get(Ref.RNG.nextInt(stacks.get(s).size()));
                    itemGroup.set(groupIndex++, whichStack);
                    inputItems++;
                }
            }
        }
    }
    if (recipe.hasOutputItems()) {
        slots = gui.getSlots(SlotType.IT_OUT, guiTier);
        slotCount = slots.size();
        if (slotCount > 0) {
            ItemStack[] stacks = recipe.getOutputItems();
            slotCount = Math.min(slotCount, stacks.length);
            for (int s = 0; s < slotCount; s++) {
                itemGroup.init(groupIndex, false, slots.get(s).getX() - offsetX, slots.get(s).getY() - offsetY);
                itemGroup.set(groupIndex++, stacks[s]);
            }
        }
    }
    groupIndex = 0;
    if (recipe.hasInputFluids()) {
        slots = gui.getSlots(SlotType.FL_IN, guiTier);
        slotCount = slots.size();
        if (slotCount > 0) {
            FluidStack[] fluids = recipe.getInputFluids();
            slotCount = Math.min(slotCount, fluids.length);
            for (int s = 0; s < slotCount; s++) {
                fluidGroup.init(groupIndex, true, slots.get(s).getX() - (offsetX - 1), slots.get(s).getY() - (offsetY - 1), 16, 16, 1000, false, null);
                fluidGroup.set(groupIndex++, fluids[s]);
                inputFluids++;
            }
        }
    }
    if (recipe.hasOutputFluids()) {
        slots = gui.getSlots(SlotType.FL_OUT, guiTier);
        slotCount = slots.size();
        if (slotCount > 0) {
            FluidStack[] fluids = recipe.getOutputFluids();
            slotCount = Math.min(slotCount, fluids.length);
            for (int s = 0; s < slotCount; s++) {
                fluidGroup.init(groupIndex, false, slots.get(s).getX() - (offsetX - 1), slots.get(s).getY() - (offsetY - 1), 16, 16, 1000, false, null);
                fluidGroup.set(groupIndex++, fluids[s]);
            }
        }
    }
    final int finalInputItems = inputItems;
    // final int finalInputFluids = inputFluids;
    itemGroup.addTooltipCallback((index, input, stack, tooltip) -> {
        ResourceLocation rl;
        if ((rl = tagsToRender.get(index)) != null) {
            tooltip.add(TextFormatting.GOLD + "Accepts any " + rl);
        }
        if (input && Utils.hasNoConsumeTag(stack))
            tooltip.add(TextFormatting.WHITE + "Does not get consumed in the process");
        if (recipe.hasChances() && !input) {
            int chanceIndex = index - finalInputItems;
            if (recipe.getChances()[chanceIndex] < 100) {
                tooltip.add(TextFormatting.WHITE + "Chance: " + recipe.getChances()[chanceIndex] + "%");
            }
        }
    });
    fluidGroup.addTooltipCallback((index, input, stack, tooltip) -> {
        if (input && Utils.hasNoConsumeTag(stack))
            tooltip.add(TextFormatting.WHITE + "Does not get consumed in the process");
    // TODO add fluid chances to recipe
    // if (wrapper.recipe.hasChances() && !input) {
    // int chanceIndex = index - finalInputFluids;
    // if (wrapper.recipe.getChances()[chanceIndex] < 100) {
    // tooltip.add(TextFormatting.WHITE + "Chance: " + wrapper.recipe.getChances()[chanceIndex] + "%");
    // }
    // }
    });
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack) IGuiFluidStackGroup(mezz.jei.api.gui.ingredient.IGuiFluidStackGroup) SlotData(muramasa.antimatter.gui.SlotData) IGuiItemStackGroup(mezz.jei.api.gui.ingredient.IGuiItemStackGroup) ResourceLocation(net.minecraft.util.ResourceLocation) ObjectArrayList(it.unimi.dsi.fastutil.objects.ObjectArrayList) List(java.util.List) ItemStack(net.minecraft.item.ItemStack)

Example 14 with IGuiFluidStackGroup

use of mezz.jei.api.gui.ingredient.IGuiFluidStackGroup in project TerraFirmaCraft by TerraFirmaCraft.

the class PotRecipeCategory method setRecipe.

@Override
public void setRecipe(IRecipeLayout recipeLayout, T recipe, IIngredients ingredients) {
    IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
    IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
    itemStacks.init(0, true, 25, 25);
    itemStacks.init(1, true, 45, 25);
    itemStacks.init(2, true, 65, 25);
    itemStacks.init(3, true, 85, 25);
    itemStacks.init(4, true, 105, 25);
    fluidStacks.init(5, true, 6, 26);
    List<List<ItemStack>> inputs = ingredients.getInputs(VanillaTypes.ITEM);
    for (int i = 0; i < inputs.size(); i++) {
        List<ItemStack> ingredientItems = inputs.get(i);
        if (!ingredientItems.isEmpty()) {
            itemStacks.set(i, inputs.get(i));
        }
    }
    fluidStacks.set(5, collapse(ingredients.getInputs(VanillaTypes.FLUID)));
}
Also used : IGuiFluidStackGroup(mezz.jei.api.gui.ingredient.IGuiFluidStackGroup) IGuiItemStackGroup(mezz.jei.api.gui.ingredient.IGuiItemStackGroup) List(java.util.List) ItemStack(net.minecraft.world.item.ItemStack)

Example 15 with IGuiFluidStackGroup

use of mezz.jei.api.gui.ingredient.IGuiFluidStackGroup in project TerraFirmaCraft by TerraFirmaCraft.

the class FluidPotRecipeCategory method setRecipe.

@Override
public void setRecipe(IRecipeLayout recipeLayout, FluidPotRecipe recipe, IIngredients ingredients) {
    super.setRecipe(recipeLayout, recipe, ingredients);
    IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
    fluidStacks.init(7, false, 146, 26);
    fluidStacks.set(7, recipe.getDisplayFluid());
}
Also used : IGuiFluidStackGroup(mezz.jei.api.gui.ingredient.IGuiFluidStackGroup)

Aggregations

IGuiFluidStackGroup (mezz.jei.api.gui.ingredient.IGuiFluidStackGroup)48 IGuiItemStackGroup (mezz.jei.api.gui.ingredient.IGuiItemStackGroup)34 List (java.util.List)14 ItemStack (net.minecraft.world.item.ItemStack)7 ItemStack (net.minecraft.item.ItemStack)6 FluidStack (net.minecraftforge.fluids.FluidStack)6 EntityIngredient (com.teamresourceful.resourcefulbees.compat.jei.ingredients.EntityIngredient)4 FluidIngredient (com.simibubi.create.foundation.fluid.FluidIngredient)3 PoseStack (com.mojang.blaze3d.vertex.PoseStack)2 ArrayList (java.util.ArrayList)2 IRecipeLayout (mezz.jei.api.gui.IRecipeLayout)2 IIngredients (mezz.jei.api.ingredients.IIngredients)2 Ingredient (net.minecraft.world.item.crafting.Ingredient)2 OreRateType (slimeknights.tconstruct.library.recipe.melting.IMeltingContainer.OreRateType)2 CABlocks (com.mrh0.createaddition.index.CABlocks)1 CrudeBurningRecipe (com.mrh0.createaddition.recipe.crude_burning.CrudeBurningRecipe)1 SequencedAssemblySubCategory (com.simibubi.create.compat.jei.category.sequencedAssembly.SequencedAssemblySubCategory)1 HeatCondition (com.simibubi.create.content.contraptions.processing.HeatCondition)1 AllGuiTextures (com.simibubi.create.foundation.gui.AllGuiTextures)1 Pair (com.simibubi.create.foundation.utility.Pair)1