Paper/CraftBukkit-Patches/0022-Recipe-Deconstruction.patch

72 lines
2.6 KiB
Diff
Raw Normal View History

2016-03-01 01:23:45 +01:00
From 2eb971b8ea7c38519d0acaa6dbae6e74bf2cb457 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 1 Jun 2013 16:34:38 +1000
Subject: [PATCH] Recipe Deconstruction
Some non API methods contributed by Asphodan to allow recipe deconstruction.
diff --git a/src/main/java/net/minecraft/server/IRecipe.java b/src/main/java/net/minecraft/server/IRecipe.java
2016-02-29 22:33:06 +01:00
index f963104..ffc65a2 100644
--- a/src/main/java/net/minecraft/server/IRecipe.java
+++ b/src/main/java/net/minecraft/server/IRecipe.java
2014-11-28 02:17:45 +01:00
@@ -13,4 +13,6 @@ public interface IRecipe {
ItemStack[] b(InventoryCrafting inventorycrafting);
2015-02-28 12:36:22 +01:00
org.bukkit.inventory.Recipe toBukkitRecipe(); // CraftBukkit
+
+ java.util.List<ItemStack> getIngredients(); // Spigot
}
diff --git a/src/main/java/net/minecraft/server/ShapedRecipes.java b/src/main/java/net/minecraft/server/ShapedRecipes.java
2016-02-29 22:33:06 +01:00
index 28adcdb..cac2e78 100644
--- a/src/main/java/net/minecraft/server/ShapedRecipes.java
+++ b/src/main/java/net/minecraft/server/ShapedRecipes.java
2015-02-28 12:36:22 +01:00
@@ -10,7 +10,7 @@ public class ShapedRecipes implements IRecipe {
2014-11-28 02:17:45 +01:00
private final int width;
private final int height;
private final ItemStack[] items;
- private final ItemStack result;
+ public ItemStack result; // Spigot
private boolean e;
public ShapedRecipes(int i, int j, ItemStack[] aitemstack, ItemStack itemstack) {
2015-02-28 12:36:22 +01:00
@@ -165,4 +165,11 @@ public class ShapedRecipes implements IRecipe {
public int a() {
return this.width * this.height;
}
+
+ // Spigot start
+ public java.util.List<ItemStack> getIngredients()
+ {
+ return java.util.Arrays.asList( items );
+ }
+ // Spigot end
}
diff --git a/src/main/java/net/minecraft/server/ShapelessRecipes.java b/src/main/java/net/minecraft/server/ShapelessRecipes.java
2016-02-29 22:33:06 +01:00
index 8570889..e9934f9 100644
--- a/src/main/java/net/minecraft/server/ShapelessRecipes.java
+++ b/src/main/java/net/minecraft/server/ShapelessRecipes.java
2014-11-28 02:17:45 +01:00
@@ -12,7 +12,7 @@ import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe;
public class ShapelessRecipes implements IRecipe {
- private final ItemStack result;
+ public final ItemStack result; // Spigot
2015-02-28 12:36:22 +01:00
private final List<ItemStack> ingredients;
2015-02-28 12:36:22 +01:00
public ShapelessRecipes(ItemStack itemstack, List<ItemStack> list) {
2014-11-28 02:17:45 +01:00
@@ -90,4 +90,11 @@ public class ShapelessRecipes implements IRecipe {
public int a() {
return this.ingredients.size();
}
+
+ // Spigot start
+ public java.util.List<ItemStack> getIngredients()
+ {
+ return java.util.Collections.unmodifiableList( ingredients );
+ }
+ // Spigot end
}
--
2016-02-29 22:33:06 +01:00
2.5.0