package squeek.veganoption.items;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

public class ItemFertilizer extends Item
{
	public ItemFertilizer()
	{
		super();
	}

	@Override
	public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
	{
		if (ItemDye.applyBonemeal(itemStack, world, x, y, z, player))
		{
			if (!world.isRemote)
			{
				world.playAuxSFX(2005, x, y, z, 0);
			}
			return true;
		}
		return false;
	}
}

@@ -28,16 +28,164 @@
 items;%0A%0A
+import net.minecraft.block.BlockDispenser;%0Aimport net.minecraft.dispenser.BehaviorDefaultDispenseItem;%0Aimport net.minecraft.dispenser.IBlockSource;%0A
 import n
@@ -221,24 +221,24 @@
 tityPlayer;%0A
-
 import net.m
@@ -329,16 +329,54 @@
 mStack;%0A
+import net.minecraft.util.EnumFacing;%0A
 import n
@@ -484,16 +484,115 @@
 uper();%0A
+%09%09BlockDispenser.dispenseBehaviorRegistry.putObject(this, new ItemFertilizer.DispenserBehavior());%0A
 %09%7D%0A%0A%09@Ov
@@ -911,16 +911,16 @@
 ue;%0A%09%09%7D%0A
-
 %09%09return
@@ -929,11 +929,1256 @@
 alse;%0A%09%7D
+%0A%0A%09// copied from bonemeal's dispenser behavior in net.minecraft.init.Bootstrap%0A%09public static class DispenserBehavior extends BehaviorDefaultDispenseItem%0A%09%7B%0A%09%09private boolean didFertilize = true;%0A%0A%09%09@Override%0A%09%09protected ItemStack dispenseStack(IBlockSource blockSource, ItemStack itemStack)%0A%09%09%7B%0A%09%09%09EnumFacing enumfacing = BlockDispenser.func_149937_b(blockSource.getBlockMetadata());%0A%09%09%09World world = blockSource.getWorld();%0A%09%09%09int x = blockSource.getXInt() + enumfacing.getFrontOffsetX();%0A%09%09%09int y = blockSource.getYInt() + enumfacing.getFrontOffsetY();%0A%09%09%09int z = blockSource.getZInt() + enumfacing.getFrontOffsetZ();%0A%0A%09%09%09if (ItemDye.func_150919_a(itemStack, world, x, y, z))%0A%09%09%09%7B%0A%09%09%09%09if (!world.isRemote)%0A%09%09%09%09%7B%0A%09%09%09%09%09world.playAuxSFX(2005, x, y, z, 0);%0A%09%09%09%09%7D%0A%09%09%09%09this.didFertilize = true;%0A%09%09%09%7D%0A%09%09%09else%0A%09%09%09%7B%0A%09%09%09%09this.didFertilize = false;%0A%09%09%09%7D%0A%0A%09%09%09return itemStack;%0A%09%09%7D%0A%0A%09%09@Override%0A%09%09protected void playDispenseSound(IBlockSource blockSource)%0A%09%09%7B%0A%09%09%09if (this.didFertilize)%0A%09%09%09%7B%0A%09%09%09%09blockSource.getWorld().playAuxSFX(1000, blockSource.getXInt(), blockSource.getYInt(), blockSource.getZInt(), 0);%0A%09%09%09%7D%0A%09%09%09else%0A%09%09%09%7B%0A%09%09%09%09blockSource.getWorld().playAuxSFX(1001, blockSource.getXInt(), blockSource.getYInt(), blockSource.getZInt(), 0);%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D
 %0A%7D%0A

Add dispenser behavior to fertilizer