Update upstream
This commit is contained in:
@@ -1,106 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: lexikiq <noellekiq@gmail.com>
|
||||
Date: Tue, 13 Jul 2021 17:27:45 -0400
|
||||
Subject: [PATCH] Add Furnace Recipe API
|
||||
|
||||
Temporary API to get the result of smelting an item in a (type of) furnace.
|
||||
|
||||
Will eventually (hopefully) be replaced by a more extensive Paper PR with support for all recipes.
|
||||
|
||||
diff --git a/src/main/java/gg/projecteden/parchment/inventory/RecipeType.java b/src/main/java/gg/projecteden/parchment/inventory/RecipeType.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..28c01caa9d6379046f6af6612719b40459a89d17
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/projecteden/parchment/inventory/RecipeType.java
|
||||
@@ -0,0 +1,50 @@
|
||||
+package gg.projecteden.parchment.inventory;
|
||||
+
|
||||
+/**
|
||||
+ * A type of crafting recipe.
|
||||
+ */
|
||||
+public enum RecipeType {
|
||||
+ /**
|
||||
+ * Recipes crafted in the standard crafting table.
|
||||
+ */
|
||||
+ CRAFTING(false),
|
||||
+ /**
|
||||
+ * Recipes for smelting an item inside of a furnace.
|
||||
+ */
|
||||
+ SMELTING(true),
|
||||
+ /**
|
||||
+ * Recipes for smelting an item inside of a blasting furnace.
|
||||
+ */
|
||||
+ BLASTING(true),
|
||||
+ /**
|
||||
+ * Recipes for smelting an item inside of a smoker.
|
||||
+ */
|
||||
+ SMOKING(true),
|
||||
+ /**
|
||||
+ * Recipes for cooking an item on a campfire.
|
||||
+ */
|
||||
+ CAMPFIRE_COOKING(true),
|
||||
+ /**
|
||||
+ * Recipes for carving stones in a stonecutter.
|
||||
+ */
|
||||
+ STONECUTTING(true),
|
||||
+ /**
|
||||
+ * Recipes for smithing an item in a smithing table.
|
||||
+ */
|
||||
+ SMITHING(false),
|
||||
+ ;
|
||||
+
|
||||
+ private final boolean singleInput;
|
||||
+
|
||||
+ RecipeType(boolean singleInput) {
|
||||
+ this.singleInput = singleInput;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Determines if the recipe only accepts a single item for input.
|
||||
+ * @return true if the recipe only accepts a single item for input
|
||||
+ */
|
||||
+ public boolean isSingleInput() {
|
||||
+ return singleInput;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index aa04d7df70d99402c91e920fd693d7d4fb655786..6bb7341460eab62e83918d3b47fe89302027e9fe 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -4010,6 +4010,36 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
@Nullable
|
||||
public DragonBattle getEnderDragonBattle();
|
||||
|
||||
+ // Parchment start
|
||||
+ /**
|
||||
+ * Returns the item that will result from smelting the input item, if applicable.
|
||||
+ *
|
||||
+ * @param toSmelt the item to simulate smelting
|
||||
+ * @return the resulting item, or null
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ default ItemStack smeltItem(@NotNull ItemStack toSmelt) {
|
||||
+ return smeltItem(toSmelt, gg.projecteden.parchment.inventory.RecipeType.SMELTING);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the item that will result from smelting the input item, if applicable.
|
||||
+ * <p>
|
||||
+ * Applicable values for {@code recipeType} are
|
||||
+ * {@link gg.projecteden.parchment.inventory.RecipeType#SMELTING SMELTING},
|
||||
+ * {@link gg.projecteden.parchment.inventory.RecipeType#BLASTING BLASTING},
|
||||
+ * {@link gg.projecteden.parchment.inventory.RecipeType#SMOKING SMOKING},
|
||||
+ * and {@link gg.projecteden.parchment.inventory.RecipeType#CAMPFIRE_COOKING CAMPFIRE_COOKING}.
|
||||
+ * An {@link IllegalArgumentException} will be thrown if another value is supplied.
|
||||
+ *
|
||||
+ * @param toSmelt the item to simulate smelting
|
||||
+ * @param recipeType type of furnace to simulate smelting
|
||||
+ * @return the resulting item, or null
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ ItemStack smeltItem(@NotNull ItemStack toSmelt, gg.projecteden.parchment.inventory.@NotNull RecipeType recipeType);
|
||||
+ // Parchment end
|
||||
+
|
||||
/**
|
||||
* Represents various map environment types that a world may be
|
||||
*/
|
||||
Reference in New Issue
Block a user