package net.glowstone.block.blocktype;

import net.glowstone.block.GlowBlockState;
import org.bukkit.Material;

public class BlockLava extends BlockLiquid {

    public BlockLava() {
        super(Material.LAVA_BUCKET);
    }

    @Override
    public boolean isCollectible(GlowBlockState target) {
        return (target.getType() == Material.LAVA || target.getType() == Material.STATIONARY_LAVA) &&
                (target.getRawData() == 0 || target.getRawData() == 8); // 8 for backwards compatibility
    }

}

@@ -58,458 +58,3081 @@
 one.
-block.GlowBlockState;%0Aimport org.bukkit.Material;%0A%0Apublic class BlockLava extends BlockLiquid %7B%0A%0A    public BlockLava() %7B%0A        super(Material.LAVA_BUCKET);%0A    %7D%0A%0A    @Override%0A    public boolean isCollectible(GlowBlockState target) %7B%0A        return (target.getType() == Material.LAVA %7C%7C target.getType() == Material.STATIONARY_LAVA) &&%0A                (target.getRawData() == 0 %7C%7C target.getRawData() == 8); // 8 for backwards compatibility%0A    %7D%0A
+EventFactory;%0Aimport net.glowstone.block.GlowBlock;%0Aimport net.glowstone.block.GlowBlockState;%0Aimport org.bukkit.Material;%0Aimport org.bukkit.block.BlockFace;%0Aimport org.bukkit.event.block.BlockIgniteEvent;%0Aimport org.bukkit.event.block.BlockIgniteEvent.IgniteCause;%0A%0Apublic class BlockLava extends BlockLiquid %7B%0A%0A    private static final BlockFace%5B%5D FLAMMABLE_FACES = %7BBlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST, BlockFace.UP, BlockFace.DOWN%7D;%0A%0A    public BlockLava() %7B%0A        super(Material.LAVA_BUCKET);%0A    %7D%0A%0A    @Override%0A    public boolean isCollectible(GlowBlockState target) %7B%0A        return (target.getType() == Material.LAVA %7C%7C target.getType() == Material.STATIONARY_LAVA) &&%0A                (target.getRawData() == 0 %7C%7C target.getRawData() == 8); // 8 for backwards compatibility%0A    %7D%0A%0A    @Override%0A    public boolean canTickRandomly() %7B%0A        return true;%0A    %7D%0A%0A    @Override%0A    public void updateBlock(GlowBlock block) %7B%0A        if (!block.getWorld().getGameRuleMap().getBoolean(%22doFireTick%22)) %7B%0A            return;%0A        %7D%0A        final int n = random.nextInt(3);%0A        if (n == 0) %7B%0A            for (int i = 0; i %3C 3; i++) %7B%0A                final GlowBlock b = (GlowBlock) block.getLocation().add(-1 + random.nextInt(3), 0, -1 + random.nextInt(3)).getBlock();%0A                final GlowBlock bAbove = b.getRelative(BlockFace.UP);%0A                if (bAbove.isEmpty() && b.isFlammable()) %7B%0A                    BlockIgniteEvent igniteEvent = new BlockIgniteEvent(bAbove, IgniteCause.LAVA, block);%0A                    EventFactory.callEvent(igniteEvent);%0A                    if (!igniteEvent.isCancelled()) %7B%0A                        final GlowBlockState state = bAbove.getState();%0A                        state.setType(Material.FIRE);%0A                        state.update(true);%0A                    %7D%0A                %7D%0A            %7D%0A        %7D else %7B%0A            for (int i = 0; i %3C n; i++) %7B%0A                final GlowBlock b = (GlowBlock) block.getLocation().add(-1 + random.nextInt(3), 1, -1 + random.nextInt(3)).getBlock();%0A                if (b.isEmpty()) %7B%0A                    if (hasNearFlammableBlock(b)) %7B%0A                        BlockIgniteEvent igniteEvent = new BlockIgniteEvent(b, IgniteCause.LAVA, block);%0A                        EventFactory.callEvent(igniteEvent);%0A                        if (!igniteEvent.isCancelled()) %7B%0A                            final GlowBlockState state = b.getState();%0A                            state.setType(Material.FIRE);%0A                            state.update(true);%0A                        %7D%0A                        break;%0A                    %7D%0A                %7D else if (b.getType().isSolid()) %7B%0A                    break;%0A                %7D%0A            %7D%0A        %7D%0A    %7D%0A%0A    private boolean hasNearFlammableBlock(GlowBlock block) %7B%0A        // check there's at least a flammable block around%0A        for (BlockFace face : FLAMMABLE_FACES) %7B%0A            if (block.getRelative(face).isFlammable()) %7B%0A                return true;%0A            %7D%0A        %7D%0A        return false;%0A    %7D
 %0A%7D%0A

Add lava fire spread