From 7742e12aff5c1dc8f9b64513b467c5b65e6ffcbc Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thinkofdeath@spigotmc.org>
Date: Wed, 8 Jul 2015 22:50:32 +0100
Subject: [PATCH] SPIGOT-1018: Fix isFromBonemeal always being false

---
 nms-patches/ItemStack.patch | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/nms-patches/ItemStack.patch b/nms-patches/ItemStack.patch
index 2050be38a9..9a2c9a54a8 100644
--- a/nms-patches/ItemStack.patch
+++ b/nms-patches/ItemStack.patch
@@ -39,7 +39,7 @@
  
      }
  
-@@ -83,11 +100,127 @@
+@@ -83,11 +100,128 @@
      }
  
      public boolean placeItem(EntityHuman entityhuman, World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) {
@@ -72,7 +72,8 @@
 +            world.capturedBlockStates.clear();
 +            StructureGrowEvent event = null;
 +            if (treeType != null) {
-+                event = new StructureGrowEvent(location, treeType, false, (Player) entityhuman.getBukkitEntity(), blocks);
++                boolean isBonemeal = getItem() == Items.DYE && data == 15;
++                event = new StructureGrowEvent(location, treeType, isBonemeal, (Player) entityhuman.getBukkitEntity(), blocks);
 +                org.bukkit.Bukkit.getPluginManager().callEvent(event);
 +            }
 +            if (event == null || !event.isCancelled()) {
@@ -168,7 +169,7 @@
  
          return flag;
      }
-@@ -111,7 +244,7 @@
+@@ -111,7 +245,7 @@
          nbttagcompound.setByte("Count", (byte) this.count);
          nbttagcompound.setShort("Damage", (short) this.damage);
          if (this.tag != null) {
@@ -177,7 +178,7 @@
          }
  
          return nbttagcompound;
-@@ -125,13 +258,18 @@
+@@ -125,13 +259,18 @@
          }
  
          this.count = nbttagcompound.getByte("Count");
@@ -197,7 +198,7 @@
              if (this.item != null) {
                  this.item.a(this.tag);
              }
-@@ -168,8 +306,28 @@
+@@ -168,8 +307,28 @@
      }
  
      public void setData(int i) {
@@ -227,7 +228,7 @@
              this.damage = 0;
          }
  
-@@ -223,6 +381,12 @@
+@@ -223,6 +382,12 @@
                          this.count = 0;
                      }
  
@@ -240,7 +241,7 @@
                      this.damage = 0;
                  }
  
-@@ -489,6 +653,7 @@
+@@ -489,6 +654,7 @@
  
      public void setItem(Item item) {
          this.item = item;