--- a/net/minecraft/core/dispenser/IDispenseBehavior.java
+++ b/net/minecraft/core/dispenser/IDispenseBehavior.java
@@ -78,6 +78,21 @@
 import net.minecraft.world.phys.MovingObjectPositionBlock;
 import org.slf4j.Logger;
 
+// CraftBukkit start
+import net.minecraft.world.item.ItemBucket;
+import net.minecraft.world.level.block.BlockSapling;
+import net.minecraft.world.level.block.IFluidContainer;
+import org.bukkit.Location;
+import org.bukkit.TreeType;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.util.CraftLocation;
+import org.bukkit.craftbukkit.util.DummyGeneratorAccess;
+import org.bukkit.event.block.BlockDispenseArmorEvent;
+import org.bukkit.event.block.BlockDispenseEvent;
+import org.bukkit.event.block.BlockFertilizeEvent;
+import org.bukkit.event.world.StructureGrowEvent;
+// CraftBukkit end
+
 public interface IDispenseBehavior {
 
     Logger LOGGER = LogUtils.getLogger();
@@ -202,14 +217,42 @@
                 EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
                 EntityTypes entitytypes = ((ItemMonsterEgg) itemstack.getItem()).getType(itemstack.getTag());
 
+                // CraftBukkit start
+                WorldServer worldserver = isourceblock.getLevel();
+                ItemStack itemstack1 = itemstack.split(1);
+                org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
+                CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
+
+                BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
+                if (!BlockDispenser.eventFired) {
+                    worldserver.getCraftServer().getPluginManager().callEvent(event);
+                }
+
+                if (event.isCancelled()) {
+                    itemstack.grow(1);
+                    return itemstack;
+                }
+
+                if (!event.getItem().equals(craftItem)) {
+                    itemstack.grow(1);
+                    // Chain to handler for new item
+                    ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
+                    IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
+                    if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
+                        idispensebehavior.dispense(isourceblock, eventStack);
+                        return itemstack;
+                    }
+                }
+
                 try {
                     entitytypes.spawn(isourceblock.getLevel(), itemstack, (EntityHuman) null, isourceblock.getPos().relative(enumdirection), EnumMobSpawn.DISPENSER, enumdirection != EnumDirection.UP, false);
                 } catch (Exception exception) {
-                    null.LOGGER.error("Error while dispensing spawn egg from dispenser at {}", isourceblock.getPos(), exception);
+                    LOGGER.error("Error while dispensing spawn egg from dispenser at {}", isourceblock.getPos(), exception); // CraftBukkit - decompile error
                     return ItemStack.EMPTY;
                 }
 
-                itemstack.shrink(1);
+                // itemstack.shrink(1); // Handled during event processing
+                // CraftBukkit end
                 isourceblock.getLevel().gameEvent((Entity) null, GameEvent.ENTITY_PLACE, isourceblock.getPos());
                 return itemstack;
             }
@@ -228,13 +271,41 @@
                 EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
                 BlockPosition blockposition = isourceblock.getPos().relative(enumdirection);
                 WorldServer worldserver = isourceblock.getLevel();
+
+                // CraftBukkit start
+                ItemStack itemstack1 = itemstack.split(1);
+                org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
+                CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
+
+                BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
+                if (!BlockDispenser.eventFired) {
+                    worldserver.getCraftServer().getPluginManager().callEvent(event);
+                }
+
+                if (event.isCancelled()) {
+                    itemstack.grow(1);
+                    return itemstack;
+                }
+
+                if (!event.getItem().equals(craftItem)) {
+                    itemstack.grow(1);
+                    // Chain to handler for new item
+                    ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
+                    IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
+                    if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
+                        idispensebehavior.dispense(isourceblock, eventStack);
+                        return itemstack;
+                    }
+                }
+                // CraftBukkit end
+
                 Consumer<EntityArmorStand> consumer = EntityTypes.appendDefaultStackConfig((entityarmorstand) -> {
                     entityarmorstand.setYRot(enumdirection.toYRot());
                 }, worldserver, itemstack, (EntityHuman) null);
                 EntityArmorStand entityarmorstand = (EntityArmorStand) EntityTypes.ARMOR_STAND.spawn(worldserver, itemstack.getTag(), consumer, blockposition, EnumMobSpawn.DISPENSER, false, false);
 
                 if (entityarmorstand != null) {
-                    itemstack.shrink(1);
+                    // itemstack.shrink(1); // CraftBukkit - Handled during event processing
                 }
 
                 return itemstack;
@@ -255,8 +326,35 @@
                 });
 
                 if (!list.isEmpty()) {
+                    // CraftBukkit start
+                    ItemStack itemstack1 = itemstack.split(1);
+                    World world = isourceblock.getLevel();
+                    org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
+                    CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
+
+                    BlockDispenseArmorEvent event = new BlockDispenseArmorEvent(block, craftItem.clone(), (org.bukkit.craftbukkit.entity.CraftLivingEntity) list.get(0).getBukkitEntity());
+                    if (!BlockDispenser.eventFired) {
+                        world.getCraftServer().getPluginManager().callEvent(event);
+                    }
+
+                    if (event.isCancelled()) {
+                        itemstack.grow(1);
+                        return itemstack;
+                    }
+
+                    if (!event.getItem().equals(craftItem)) {
+                        itemstack.grow(1);
+                        // Chain to handler for new item
+                        ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
+                        IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
+                        if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != ItemArmor.DISPENSE_ITEM_BEHAVIOR) {
+                            idispensebehavior.dispense(isourceblock, eventStack);
+                            return itemstack;
+                        }
+                    }
+                    // CraftBukkit end
                     ((ISaddleable) list.get(0)).equipSaddle(SoundCategory.BLOCKS);
-                    itemstack.shrink(1);
+                    // itemstack.shrink(1); // CraftBukkit - handled above
                     this.setSuccess(true);
                     return itemstack;
                 } else {
@@ -283,7 +381,35 @@
                     entityhorseabstract = (EntityHorseAbstract) iterator1.next();
                 } while (!entityhorseabstract.isArmor(itemstack) || entityhorseabstract.isWearingArmor() || !entityhorseabstract.isTamed());
 
-                entityhorseabstract.getSlot(401).set(itemstack.split(1));
+                // CraftBukkit start
+                ItemStack itemstack1 = itemstack.split(1);
+                World world = isourceblock.getLevel();
+                org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
+                CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
+
+                BlockDispenseArmorEvent event = new BlockDispenseArmorEvent(block, craftItem.clone(), (org.bukkit.craftbukkit.entity.CraftLivingEntity) entityhorseabstract.getBukkitEntity());
+                if (!BlockDispenser.eventFired) {
+                    world.getCraftServer().getPluginManager().callEvent(event);
+                }
+
+                if (event.isCancelled()) {
+                    itemstack.grow(1);
+                    return itemstack;
+                }
+
+                if (!event.getItem().equals(craftItem)) {
+                    itemstack.grow(1);
+                    // Chain to handler for new item
+                    ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
+                    IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
+                    if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != ItemArmor.DISPENSE_ITEM_BEHAVIOR) {
+                        idispensebehavior.dispense(isourceblock, eventStack);
+                        return itemstack;
+                    }
+                }
+
+                entityhorseabstract.getSlot(401).set(CraftItemStack.asNMSCopy(event.getItem()));
+                // CraftBukkit end
                 this.setSuccess(true);
                 return itemstack;
             }
@@ -326,9 +452,35 @@
                     }
 
                     entityhorsechestedabstract = (EntityHorseChestedAbstract) iterator1.next();
-                } while (!entityhorsechestedabstract.isTamed() || !entityhorsechestedabstract.getSlot(499).set(itemstack));
+                    // CraftBukkit start
+                } while (!entityhorsechestedabstract.isTamed());
+                ItemStack itemstack1 = itemstack.split(1);
+                World world = isourceblock.getLevel();
+                org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
+                CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
+
+                BlockDispenseArmorEvent event = new BlockDispenseArmorEvent(block, craftItem.clone(), (org.bukkit.craftbukkit.entity.CraftLivingEntity) entityhorsechestedabstract.getBukkitEntity());
+                if (!BlockDispenser.eventFired) {
+                    world.getCraftServer().getPluginManager().callEvent(event);
+                }
 
-                itemstack.shrink(1);
+                if (event.isCancelled()) {
+                    return itemstack;
+                }
+
+                if (!event.getItem().equals(craftItem)) {
+                    // Chain to handler for new item
+                    ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
+                    IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
+                    if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != ItemArmor.DISPENSE_ITEM_BEHAVIOR) {
+                        idispensebehavior.dispense(isourceblock, eventStack);
+                        return itemstack;
+                    }
+                }
+                entityhorsechestedabstract.getSlot(499).set(CraftItemStack.asNMSCopy(event.getItem()));
+                // CraftBukkit end
+
+                // itemstack.shrink(1); // CraftBukkit - handled above
                 this.setSuccess(true);
                 return itemstack;
             }
@@ -337,12 +489,41 @@
             @Override
             public ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
                 EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
+                // CraftBukkit start
+                WorldServer worldserver = isourceblock.getLevel();
+                ItemStack itemstack1 = itemstack.split(1);
+                org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
+                CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
+
+                BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(enumdirection.getStepX(), enumdirection.getStepY(), enumdirection.getStepZ()));
+                if (!BlockDispenser.eventFired) {
+                    worldserver.getCraftServer().getPluginManager().callEvent(event);
+                }
+
+                if (event.isCancelled()) {
+                    itemstack.grow(1);
+                    return itemstack;
+                }
+
+                if (!event.getItem().equals(craftItem)) {
+                    itemstack.grow(1);
+                    // Chain to handler for new item
+                    ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
+                    IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
+                    if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
+                        idispensebehavior.dispense(isourceblock, eventStack);
+                        return itemstack;
+                    }
+                }
+
+                itemstack1 = CraftItemStack.asNMSCopy(event.getItem());
                 EntityFireworks entityfireworks = new EntityFireworks(isourceblock.getLevel(), itemstack, isourceblock.x(), isourceblock.y(), isourceblock.x(), true);
 
                 IDispenseBehavior.setEntityPokingOutOfBlock(isourceblock, entityfireworks, enumdirection);
                 entityfireworks.shoot((double) enumdirection.getStepX(), (double) enumdirection.getStepY(), (double) enumdirection.getStepZ(), 0.5F, 1.0F);
                 isourceblock.getLevel().addFreshEntity(entityfireworks);
-                itemstack.shrink(1);
+                // itemstack.shrink(1); // Handled during event processing
+                // CraftBukkit end
                 return itemstack;
             }
 
@@ -364,12 +545,40 @@
                 double d3 = randomsource.triangle((double) enumdirection.getStepX(), 0.11485000000000001D);
                 double d4 = randomsource.triangle((double) enumdirection.getStepY(), 0.11485000000000001D);
                 double d5 = randomsource.triangle((double) enumdirection.getStepZ(), 0.11485000000000001D);
-                EntitySmallFireball entitysmallfireball = new EntitySmallFireball(worldserver, d0, d1, d2, d3, d4, d5);
 
-                worldserver.addFreshEntity((Entity) SystemUtils.make(entitysmallfireball, (entitysmallfireball1) -> {
-                    entitysmallfireball1.setItem(itemstack);
-                }));
-                itemstack.shrink(1);
+                // CraftBukkit start
+                ItemStack itemstack1 = itemstack.split(1);
+                org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
+                CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
+
+                BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d3, d4, d5));
+                if (!BlockDispenser.eventFired) {
+                    worldserver.getCraftServer().getPluginManager().callEvent(event);
+                }
+
+                if (event.isCancelled()) {
+                    itemstack.grow(1);
+                    return itemstack;
+                }
+
+                if (!event.getItem().equals(craftItem)) {
+                    itemstack.grow(1);
+                    // Chain to handler for new item
+                    ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
+                    IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
+                    if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
+                        idispensebehavior.dispense(isourceblock, eventStack);
+                        return itemstack;
+                    }
+                }
+
+                EntitySmallFireball entitysmallfireball = new EntitySmallFireball(worldserver, d0, d1, d2, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
+                entitysmallfireball.setItem(itemstack1);
+                entitysmallfireball.projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource((TileEntityDispenser) isourceblock.getEntity());
+
+                worldserver.addFreshEntity(entitysmallfireball);
+                // itemstack.shrink(1); // Handled during event processing
+                // CraftBukkit end
                 return itemstack;
             }
 
@@ -405,9 +614,51 @@
                 BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
                 WorldServer worldserver = isourceblock.getLevel();
 
+                // CraftBukkit start
+                int x = blockposition.getX();
+                int y = blockposition.getY();
+                int z = blockposition.getZ();
+                IBlockData iblockdata = worldserver.getBlockState(blockposition);
+                if (iblockdata.isAir() || iblockdata.canBeReplaced() || (dispensiblecontaineritem instanceof ItemBucket && iblockdata.getBlock() instanceof IFluidContainer && ((IFluidContainer) iblockdata.getBlock()).canPlaceLiquid(worldserver, blockposition, iblockdata, ((ItemBucket) dispensiblecontaineritem).content))) {
+                    org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
+                    CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
+
+                    BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(x, y, z));
+                    if (!BlockDispenser.eventFired) {
+                        worldserver.getCraftServer().getPluginManager().callEvent(event);
+                    }
+
+                    if (event.isCancelled()) {
+                        return itemstack;
+                    }
+
+                    if (!event.getItem().equals(craftItem)) {
+                        // Chain to handler for new item
+                        ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
+                        IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
+                        if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
+                            idispensebehavior.dispense(isourceblock, eventStack);
+                            return itemstack;
+                        }
+                    }
+
+                    dispensiblecontaineritem = (DispensibleContainerItem) CraftItemStack.asNMSCopy(event.getItem()).getItem();
+                }
+                // CraftBukkit end
+
                 if (dispensiblecontaineritem.emptyContents((EntityHuman) null, worldserver, blockposition, (MovingObjectPositionBlock) null)) {
                     dispensiblecontaineritem.checkExtraContent((EntityHuman) null, worldserver, itemstack, blockposition);
-                    return new ItemStack(Items.BUCKET);
+                    // CraftBukkit start - Handle stacked buckets
+                    Item item = Items.BUCKET;
+                    itemstack.shrink(1);
+                    if (itemstack.isEmpty()) {
+                        itemstack.setItem(Items.BUCKET);
+                        itemstack.setCount(1);
+                    } else if (((TileEntityDispenser) isourceblock.getEntity()).addItem(new ItemStack(item)) < 0) {
+                        this.defaultDispenseItemBehavior.dispense(isourceblock, new ItemStack(item));
+                    }
+                    return itemstack;
+                    // CraftBukkit end
                 } else {
                     return this.defaultDispenseItemBehavior.dispense(isourceblock, itemstack);
                 }
@@ -434,7 +685,7 @@
                 Block block = iblockdata.getBlock();
 
                 if (block instanceof IFluidSource) {
-                    ItemStack itemstack1 = ((IFluidSource) block).pickupBlock(worldserver, blockposition, iblockdata);
+                    ItemStack itemstack1 = ((IFluidSource) block).pickupBlock(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata); // CraftBukkit
 
                     if (itemstack1.isEmpty()) {
                         return super.execute(isourceblock, itemstack);
@@ -442,6 +693,32 @@
                         worldserver.gameEvent((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
                         Item item = itemstack1.getItem();
 
+                        // CraftBukkit start
+                        org.bukkit.block.Block bukkitBlock = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
+                        CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
+
+                        BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+                        if (!BlockDispenser.eventFired) {
+                            worldserver.getCraftServer().getPluginManager().callEvent(event);
+                        }
+
+                        if (event.isCancelled()) {
+                            return itemstack;
+                        }
+
+                        if (!event.getItem().equals(craftItem)) {
+                            // Chain to handler for new item
+                            ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
+                            IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
+                            if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
+                                idispensebehavior.dispense(isourceblock, eventStack);
+                                return itemstack;
+                            }
+                        }
+
+                        itemstack1 = ((IFluidSource) block).pickupBlock(worldserver, blockposition, iblockdata); // From above
+                        // CraftBukkit end
+
                         itemstack.shrink(1);
                         if (itemstack.isEmpty()) {
                             return new ItemStack(item);
@@ -463,16 +740,44 @@
             protected ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
                 WorldServer worldserver = isourceblock.getLevel();
 
+                // CraftBukkit start
+                org.bukkit.block.Block bukkitBlock = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
+                CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
+
+                BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
+                if (!BlockDispenser.eventFired) {
+                    worldserver.getCraftServer().getPluginManager().callEvent(event);
+                }
+
+                if (event.isCancelled()) {
+                    return itemstack;
+                }
+
+                if (!event.getItem().equals(craftItem)) {
+                    // Chain to handler for new item
+                    ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
+                    IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
+                    if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
+                        idispensebehavior.dispense(isourceblock, eventStack);
+                        return itemstack;
+                    }
+                }
+                // CraftBukkit end
+
                 this.setSuccess(true);
                 EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
                 BlockPosition blockposition = isourceblock.getPos().relative(enumdirection);
                 IBlockData iblockdata = worldserver.getBlockState(blockposition);
 
                 if (BlockFireAbstract.canBePlacedAt(worldserver, blockposition, enumdirection)) {
-                    worldserver.setBlockAndUpdate(blockposition, BlockFireAbstract.getState(worldserver, blockposition));
-                    worldserver.gameEvent((Entity) null, GameEvent.BLOCK_PLACE, blockposition);
+                    // CraftBukkit start - Ignition by dispensing flint and steel
+                    if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(worldserver, blockposition, isourceblock.getPos()).isCancelled()) {
+                        worldserver.setBlockAndUpdate(blockposition, BlockFireAbstract.getState(worldserver, blockposition));
+                        worldserver.gameEvent((Entity) null, GameEvent.BLOCK_PLACE, blockposition);
+                    }
+                    // CraftBukkit end
                 } else if (!BlockCampfire.canLight(iblockdata) && !CandleBlock.canLight(iblockdata) && !CandleCakeBlock.canLight(iblockdata)) {
-                    if (iblockdata.getBlock() instanceof BlockTNT) {
+                    if (iblockdata.getBlock() instanceof BlockTNT && org.bukkit.craftbukkit.event.CraftEventFactory.callTNTPrimeEvent(worldserver, blockposition, org.bukkit.event.block.TNTPrimeEvent.PrimeCause.DISPENSER, null, isourceblock.getPos())) { // CraftBukkit - TNTPrimeEvent
                         BlockTNT.explode(worldserver, blockposition);
                         worldserver.removeBlock(blockposition, false);
                     } else {
@@ -496,12 +801,62 @@
                 this.setSuccess(true);
                 WorldServer worldserver = isourceblock.getLevel();
                 BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
+                // CraftBukkit start
+                org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
+                CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
+
+                BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
+                if (!BlockDispenser.eventFired) {
+                    worldserver.getCraftServer().getPluginManager().callEvent(event);
+                }
+
+                if (event.isCancelled()) {
+                    return itemstack;
+                }
+
+                if (!event.getItem().equals(craftItem)) {
+                    // Chain to handler for new item
+                    ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
+                    IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
+                    if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
+                        idispensebehavior.dispense(isourceblock, eventStack);
+                        return itemstack;
+                    }
+                }
+
+                worldserver.captureTreeGeneration = true;
+                // CraftBukkit end
 
                 if (!ItemBoneMeal.growCrop(itemstack, worldserver, blockposition) && !ItemBoneMeal.growWaterPlant(itemstack, worldserver, blockposition, (EnumDirection) null)) {
                     this.setSuccess(false);
                 } else if (!worldserver.isClientSide) {
                     worldserver.levelEvent(1505, blockposition, 0);
                 }
+                // CraftBukkit start
+                worldserver.captureTreeGeneration = false;
+                if (worldserver.capturedBlockStates.size() > 0) {
+                    TreeType treeType = BlockSapling.treeType;
+                    BlockSapling.treeType = null;
+                    Location location = CraftLocation.toBukkit(blockposition, worldserver.getWorld());
+                    List<org.bukkit.block.BlockState> blocks = new java.util.ArrayList<>(worldserver.capturedBlockStates.values());
+                    worldserver.capturedBlockStates.clear();
+                    StructureGrowEvent structureEvent = null;
+                    if (treeType != null) {
+                        structureEvent = new StructureGrowEvent(location, treeType, false, null, blocks);
+                        org.bukkit.Bukkit.getPluginManager().callEvent(structureEvent);
+                    }
+
+                    BlockFertilizeEvent fertilizeEvent = new BlockFertilizeEvent(location.getBlock(), null, blocks);
+                    fertilizeEvent.setCancelled(structureEvent != null && structureEvent.isCancelled());
+                    org.bukkit.Bukkit.getPluginManager().callEvent(fertilizeEvent);
+
+                    if (!fertilizeEvent.isCancelled()) {
+                        for (org.bukkit.block.BlockState blockstate : blocks) {
+                            blockstate.update(true);
+                        }
+                    }
+                }
+                // CraftBukkit end
 
                 return itemstack;
             }
@@ -511,12 +866,41 @@
             protected ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
                 WorldServer worldserver = isourceblock.getLevel();
                 BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
-                EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (EntityLiving) null);
+                // CraftBukkit start
+                // EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (EntityLiving) null);
+
+                ItemStack itemstack1 = itemstack.split(1);
+                org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
+                CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
+
+                BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D));
+                if (!BlockDispenser.eventFired) {
+                   worldserver.getCraftServer().getPluginManager().callEvent(event);
+                }
+
+                if (event.isCancelled()) {
+                    itemstack.grow(1);
+                    return itemstack;
+                }
+
+                if (!event.getItem().equals(craftItem)) {
+                    itemstack.grow(1);
+                    // Chain to handler for new item
+                    ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
+                    IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
+                    if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
+                        idispensebehavior.dispense(isourceblock, eventStack);
+                        return itemstack;
+                    }
+                }
+
+                EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldserver, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), (EntityLiving) null);
+                // CraftBukkit end
 
                 worldserver.addFreshEntity(entitytntprimed);
                 worldserver.playSound((EntityHuman) null, entitytntprimed.getX(), entitytntprimed.getY(), entitytntprimed.getZ(), SoundEffects.TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F);
                 worldserver.gameEvent((Entity) null, GameEvent.ENTITY_PLACE, blockposition);
-                itemstack.shrink(1);
+                // itemstack.shrink(1); // CraftBukkit - handled above
                 return itemstack;
             }
         });
@@ -541,6 +925,30 @@
                 EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
                 BlockPosition blockposition = isourceblock.getPos().relative(enumdirection);
 
+                // CraftBukkit start
+                org.bukkit.block.Block bukkitBlock = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
+                CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
+
+                BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+                if (!BlockDispenser.eventFired) {
+                    worldserver.getCraftServer().getPluginManager().callEvent(event);
+                }
+
+                if (event.isCancelled()) {
+                    return itemstack;
+                }
+
+                if (!event.getItem().equals(craftItem)) {
+                    // Chain to handler for new item
+                    ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
+                    IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
+                    if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
+                        idispensebehavior.dispense(isourceblock, eventStack);
+                        return itemstack;
+                    }
+                }
+                // CraftBukkit end
+
                 if (worldserver.isEmptyBlock(blockposition) && BlockWitherSkull.canSpawnMob(worldserver, blockposition, itemstack)) {
                     worldserver.setBlock(blockposition, (IBlockData) Blocks.WITHER_SKELETON_SKULL.defaultBlockState().setValue(BlockSkull.ROTATION, RotationSegment.convertToSegment(enumdirection)), 3);
                     worldserver.gameEvent((Entity) null, GameEvent.BLOCK_PLACE, blockposition);
@@ -566,6 +974,30 @@
                 BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
                 BlockPumpkinCarved blockpumpkincarved = (BlockPumpkinCarved) Blocks.CARVED_PUMPKIN;
 
+                // CraftBukkit start
+                org.bukkit.block.Block bukkitBlock = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
+                CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
+
+                BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+                if (!BlockDispenser.eventFired) {
+                    worldserver.getCraftServer().getPluginManager().callEvent(event);
+                }
+
+                if (event.isCancelled()) {
+                    return itemstack;
+                }
+
+                if (!event.getItem().equals(craftItem)) {
+                    // Chain to handler for new item
+                    ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
+                    IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
+                    if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
+                        idispensebehavior.dispense(isourceblock, eventStack);
+                        return itemstack;
+                    }
+                }
+                // CraftBukkit end
+
                 if (worldserver.isEmptyBlock(blockposition) && blockpumpkincarved.canSpawnGolem(worldserver, blockposition)) {
                     if (!worldserver.isClientSide) {
                         worldserver.setBlock(blockposition, blockpumpkincarved.defaultBlockState(), 3);
@@ -615,6 +1047,30 @@
                 BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
                 IBlockData iblockdata = worldserver.getBlockState(blockposition);
 
+                // CraftBukkit start
+                org.bukkit.block.Block bukkitBlock = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
+                CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
+
+                BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+                if (!BlockDispenser.eventFired) {
+                    worldserver.getCraftServer().getPluginManager().callEvent(event);
+                }
+
+                if (event.isCancelled()) {
+                    return itemstack;
+                }
+
+                if (!event.getItem().equals(craftItem)) {
+                    // Chain to handler for new item
+                    ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
+                    IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
+                    if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
+                        idispensebehavior.dispense(isourceblock, eventStack);
+                        return itemstack;
+                    }
+                }
+                // CraftBukkit end
+
                 if (iblockdata.is(TagsBlock.BEEHIVES, (blockbase_blockdata) -> {
                     return blockbase_blockdata.hasProperty(BlockBeehive.HONEY_LEVEL) && blockbase_blockdata.getBlock() instanceof BlockBeehive;
                 }) && (Integer) iblockdata.getValue(BlockBeehive.HONEY_LEVEL) >= 5) {
