Skip to content

Commit

Permalink
fix recipe getIngredients
Browse files Browse the repository at this point in the history
  • Loading branch information
Faithcaio committed Aug 28, 2024
1 parent 3de210a commit d174770
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/main/java/org/spongepowered/api/item/recipe/Recipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.spongepowered.api.item.inventory.crafting.CraftingInventory;
import org.spongepowered.api.item.recipe.cooking.CookingRecipe;
import org.spongepowered.api.item.recipe.crafting.CraftingRecipe;
import org.spongepowered.api.item.recipe.crafting.Ingredient;
import org.spongepowered.api.item.recipe.crafting.RecipeInput;
import org.spongepowered.api.item.recipe.crafting.RecipeResult;
import org.spongepowered.api.item.recipe.crafting.ShapedCraftingRecipe;
Expand Down Expand Up @@ -124,13 +123,6 @@ default Optional<RecipeResult> result(T inventory, ServerWorld world) {
return Optional.empty();
}

/**
* Gets the ingredients for this recipe.
*
* @return An unmodifiable list of the ingredients.
*/
List<Ingredient> ingredients();

/**
* Returns true if the recipe is dynamic.
* <p>Dynamic recipes are not displayed in the recipe book.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@
*/
public interface ShapedCraftingRecipe extends CraftingRecipe {

/**
* Gets the ingredients for this recipe.
*
* @return An unmodifiable list of the ingredients.
*/
List<Ingredient> ingredients();

/**
* Creates a new {@link ShapedCraftingRecipe.Builder} to build a {@link ShapedCraftingRecipe}.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@
*/
public interface ShapelessCraftingRecipe extends CraftingRecipe {

/**
* Gets the ingredients for this recipe.
*
* @return An unmodifiable list of the ingredients.
*/
List<Ingredient> ingredients();

/**
* Creates a new {@link Builder} to build a {@link ShapelessCraftingRecipe}.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@
import org.spongepowered.api.item.recipe.Recipe;
import org.spongepowered.api.item.recipe.RecipeRegistration;
import org.spongepowered.api.item.recipe.RecipeType;
import org.spongepowered.api.item.recipe.cooking.CookingRecipe;
import org.spongepowered.api.item.recipe.crafting.Ingredient;
import org.spongepowered.api.item.recipe.crafting.RecipeInput;
import org.spongepowered.api.util.ResourceKeyedBuilder;

import java.util.List;
import java.util.function.Function;
import java.util.function.Supplier;

Expand All @@ -50,6 +52,13 @@ static StoneCutterRecipe.Builder builder() {
return Sponge.game().builderProvider().provide(StoneCutterRecipe.Builder.class);
}

/**
* Returns the {@link Ingredient} for this {@link StoneCutterRecipe}.
*
* @return The {@link Ingredient} for this {@link StoneCutterRecipe}.
*/
Ingredient ingredient();

@Override
RecipeType<? extends StoneCutterRecipe> type();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.spongepowered.api.item.recipe.crafting.RecipeInput;
import org.spongepowered.api.util.ResourceKeyedBuilder;

import java.util.Optional;
import java.util.function.Function;
import java.util.function.Supplier;

Expand All @@ -50,6 +51,27 @@ static SmithingRecipe.Builder builder() {
return Sponge.game().builderProvider().provide(SmithingRecipe.Builder.class);
}

/**
* Returns the smithing template {@link Ingredient} for this {@link SmithingRecipe}.
*
* @return The smithing template {@link Ingredient} for this {@link SmithingRecipe}.
*/
Optional<Ingredient> templateIngredient();

/**
* Returns the base {@link Ingredient} for this {@link SmithingRecipe}.
*
* @return The base {@link Ingredient} for this {@link SmithingRecipe}.
*/
Optional<Ingredient> baseIngredient();

/**
* Returns the additional {@link Ingredient} for this {@link SmithingRecipe}.
*
* @return The additional {@link Ingredient} for this {@link SmithingRecipe}.
*/
Optional<Ingredient> additionalIngredient();

@Override
RecipeType<? extends SmithingRecipe> type();

Expand Down

0 comments on commit d174770

Please sign in to comment.