From 4983a2252181bc255b7c6639e06a25f1a6931538 Mon Sep 17 00:00:00 2001 From: Bigjango13 Date: Mon, 26 Aug 2024 12:39:21 -0700 Subject: [PATCH] Allow RecipeBuilderBase.create to take IItemConvertible --- .../helper/recipeBuilders/RecipeBuilderBase.java | 13 ++++++++++++- .../helper/recipeBuilders/RecipeBuilderTrommel.java | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/turniplabs/halplibe/helper/recipeBuilders/RecipeBuilderBase.java b/src/main/java/turniplabs/halplibe/helper/recipeBuilders/RecipeBuilderBase.java index 638b8f9..5c47cc4 100644 --- a/src/main/java/turniplabs/halplibe/helper/recipeBuilders/RecipeBuilderBase.java +++ b/src/main/java/turniplabs/halplibe/helper/recipeBuilders/RecipeBuilderBase.java @@ -1,6 +1,7 @@ package turniplabs.halplibe.helper.recipeBuilders; import net.minecraft.core.item.ItemStack; +import net.minecraft.core.item.IItemConvertible; import java.util.Objects; @@ -23,11 +24,21 @@ public RecipeBuilderBase clone() { } } + /** + * Creates a new recipe from the provided builder arguments. + * @param recipeID Recipe identifier to assign to the created recipe + * @param output Result of crafting the specified recipe + */ + @SuppressWarnings({"unused"}) + public void create(String recipeID, IItemConvertible output) { + create(recipeID, output.getDefaultStack()); + } + /** * Creates a new recipe from the provided builder arguments. * @param recipeID Recipe identifier to assign to the created recipe * @param outputStack Result of crafting the specified recipe */ @SuppressWarnings({"unused"}) - protected abstract void create( String recipeID, ItemStack outputStack); + public abstract void create(String recipeID, ItemStack outputStack); } diff --git a/src/main/java/turniplabs/halplibe/helper/recipeBuilders/RecipeBuilderTrommel.java b/src/main/java/turniplabs/halplibe/helper/recipeBuilders/RecipeBuilderTrommel.java index ff80fc2..28609d2 100644 --- a/src/main/java/turniplabs/halplibe/helper/recipeBuilders/RecipeBuilderTrommel.java +++ b/src/main/java/turniplabs/halplibe/helper/recipeBuilders/RecipeBuilderTrommel.java @@ -114,7 +114,8 @@ public void create(String recipeID) { .register(recipeID, new RecipeEntryTrommel(input, bag)); } @Override - protected void create(String recipeID, ItemStack outputStack) { + public void create(String recipeID, ItemStack outputStack) throws IllegalArgumentException { // Standard create method doesn't apply to this class + throw new IllegalArgumentException("Use create(String recipeID), create(String recipeID, ItemStack outputStack) does not apply for trommels"); } }