Files
ParchmentMC/patches/api/0010-Add-Furnace-Recipe-API.patch
lexikiq e703b60287 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@128691a Deprecate log4j logger method in `Plugin`
PaperMC/Paper@2a306f5 Add Multi Block Change API (#7333)
PaperMC/Paper@feb72b8 Update ASM EventExecutor generator patch to respect event handler return types. Fixes #7311 (#7317)
PaperMC/Paper@dcca6cb Make tag presets unmodifiable (#7378)
PaperMC/Paper@60e46ab Fix NotePlayEvent (#5180)
PaperMC/Paper@512995c Updated Upstream (Bukkit/CraftBukkit/Spigot) (#7359)
PaperMC/Paper@0a9602c [ci skip] Fix multiple ItemStack array nullability mistakes (#7055)
PaperMC/Paper@9a19308 Lock Frozen Ticks API (#7207)
PaperMC/Paper@a058ac0 Dolphin API (#7102)
PaperMC/Paper@f6c7d53 Add configurable stronghold seed (#7334)
PaperMC/Paper@7978121 More PotionEffectType API (#5737)
PaperMC/Paper@9490475 Add STRUCTURE_TYPE registry entry (#6400)
PaperMC/Paper@b164899 Update tiny-remapper
PaperMC/Paper@f7dbd06 [ci skip] Update parameter mappings
PaperMC/Paper@ca523ab [ci skip] Fix param mismatch from last commit
PaperMC/Paper@2e99e5e Updated Upstream (Bukkit/CraftBukkit) (#7411)
PaperMC/Paper@41263d9 [ci skip] Update paperweight to 1.3.4
PaperMC/Paper@3109dd8 Updated Upstream (Bukkit/CraftBukkit) (#7428)
PaperMC/Paper@17eb884 Use a CHM for StructureTemplate.Pallete cache
PaperMC/Paper@f79c0da Updated Upstream (Bukkit/CraftBukkit)
PaperMC/Paper@2121aed Rebuild patches
PaperMC/Paper@2ec04e0 Use correct headerLocation for regionfile initialisation
PaperMC/Paper@f23c039 Fix infinite recursion in spawnCategoryForChunk/Position
PaperMC/Paper@9940bca API for creating command sender which forwards feedback (#7432)
PaperMC/Paper@46ed080 fix portal linking in upgraded chunks (fixes #7419) (#7438)
PaperMC/Paper@6df4641 Use destination world when preloading spawn chunk (#7441)
PaperMC/Paper@0cc2503 Implement World#regenerateChunk (#7425)
PaperMC/Paper@00da098 Log exceptions thrown during chat processing (#7467)
PaperMC/Paper@26734e8 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#7454)
PaperMC/Paper@4a745f9 Optimize Util#sequence (#7115)
PaperMC/Paper@2c8d48c Make Panda implement Sittable (#7414)
PaperMC/Paper@2c4a589 Fix issues with LimitedRegion (#7343)
PaperMC/Paper@3d91eca Fix cancelled snow bucket placement (#6751)
PaperMC/Paper@9567753 Don't load plugins prefixed with a dot (#7392)
PaperMC/Paper@92c777d Fix PlayerProfile BukkitObject serialization, deprecate setName and setId for removal (#7471)
PaperMC/Paper@e6898ff Fix IllegalArgumentException for /paper mobcaps command (#7472)
PaperMC/Paper@a8f2d67 - properly fix IllegalArgumentException in `/paper mobcaps` command
2022-02-14 15:22:31 -05:00

107 lines
3.7 KiB
Diff

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 959ee46cd440af5a4e5db3f6ee8b163db8e40d86..756bc14add024e74ca27dd12240e920610e7d74d 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -3918,6 +3918,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
*/