-
Notifications
You must be signed in to change notification settings - Fork 985
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
base: mc1.20.1/dev
Are you sure you want to change the base?
Fix fluid slot role being incorrect for fluid inputs #8035
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
#7848