From 8f624131ae85a154c0f2d4ef2cd29585dd0a566c Mon Sep 17 00:00:00 2001
From: mose
Date: Fri, 3 Jan 2025 19:46:31 +0000
Subject: [PATCH 1/3] Fixed recipe
---
.../spongepowered/api/item/recipe/Recipe.java | 24 +++++++------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/src/main/java/org/spongepowered/api/item/recipe/Recipe.java b/src/main/java/org/spongepowered/api/item/recipe/Recipe.java
index cb06bb9f0d..dd3eef6ed8 100644
--- a/src/main/java/org/spongepowered/api/item/recipe/Recipe.java
+++ b/src/main/java/org/spongepowered/api/item/recipe/Recipe.java
@@ -24,6 +24,7 @@
*/
package org.spongepowered.api.item.recipe;
+import org.spongepowered.api.ResourceKey;
import org.spongepowered.api.block.BlockTypes;
import org.spongepowered.api.block.entity.carrier.Campfire;
import org.spongepowered.api.block.entity.carrier.furnace.BlastFurnace;
@@ -33,13 +34,7 @@
import org.spongepowered.api.item.inventory.ItemStackSnapshot;
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;
-import org.spongepowered.api.item.recipe.crafting.ShapelessCraftingRecipe;
-import org.spongepowered.api.item.recipe.crafting.SpecialCraftingRecipe;
+import org.spongepowered.api.item.recipe.crafting.*;
import org.spongepowered.api.item.recipe.single.StoneCutterRecipe;
import org.spongepowered.api.item.recipe.smithing.SmithingRecipe;
import org.spongepowered.api.world.server.ServerWorld;
@@ -59,12 +54,13 @@
*/
public interface Recipe {
+ Optional key();
+
/**
* Checks if the given inventory fits the required constraints to make a valid recipe
*
* @param inventory The inventory to check for validity
- * @param world The world this recipe would be used in
- *
+ * @param world The world this recipe would be used in
* @return True if the given input matches this recipe's requirements
*/
boolean isValid(T inventory, ServerWorld world);
@@ -77,7 +73,6 @@ public interface Recipe {
* as it may customize the result further depending on the context.
*
* @param inventory The input inventory
- *
* @return The result of this recipe
*/
ItemStackSnapshot result(T inventory);
@@ -100,7 +95,7 @@ public interface Recipe {
*
* @param inventory The input inventory
* @return The list of items to be added to the inventory of the player
- * when the recipe has been fulfilled (possibly empty)
+ * when the recipe has been fulfilled (possibly empty)
*/
List remainingItems(T inventory);
@@ -111,11 +106,10 @@ public interface Recipe {
* {@link #isValid(RecipeInput, ServerWorld)}.
*
* @param inventory The input inventory
- * @param world The world this recipe would be used in
- *
+ * @param world The world this recipe would be used in
* @return A {@link RecipeResult} if the arguments satisfy
- * {@link #isValid(RecipeInput, ServerWorld)}, or
- * {@link Optional#empty()} if not
+ * {@link #isValid(RecipeInput, ServerWorld)}, or
+ * {@link Optional#empty()} if not
*/
default Optional result(T inventory, ServerWorld world) {
if (this.isValid(inventory, world)) {
From 8c136b4d65ec46bb7fe32aa35624dca403f583b3 Mon Sep 17 00:00:00 2001
From: mose
Date: Fri, 3 Jan 2025 20:05:19 +0000
Subject: [PATCH 2/3] Fixed formatting
---
.../org/spongepowered/api/item/recipe/Recipe.java | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/spongepowered/api/item/recipe/Recipe.java b/src/main/java/org/spongepowered/api/item/recipe/Recipe.java
index dd3eef6ed8..4534e75d38 100644
--- a/src/main/java/org/spongepowered/api/item/recipe/Recipe.java
+++ b/src/main/java/org/spongepowered/api/item/recipe/Recipe.java
@@ -34,7 +34,13 @@
import org.spongepowered.api.item.inventory.ItemStackSnapshot;
import org.spongepowered.api.item.inventory.crafting.CraftingInventory;
import org.spongepowered.api.item.recipe.cooking.CookingRecipe;
-import org.spongepowered.api.item.recipe.crafting.*;
+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;
+import org.spongepowered.api.item.recipe.crafting.ShapelessCraftingRecipe;
+import org.spongepowered.api.item.recipe.crafting.SpecialCraftingRecipe;
import org.spongepowered.api.item.recipe.single.StoneCutterRecipe;
import org.spongepowered.api.item.recipe.smithing.SmithingRecipe;
import org.spongepowered.api.world.server.ServerWorld;
@@ -61,6 +67,7 @@ public interface Recipe {
*
* @param inventory The inventory to check for validity
* @param world The world this recipe would be used in
+ *
* @return True if the given input matches this recipe's requirements
*/
boolean isValid(T inventory, ServerWorld world);
@@ -73,6 +80,7 @@ public interface Recipe {
* as it may customize the result further depending on the context.
*
* @param inventory The input inventory
+ *
* @return The result of this recipe
*/
ItemStackSnapshot result(T inventory);
@@ -107,9 +115,10 @@ public interface Recipe {
*
* @param inventory The input inventory
* @param world The world this recipe would be used in
+ *
* @return A {@link RecipeResult} if the arguments satisfy
- * {@link #isValid(RecipeInput, ServerWorld)}, or
- * {@link Optional#empty()} if not
+ * {@link #isValid(RecipeInput, ServerWorld)}, or
+ * {@link Optional#empty()} if not
*/
default Optional result(T inventory, ServerWorld world) {
if (this.isValid(inventory, world)) {
From 5c885ab4ed7bfb7e0e8060ebdaba436f609f91ae Mon Sep 17 00:00:00 2001
From: mose
Date: Fri, 3 Jan 2025 20:11:47 +0000
Subject: [PATCH 3/3] Added javadocs
---
.../org/spongepowered/api/item/recipe/Recipe.java | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/spongepowered/api/item/recipe/Recipe.java b/src/main/java/org/spongepowered/api/item/recipe/Recipe.java
index 4534e75d38..393b98e2b0 100644
--- a/src/main/java/org/spongepowered/api/item/recipe/Recipe.java
+++ b/src/main/java/org/spongepowered/api/item/recipe/Recipe.java
@@ -60,13 +60,18 @@
*/
public interface Recipe {
+ /**
+ * Provides the registered key for this recipe
+ *
+ * @return The key the recipe is registered with
+ */
Optional key();
/**
* Checks if the given inventory fits the required constraints to make a valid recipe
*
* @param inventory The inventory to check for validity
- * @param world The world this recipe would be used in
+ * @param world The world this recipe would be used in
*
* @return True if the given input matches this recipe's requirements
*/
@@ -103,7 +108,7 @@ public interface Recipe {
*
* @param inventory The input inventory
* @return The list of items to be added to the inventory of the player
- * when the recipe has been fulfilled (possibly empty)
+ * when the recipe has been fulfilled (possibly empty)
*/
List remainingItems(T inventory);
@@ -114,7 +119,7 @@ public interface Recipe {
* {@link #isValid(RecipeInput, ServerWorld)}.
*
* @param inventory The input inventory
- * @param world The world this recipe would be used in
+ * @param world The world this recipe would be used in
*
* @return A {@link RecipeResult} if the arguments satisfy
* {@link #isValid(RecipeInput, ServerWorld)}, or