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));
}
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());
}
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] + "%");
// }
// }
});
}
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)));
}
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());
}
Aggregations