summaryrefslogtreecommitdiffstats
path: root/nms-patches/CraftingManager.patch
diff options
context:
space:
mode:
authorThinkofdeath <thinkofdeath@spigotmc.org>2014-11-26 08:32:16 +1100
committermd_5 <git@md-5.net>2014-11-28 17:16:30 +1100
commit24557bc2b37deb6a0edf497d547471832457b1dd (patch)
treec560572889a3b0b34964a0cddb35dc87fda3c914 /nms-patches/CraftingManager.patch
parenta4805dbd77da057cc1ea0bf344379bc6e53ca1f6 (diff)
downloadcraftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar
craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.gz
craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.lz
craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.xz
craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.zip
Update to Minecraft 1.8
For more information please see http://www.spigotmc.org/
Diffstat (limited to 'nms-patches/CraftingManager.patch')
-rw-r--r--nms-patches/CraftingManager.patch57
1 files changed, 57 insertions, 0 deletions
diff --git a/nms-patches/CraftingManager.patch b/nms-patches/CraftingManager.patch
new file mode 100644
index 00000000..8d0f4bde
--- /dev/null
+++ b/nms-patches/CraftingManager.patch
@@ -0,0 +1,57 @@
+--- ../work/decompile-bb26c12b/net/minecraft/server/CraftingManager.java 2014-11-27 08:59:46.625422182 +1100
++++ src/main/java/net/minecraft/server/CraftingManager.java 2014-11-27 08:42:10.112850989 +1100
+@@ -8,10 +8,16 @@
+ import java.util.Iterator;
+ import java.util.List;
+
++import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
++
+ public class CraftingManager {
+
+ private static final CraftingManager a = new CraftingManager();
+ public List recipes = Lists.newArrayList();
++ // CraftBukkit start
++ public IRecipe lastRecipe;
++ public org.bukkit.inventory.InventoryView lastCraftView;
++ // CraftBukkit end
+
+ public static CraftingManager getInstance() {
+ return CraftingManager.a;
+@@ -166,8 +172,15 @@
+ this.registerShapedRecipe(new ItemStack(Blocks.DAYLIGHT_DETECTOR), new Object[] { "GGG", "QQQ", "WWW", Character.valueOf('G'), Blocks.GLASS, Character.valueOf('Q'), Items.QUARTZ, Character.valueOf('W'), Blocks.WOODEN_SLAB});
+ this.registerShapedRecipe(new ItemStack(Blocks.HOPPER), new Object[] { "I I", "ICI", " I ", Character.valueOf('I'), Items.IRON_INGOT, Character.valueOf('C'), Blocks.CHEST});
+ this.registerShapedRecipe(new ItemStack(Items.ARMOR_STAND, 1), new Object[] { "///", " / ", "/_/", Character.valueOf('/'), Items.STICK, Character.valueOf('_'), new ItemStack(Blocks.STONE_SLAB, 1, EnumStoneSlabVariant.STONE.a())});
++ // Collections.sort(this.recipes, new RecipeSorter(this)); // CraftBukkit - moved below
++ sort();
++ }
++
++ // CraftBukkit start
++ public void sort() {
+ Collections.sort(this.recipes, new RecipeSorter(this));
+ }
++ // CraftBukkit end
+
+ public ShapedRecipes registerShapedRecipe(ItemStack itemstack, Object... aobject) {
+ String s = "";
+@@ -265,13 +278,18 @@
+
+ do {
+ if (!iterator.hasNext()) {
++ inventorycrafting.currentRecipe = null; // CraftBukkit - Clear recipe when no recipe is found
+ return null;
+ }
+
+ irecipe = (IRecipe) iterator.next();
+- } while (!irecipe.a(inventorycrafting, world));
+-
+- return irecipe.a(inventorycrafting);
++ } while (!irecipe.a(inventorycrafting, world));
++
++ // CraftBukkit start - INVENTORY_PRE_CRAFT event
++ inventorycrafting.currentRecipe = irecipe;
++ ItemStack result = irecipe.a(inventorycrafting);
++ return CraftEventFactory.callPreCraftEvent(inventorycrafting, result, lastCraftView, false);
++ // CraftBukkit end
+ }
+
+ public ItemStack[] b(InventoryCrafting inventorycrafting, World world) {