Skip to content

Commit d174770

Browse files
committed
fix recipe getIngredients
1 parent 3de210a commit d174770

File tree

5 files changed

+45
-8
lines changed

5 files changed

+45
-8
lines changed

src/main/java/org/spongepowered/api/item/recipe/Recipe.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import org.spongepowered.api.item.inventory.crafting.CraftingInventory;
3535
import org.spongepowered.api.item.recipe.cooking.CookingRecipe;
3636
import org.spongepowered.api.item.recipe.crafting.CraftingRecipe;
37-
import org.spongepowered.api.item.recipe.crafting.Ingredient;
3837
import org.spongepowered.api.item.recipe.crafting.RecipeInput;
3938
import org.spongepowered.api.item.recipe.crafting.RecipeResult;
4039
import org.spongepowered.api.item.recipe.crafting.ShapedCraftingRecipe;
@@ -124,13 +123,6 @@ default Optional<RecipeResult> result(T inventory, ServerWorld world) {
124123
return Optional.empty();
125124
}
126125

127-
/**
128-
* Gets the ingredients for this recipe.
129-
*
130-
* @return An unmodifiable list of the ingredients.
131-
*/
132-
List<Ingredient> ingredients();
133-
134126
/**
135127
* Returns true if the recipe is dynamic.
136128
* <p>Dynamic recipes are not displayed in the recipe book.</p>

src/main/java/org/spongepowered/api/item/recipe/crafting/ShapedCraftingRecipe.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@
4242
*/
4343
public interface ShapedCraftingRecipe extends CraftingRecipe {
4444

45+
/**
46+
* Gets the ingredients for this recipe.
47+
*
48+
* @return An unmodifiable list of the ingredients.
49+
*/
50+
List<Ingredient> ingredients();
51+
4552
/**
4653
* Creates a new {@link ShapedCraftingRecipe.Builder} to build a {@link ShapedCraftingRecipe}.
4754
*

src/main/java/org/spongepowered/api/item/recipe/crafting/ShapelessCraftingRecipe.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@
4444
*/
4545
public interface ShapelessCraftingRecipe extends CraftingRecipe {
4646

47+
/**
48+
* Gets the ingredients for this recipe.
49+
*
50+
* @return An unmodifiable list of the ingredients.
51+
*/
52+
List<Ingredient> ingredients();
53+
4754
/**
4855
* Creates a new {@link Builder} to build a {@link ShapelessCraftingRecipe}.
4956
*

src/main/java/org/spongepowered/api/item/recipe/single/StoneCutterRecipe.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@
3434
import org.spongepowered.api.item.recipe.Recipe;
3535
import org.spongepowered.api.item.recipe.RecipeRegistration;
3636
import org.spongepowered.api.item.recipe.RecipeType;
37+
import org.spongepowered.api.item.recipe.cooking.CookingRecipe;
3738
import org.spongepowered.api.item.recipe.crafting.Ingredient;
3839
import org.spongepowered.api.item.recipe.crafting.RecipeInput;
3940
import org.spongepowered.api.util.ResourceKeyedBuilder;
4041

42+
import java.util.List;
4143
import java.util.function.Function;
4244
import java.util.function.Supplier;
4345

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

55+
/**
56+
* Returns the {@link Ingredient} for this {@link StoneCutterRecipe}.
57+
*
58+
* @return The {@link Ingredient} for this {@link StoneCutterRecipe}.
59+
*/
60+
Ingredient ingredient();
61+
5362
@Override
5463
RecipeType<? extends StoneCutterRecipe> type();
5564

src/main/java/org/spongepowered/api/item/recipe/smithing/SmithingRecipe.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.spongepowered.api.item.recipe.crafting.RecipeInput;
3939
import org.spongepowered.api.util.ResourceKeyedBuilder;
4040

41+
import java.util.Optional;
4142
import java.util.function.Function;
4243
import java.util.function.Supplier;
4344

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

54+
/**
55+
* Returns the smithing template {@link Ingredient} for this {@link SmithingRecipe}.
56+
*
57+
* @return The smithing template {@link Ingredient} for this {@link SmithingRecipe}.
58+
*/
59+
Optional<Ingredient> templateIngredient();
60+
61+
/**
62+
* Returns the base {@link Ingredient} for this {@link SmithingRecipe}.
63+
*
64+
* @return The base {@link Ingredient} for this {@link SmithingRecipe}.
65+
*/
66+
Optional<Ingredient> baseIngredient();
67+
68+
/**
69+
* Returns the additional {@link Ingredient} for this {@link SmithingRecipe}.
70+
*
71+
* @return The additional {@link Ingredient} for this {@link SmithingRecipe}.
72+
*/
73+
Optional<Ingredient> additionalIngredient();
74+
5375
@Override
5476
RecipeType<? extends SmithingRecipe> type();
5577

0 commit comments

Comments
 (0)