use of mezz.jei.api.gui.builder.IRecipeSlotBuilder in project Botania by VazkiiMods.
the class PureDaisyRecipeCategory method setRecipe.
// todo fluid input rendering is probably kinda janky with waterlogged blocks. Might be worth getting rid of it entirely and only checking for full fluid blocks
@Override
public void setRecipe(@Nonnull IRecipeLayoutBuilder builder, @Nonnull IPureDaisyRecipe recipe, @Nonnull IFocusGroup focusGroup) {
StateIngredient input = recipe.getInput();
IRecipeSlotBuilder inputSlotBuilder = builder.addSlot(RecipeIngredientRole.INPUT, 9, 12).setFluidRenderer(1000, false, 16, 16);
for (var state : input.getDisplayed()) {
if (!state.getFluidState().isEmpty()) {
inputSlotBuilder.addIngredient(VanillaTypes.FLUID, new FluidStack(state.getFluidState().getType(), 1000));
}
}
inputSlotBuilder.addItemStacks(input.getDisplayedStacks()).addTooltipCallback((view, tooltip) -> tooltip.addAll(input.descriptionTooltip()));
builder.addSlot(RecipeIngredientRole.CATALYST, 39, 12).addItemStack(new ItemStack(ModSubtiles.pureDaisy));
Block outBlock = recipe.getOutputState().getBlock();
FluidState outFluid = outBlock.defaultBlockState().getFluidState();
if (!outFluid.isEmpty()) {
builder.addSlot(RecipeIngredientRole.OUTPUT, 68, 12).setFluidRenderer(1000, false, 16, 16).addIngredient(VanillaTypes.FLUID, new FluidStack(outFluid.getType(), 1000));
} else {
if (outBlock.asItem() != Items.AIR) {
builder.addSlot(RecipeIngredientRole.OUTPUT, 68, 12).addItemStack(new ItemStack(outBlock));
}
}
}
use of mezz.jei.api.gui.builder.IRecipeSlotBuilder in project RoughlyEnoughItems by shedaniel.
the class JEIRecipeLayoutBuilder method addSlot.
public IRecipeSlotBuilder addSlot(RecipeIngredientRole role, int x, int y, int index) {
if (index == -1) {
index = getNextId(slots.stream().map(JEIRecipeSlot::getIndex).filter(integer -> integer >= 0).collect(Collectors.toSet()));
}
JEIRecipeSlot slot = new JEIRecipeSlot(index, role, new Point(x, y));
if (rolePredicate != null && !rolePredicate.test(role))
return slot;
slots.add(slot);
markDirty();
return slot;
}
use of mezz.jei.api.gui.builder.IRecipeSlotBuilder in project Beyond-Earth by MrScautHD.
the class JeiPlugin method placeRocketParts.
public static void placeRocketParts(int left, int top, int mod, IPlacer placer, RocketPart part, IRecipeLayoutBuilder builder, WorkbenchingRecipe recipe) {
List<Ingredient> ingredients = recipe.getParts().get(part);
RocketPartGridPlacer.place(left, top, mod, placer, part, (i, bounds) -> {
Ingredient ingredient = (ingredients != null && i < ingredients.size()) ? ingredients.get(i) : Ingredient.EMPTY;
IRecipeSlotBuilder slot = builder.addSlot(RecipeIngredientRole.INPUT, bounds.getX(), bounds.getY());
slot.addIngredients(ingredient);
});
}
use of mezz.jei.api.gui.builder.IRecipeSlotBuilder in project TerraFirmaCraft by TerraFirmaCraft.
the class AlloyRecipeCategory method setRecipe.
@Override
public void setRecipe(IRecipeLayoutBuilder builder, AlloyRecipe recipe, IFocusGroup focuses) {
IRecipeSlotBuilder fluidOutput = builder.addSlot(RecipeIngredientRole.OUTPUT, 149, maxHeight / 2 - slot.getHeight() / 2 + 1);
int[] positions = getPositions(recipe.getRanges());
int iteration = 0;
for (Metal metal : recipe.getRanges().keySet()) {
int x = (iteration % 2 == 0 ? firstColumnX : secondColumnX) + 1;
int y = positions[Math.floorDiv(iteration, 2)] + 1;
IRecipeSlotBuilder liquidSlot = builder.addSlot(RecipeIngredientRole.INPUT, x, y);
liquidSlot.addIngredient(VanillaTypes.FLUID, new FluidStack(metal.getFluid(), 1000));
iteration++;
}
fluidOutput.addIngredient(VanillaTypes.FLUID, new FluidStack(recipe.getResult().getFluid(), 1000));
}
use of mezz.jei.api.gui.builder.IRecipeSlotBuilder in project TerraFirmaCraft by TerraFirmaCraft.
the class AnvilRecipeCategory method setRecipe.
@Override
public void setRecipe(IRecipeLayoutBuilder builder, AnvilRecipe recipe, IFocusGroup focuses) {
IRecipeSlotBuilder inputSlot = builder.addSlot(RecipeIngredientRole.INPUT, 6, 5);
IRecipeSlotBuilder outputSlot = builder.addSlot(RecipeIngredientRole.OUTPUT, 76, 5);
inputSlot.addIngredients(recipe.getInput());
outputSlot.addItemStack(recipe.getResultItem());
}
Aggregations