summaryrefslogtreecommitdiffstats
path: root/nms-patches
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2018-11-03 21:04:33 +1100
committermd_5 <git@md-5.net>2018-11-03 21:04:33 +1100
commitf0398e444e43a9c63249e668eb85f5fecbb4b6db (patch)
treef6e90e715de2b19419e371ba5ff6556fc017368a /nms-patches
parent96c461b3a528611ab4d4e22d71c63e10f9a1d034 (diff)
downloadcraftbukkit-f0398e444e43a9c63249e668eb85f5fecbb4b6db.tar
craftbukkit-f0398e444e43a9c63249e668eb85f5fecbb4b6db.tar.gz
craftbukkit-f0398e444e43a9c63249e668eb85f5fecbb4b6db.tar.lz
craftbukkit-f0398e444e43a9c63249e668eb85f5fecbb4b6db.tar.xz
craftbukkit-f0398e444e43a9c63249e668eb85f5fecbb4b6db.zip
SPIGOT-4438: Add choice API to furnace recipes
Diffstat (limited to 'nms-patches')
-rw-r--r--nms-patches/FurnaceRecipe.patch20
1 files changed, 15 insertions, 5 deletions
diff --git a/nms-patches/FurnaceRecipe.patch b/nms-patches/FurnaceRecipe.patch
index 4d150e73..a26f71d9 100644
--- a/nms-patches/FurnaceRecipe.patch
+++ b/nms-patches/FurnaceRecipe.patch
@@ -1,17 +1,23 @@
--- a/net/minecraft/server/FurnaceRecipe.java
+++ b/net/minecraft/server/FurnaceRecipe.java
-@@ -2,6 +2,10 @@
+@@ -2,6 +2,16 @@
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
++// CraftBukkit start
++import java.util.ArrayList;
++import java.util.List;
+import org.bukkit.craftbukkit.inventory.CraftFurnaceRecipe;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
++import org.bukkit.craftbukkit.util.CraftMagicNumbers;
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
+import org.bukkit.inventory.Recipe;
++import org.bukkit.inventory.RecipeChoice;
++// CraftBukkit end
public class FurnaceRecipe implements IRecipe {
-@@ -56,6 +60,19 @@
+@@ -56,6 +66,23 @@
return this.key;
}
@@ -20,9 +26,13 @@
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
+ RecipeItemStack list = this.ingredient;
+ list.buildChoices();
-+ net.minecraft.server.ItemStack stack = list.choices[0];
+
-+ CraftFurnaceRecipe recipe = new CraftFurnaceRecipe(CraftNamespacedKey.fromMinecraft(this.key), result, CraftItemStack.asCraftMirror(stack), this.experience, this.cookingTime);
++ List<org.bukkit.Material> choices = new ArrayList<>(list.choices.length);
++ for (ItemStack i : list.choices) {
++ choices.add(CraftMagicNumbers.getMaterial(i.getItem()));
++ }
++
++ CraftFurnaceRecipe recipe = new CraftFurnaceRecipe(CraftNamespacedKey.fromMinecraft(this.key), result, new RecipeChoice.MaterialChoice(choices), this.experience, this.cookingTime);
+ recipe.setGroup(this.group);
+
+ return recipe;
@@ -31,7 +41,7 @@
public static class a implements RecipeSerializer<FurnaceRecipe> {
public a() {}
-@@ -106,11 +123,11 @@
+@@ -106,11 +133,11 @@
return "smelting";
}