Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fluid slot role being incorrect for fluid inputs #8035

Open
wants to merge 1 commit into
base: mc1.20.1/dev
Choose a base branch
from

Conversation

Attack8
Copy link
Contributor

@Attack8 Attack8 commented Mar 18, 2025

@VoidLeech VoidLeech added pr type: fix PR fixes a bug pr flag: simple PR has minimal changes labels Mar 18, 2025
Copy link

@RaymondBlaze RaymondBlaze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to add an overload accepting the role as parameter and delegate both the input method and output method to that method.

public static IRecipeSlotBuilder addFluidSlot(IRecipeLayoutBuilder builder, int x, int y, RecipeIngredientRole role) {
    return builder.addSlot(role, x, y)
            .setBackground(getRenderedSlot(), -1, -1)
            .setFluidRenderer(1, false, 16, 16) // make fluid take up the full slot
            .addTooltipCallback(CreateRecipeCategory::addPotionTooltip);
}

public static IRecipeSlotBuilder addFluidSlot(IRecipeLayoutBuilder builder, int x, int y, FluidIngredient ingredient) {
    return addFluidSlot(builder, x, y, RecipeIngredientRole.INPUT)
            .addIngredients(NeoForgeTypes.FLUID_STACK, ingredient.getMatchingFluidStacks());
}

public static IRecipeSlotBuilder addFluidSlot(IRecipeLayoutBuilder builder, int x, int y, FluidStack stack) {
    return addFluidSlot(builder, x, y, RecipeIngredientRole.OUTPUT)
            .addIngredient(NeoForgeTypes.FLUID_STACK, stack);
}

@@ -124,7 +124,7 @@ public static IRecipeSlotRichTooltipCallback addStochasticTooltip(ProcessingOutp
@SuppressWarnings("removal") // see below
public static IRecipeSlotBuilder addFluidSlot(IRecipeLayoutBuilder builder, int x, int y, FluidIngredient ingredient) {
int amount = ingredient.getRequiredAmount();
return builder.addSlot(RecipeIngredientRole.OUTPUT, x, y)
return builder.addSlot(RecipeIngredientRole.INPUT, x, y)
.setBackground(getRenderedSlot(), -1, -1)
.addIngredients(ForgeTypes.FLUID_STACK, ingredient.getMatchingFluidStacks())
.setFluidRenderer(amount, false, 16, 16) // make fluid take up the full slot

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 1 to replace the amount is sufficient enough to make the fluid take up the full slot (JEI will limit the rendered fluid not exceeding the height limit), which should eliminate the need to pass in the fluid ingredient or fluid stack to get the amount, and allows rendering multiple fluid stacks that might not be of the same size in the slot, the current methods can still be left as short cuts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr flag: simple PR has minimal changes pr type: fix PR fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants