Skip to content

Commit

Permalink
Merge pull request #61 from Bigjango13/7.2
Browse files Browse the repository at this point in the history
Allow RecipeBuilderBase.create to take IItemConvertible
  • Loading branch information
UselessBullets authored Aug 26, 2024
2 parents 79227df + 4983a22 commit 4e112eb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}

0 comments on commit 4e112eb

Please sign in to comment.