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
@@ -70,24 +70,28 @@ public class StaliniumPressRecipeCategory implements IRecipeCategory<StaliniumPr
public void setRecipe(IRecipeLayoutBuilder builder, public void setRecipe(IRecipeLayoutBuilder builder,
StaliniumPressRecipe recipe, StaliniumPressRecipe recipe,
IFocusGroup focuses) { IFocusGroup focuses) {
// -------------------- INPUT SLOTS --------------------
var ingredients = recipe.getIngredients(); var ingredients = recipe.getIngredients();
int slotCount = Math.min(ingredients.size(), INPUT_SLOT_POSITIONS.length); builder
.addSlot(RecipeIngredientRole.INPUT,
for (int i = 0; i < slotCount; i++) { INPUT_SLOT_POSITIONS[0][0],
int x = INPUT_SLOT_POSITIONS[i][0]; INPUT_SLOT_POSITIONS[0][1])
int y = INPUT_SLOT_POSITIONS[i][1]; .addIngredients(ingredients.get(1));
builder.addSlot(RecipeIngredientRole.INPUT, x, y) builder
.addIngredients(ingredients.get(i)); .addSlot(RecipeIngredientRole.INPUT,
} INPUT_SLOT_POSITIONS[1][0],
INPUT_SLOT_POSITIONS[1][1])
// -------------------- OUTPUT SLOT -------------------- .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( var output = recipe.getResultItem(
net.minecraft.client.Minecraft.getInstance() net.minecraft.client.Minecraft.getInstance()
.level .level
.registryAccess()); // <- real registry .registryAccess());
builder.addSlot(RecipeIngredientRole.OUTPUT, OUTPUT_X, OUTPUT_Y) builder
.addSlot(RecipeIngredientRole.OUTPUT, OUTPUT_X, OUTPUT_Y)
.addItemStack(output); .addItemStack(output);
} }
} }