Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@c50fc3a Updated Upstream (Bukkit/CraftBukkit/Spigot) (#7480) PaperMC/Paper@2a4aef3 Mark ChatRender#render as ApiStatus.Override PaperMC/Paper@f5b9e07 Add GameEvent tags (#6439) PaperMC/Paper@b173c3e Use access transformers for player profile API (#7468) PaperMC/Paper@286bd1b 1.18 misc performance dev branch (#7368) PaperMC/Paper@5bb4549 Fix entity armor not showing on death animation (#7355) PaperMC/Paper@7b8e0c3 Updated Upstream (Bukkit/CraftBukkit) PaperMC/Paper@36a1650 Furnace RecipesUsed API (#7399) PaperMC/Paper@392acfd Configurable sculk sensor listener range (#6443) PaperMC/Paper@b757019 Add missing block data mins and maxes (#6790) PaperMC/Paper@9cab01e [ci skip] Update Gradle wrapper to 7.4 PaperMC/Paper@cdb893b Add mid-tick task execution to block ticking PaperMC/Paper@854f3d3 Put world into worldlist before initing the world PaperMC/Paper@db81163 Execute mid tick tasks during tile entity ticking PaperMC/Paper@501834e Fix custom inventory holders (#6199) PaperMC/Paper@04a337a Add some missing deprecations to the adventure patch (#7500) PaperMC/Paper@b6dad9c Fix desync on teleporting entity on first tick (#7183) PaperMC/Paper@2a55e35 Option to have default CustomSpawners in custom worlds (#7493) PaperMC/Paper@bfa50ad Custom Potion Mixes (#6744) PaperMC/Paper@7f65b0b Add DataConverter to StructureCheck, for structure lookups PaperMC/Paper@30cb7d0 ignore excessive vel for Minecarts (Fixes #7515)
107 lines
3.7 KiB
Diff
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 8a688583e65cd22e0417f9fd24e51803486d095e..b69e0ab985613eede661153e331f1172676212d9 100644
|
|
--- a/src/main/java/org/bukkit/World.java
|
|
+++ b/src/main/java/org/bukkit/World.java
|
|
@@ -3929,6 +3929,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
|
|
*/
|