pinv = player.getInventory();
hasLimiter = false;
var rand = 0
function destroy(Block)
{
    if(world.getBlockID(Block.x,Block.y,Block.z) == 207)
    {
        if (world.getMetadata(Block.x,Block.y,Block.z) == 14) {
            world.setBlockID(Block.x,Block.y,Block.z,0);
            sound.playSound3D("random.glass",Block.x + 0.5,Block.y + 0.5,Block.z + 0.5);
            for (var i = 0; i < 3; i++)
            {
                var particle = effect.spawnParticle("explode", Block.x, Block.y+0.3, Block.z, 0, 0, 0)
                particle.setVelocity(Math.random()*0.2 - 0.1, Math.random()*0.2 - 0.1, Math.random()*0.2 - 0.1);
            }
            rand = Math.floor(Math.random() * 5);
            if (rand == 0) {
                player.dropItem(Item(337, Math.random()*3));
            } else {
                player.dropItem(Item(351, Math.random()*3, 15));
            }
            itemSearch = player.getEntitiesWithinRange(0.2);
            for (var i = 0; i < itemSearch.length; i++) {
                var ent = itemSearch[i];
                if (ent.getClassType() == "Item") {
                    ent.setPosition(hitBlock.x + 0.5, hitBlock.y + 0.5, hitBlock.z + 0.5)
                    ent.setVelocity(Math.random()*0.2 - 0.1, Math.random()*0.2 - 0.1, Math.random()*0.2 - 0.1);
                }
            }
        } else if (world.getMetadata(Block.x,Block.y,Block.z) == 13) {
            world.setBlockID(Block.x,Block.y,Block.z,0);
            sound.playSound3D("random.glass",Block.x + 0.5,Block.y + 0.5,Block.z + 0.5);
            for (var i = 0; i < 3; i++)
            {
                var particle = effect.spawnParticle("explode", Block.x, Block.y+0.3, Block.z, 0, 0, 0)
                particle.setVelocity(Math.random()*0.2 - 0.1, Math.random()*0.2 - 0.1, Math.random()*0.2 - 0.1);
            }
            rand = Math.floor(Math.random() * 5);
            if (rand == 0) {
                player.dropItem(Item(331, Math.random()*3));
            } else {
                player.dropItem(Item(351, Math.random()*3, 15));
            }
            itemSearch = player.getEntitiesWithinRange(0.2);
            for (var i = 0; i < itemSearch.length; i++) {
                var ent = itemSearch[i];
                if (ent.getClassType() == "Item") {
                    ent.setPosition(hitBlock.x + 0.5, hitBlock.y + 0.5, hitBlock.z + 0.5)
                    ent.setVelocity(Math.random()*0.2 - 0.1, Math.random()*0.2 - 0.1, Math.random()*0.2 - 0.1);
                }
            }
        } else if (world.getMetadata(Block.x,Block.y,Block.z) == 12) {
            world.setBlockID(Block.x,Block.y,Block.z,0);
            sound.playSound3D("random.glass",Block.x + 0.5,Block.y + 0.5,Block.z + 0.5);
            for (var i = 0; i < 3; i++)
            {
                var particle = effect.spawnParticle("explode", Block.x, Block.y+0.3, Block.z, 0, 0, 0)
                particle.setVelocity(Math.random()*0.2 - 0.1, Math.random()*0.2 - 0.1, Math.random()*0.2 - 0.1);
            }
            rand = Math.floor(Math.random() * 2);
            if (rand == 0) {
                player.dropItem(Item(296, Math.random()*3));
            } else {
                player.dropItem(Item(337, Math.random()*2));
            }
            itemSearch = player.getEntitiesWithinRange(0.2);
            for (var i = 0; i < itemSearch.length; i++) {
                var ent = itemSearch[i];
                if (ent.getClassType() == "Item") {
                    ent.setPosition(hitBlock.x + 0.5, hitBlock.y + 0.5, hitBlock.z + 0.5)
                    ent.setVelocity(Math.random()*0.2 - 0.1, Math.random()*0.2 - 0.1, Math.random()*0.2 - 0.1);
            }
            }
        }
    }
}