Revised setRecipe logic in StaliniumPressRecipeCategory. Fixed input slot assignments to ensure correct ingredient mapping and improved readability.

This commit is contained in:
IM23a-spirgif
2025-06-09 13:50:25 +02:00
parent 91350af9df
commit 286ef332f4
@@ -68,26 +68,30 @@ public class StaliniumPressRecipeCategory implements IRecipeCategory<StaliniumPr
@Override @Override
public void setRecipe(IRecipeLayoutBuilder builder, public void setRecipe(IRecipeLayoutBuilder builder,
StaliniumPressRecipe recipe, StaliniumPressRecipe recipe,
IFocusGroup focuses) { IFocusGroup focuses) {
var ingredients = recipe.getIngredients();
// -------------------- INPUT SLOTS -------------------- builder
var ingredients = recipe.getIngredients(); .addSlot(RecipeIngredientRole.INPUT,
int slotCount = Math.min(ingredients.size(), INPUT_SLOT_POSITIONS.length); INPUT_SLOT_POSITIONS[0][0],
INPUT_SLOT_POSITIONS[0][1])
for (int i = 0; i < slotCount; i++) { .addIngredients(ingredients.get(1));
int x = INPUT_SLOT_POSITIONS[i][0]; builder
int y = INPUT_SLOT_POSITIONS[i][1]; .addSlot(RecipeIngredientRole.INPUT,
builder.addSlot(RecipeIngredientRole.INPUT, x, y) INPUT_SLOT_POSITIONS[1][0],
.addIngredients(ingredients.get(i)); INPUT_SLOT_POSITIONS[1][1])
.addIngredients(ingredients.get(0));
builder
.addSlot(RecipeIngredientRole.INPUT,
INPUT_SLOT_POSITIONS[2][0],
INPUT_SLOT_POSITIONS[2][1])
.addIngredients(ingredients.get(2));
var output = recipe.getResultItem(
net.minecraft.client.Minecraft.getInstance()
.level
.registryAccess());
builder
.addSlot(RecipeIngredientRole.OUTPUT, OUTPUT_X, OUTPUT_Y)
.addItemStack(output);
} }
// -------------------- OUTPUT SLOT --------------------
var output = recipe.getResultItem(
net.minecraft.client.Minecraft.getInstance()
.level
.registryAccess()); // <- real registry
builder.addSlot(RecipeIngredientRole.OUTPUT, OUTPUT_X, OUTPUT_Y)
.addItemStack(output);
}
} }