if (hitBlock != null) {
repairFun(repair, ent, itemID);
if (itemID != usingTool) {blockHP = 0; blockMaxHP = 0; blockx = 0; bloxky = 0; blockz = 0;} 

// DROPBLOCK - randomRange (0, 1) ItemID (2), Item min drop (3), Item max drop (4), ItemDmg (5).
// TOOL - blade [0], harvest [1], chop [2], smash [3], dig [4], pick [5], collect [6]
if (hitBlock.x != blockx || hitBlock.y != blocky || hitBlock.z != blockz) 
{btool = [0, 0, 0, 0, 0, 0, 0];
blockx = hitBlock.x; blocky = hitBlock.y; blockz = hitBlock.z; blockHP = 0; usingTool = itemID;
var blockID = world.getBlockID(hitBlock.x,hitBlock.y,hitBlock.z); soundType = "Stone";
function setChance() {chance = 0; for (i = 0; tool [i] != undefined; i++) {chance += tool[i]*gtool[i]/12000;}}
// [STONE] ID1 //
if (blockID == 1) {blockHP = 50; blockName = "Stone"; 
randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Stone";
btool = [15, 10, 20, 30, 10, 80, 5]; gtool = [20, 10, 15, 50, 20, 80, 5];
setChance(); chance = chance*Math.sqrt(mining_lvl + smithing_lvl/4);
dropBlock = [[0, 23+chance, 2097, 1, 2+Math.sqrt(mining_lvl/4+1), 0], [-1, 0], [-1, 0], [-1, 0], [-1, 0]]; // 1-3 Rocks
mainBlock = [[0, 30, 1, 1, 1, 0], [-1, 0]] // 100% - STONE
function onDestroyed() {mining_xp += (3 + Math.sqrt(mining_lvl/2))*chance/2;}}
// [DIRT] ID2 - ID3 //
if ((blockID == 2 || blockID == 3) && tool[4] != 0) {blockHP = 30/blockID*2; blockName = "Dirt";  
randMax = 30; changeTo = [0, 0]; upper_block = 0; 
soundType = (blockID == 2) ? "Grass" : "Gravel";
btool = [10, 10, 15, 15, 80, 15, 40]; gtool = [10, 10, 15, 15, 80, 20, 80];
setChance(); chance = chance*Math.sqrt(digging_lvl + gardening_lvl/3);
dropBlock = [[0, 5+chance/2, 352, 1, 1, 0], [8+chance/2, 12+chance/2, 262, 1, 3, 0], [0, 23+chance, 3, 1, 1, 0], 
[14, 17+chance/2, 288, 1, 1, 0], [20, 23+chance/2, 280, 1, 1, 0]]; // Bone, 1-3 Arrows, Dirt, Feather, Stick
mainBlock = [[0, 30, 3, 1, 1, 0], [-1, 0]] // 100% - DIRT
function onDestroyed() {digging_xp += (4 + Math.sqrt(digging_lvl/blockID*2))*chance/2;}}
// [COBBLE STONE] ID4 //
if (blockID == 4) {blockHP = 40; blockName = "Cobble stone";
randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Stone";
btool = [20, 15, 25, 50, 15, 80, 30]; gtool = [25, 15, 20, 60, 25, 80, 40];
setChance(); chance = chance*Math.sqrt(mining_lvl + smithing_lvl/4);
dropBlock = [[0, 23+chance, 2097, 1, 3+Math.sqrt(mining_lvl/10+1), 0], [-1, 0], [-1, 0], [-1, 0], [-1, 0]]; // 1-3 Rocks
mainBlock = [[0, 30, 1, 1, 1, 0], [-1, 0]] // 100% - COBBLE STONE
function onDestroyed() {mining_xp += (2 + Math.sqrt(mining_lvl/3))*chance/2;}}
// [SAPLING] ID6 //
if (blockID == 6) {blockHP = 20; blockName = prices [blockID] [blockMD] [2];
randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Grass";
btool = [50, 30, 70, 60, 40, 15, 60]; gtool = [60, 50, 60, 20, 80, 10, 80];
setChance(); chance = chance*Math.sqrt(harvesting_lvl + gardening_lvl/3);
dropBlock = [[0, 20+chance, blockID, 1, 1, blockMD], [-1, 0], [-1, 0], [-1, 0], [-1, 0]]; // 1 Sapling
mainBlock = [[0, 30, blockID, 1, 1, blockMD], [-1, 0]] // 100% - SAPLING
function onDestroyed() {mining_xp += (2 + Math.sqrt(harvesting_lvl/3))*chance/2;}}
// [SAND] ID12 //
if (blockID == 12 && tool[4] != 0) {blockHP = 16+Math.sqrt(digging_lvl); blockName = "Sand";  
randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Sand";
btool = [10, 10, 30, 15, 90, 10, 45]; gtool = [10, 10, 20, 10, 90, 10, 70];
setChance(); chance = chance*Math.sqrt(digging_lvl);
dropBlock = [[8+chance, 11, 262, 1, 3, 0], [0, 23+chance, 12, 1, 1, 0], 
[14, 17+chance, 288, 1, 1, 0], [20, 23+chance, 337, 1, 1, 0], [-1, 0]]; // Arrows, Sand, Feather, Clay
mainBlock = [[0, 30, 12, 1, 1, 0], [-1, 0]] // 100% - SAND
function onDestroyed() {digging_xp += (2 + Math.sqrt(digging_lvl))*chance/2;}}
// [GRAVEL] ID13 //
if (blockID == 13 && tool[4] != 0) {blockHP = 20+Math.sqrt(digging_lvl); blockName = "Gravel";  
randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Gravel";
btool = [10, 10, 20, 10, 90, 15, 40]; gtool = [10, 10, 10, 10, 90, 10, 75];
setChance(); chance = chance*Math.sqrt(digging_lvl);
dropBlock = [[0, 22+chance, 13, 1, 1, 0], [20, 24+chance, 318, 1, 1, 0], 
[4, 6+chance, 287, 1, 1, 0], [-1, 0], [-1, 0]]; // Gravel, Flint, String
mainBlock = [[0, 30, 12, 1, 1, 0], [-1, 0]] // 100% - GRAVEL
function onDestroyed() {digging_xp += (2 + Math.sqrt(digging_lvl))*chance/2;}}
// [GOLD ORE] ID14 //
if (blockID == 14) {blockHP = 80; blockName = "Gold ore"; 
randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Stone";
btool = [14, 9, 17, 23, 10, 88, 4]; gtool = [17, 9, 14, 30, 17, 88, 4];
setChance(); chance = chance*Math.sqrt(mining_lvl + smithing_lvl/4);
dropBlock = [[0, 19+chance/2, 2097, 0, 0+Math.sqrt(mining_lvl/5+1), 0], 
[14-chance/2, 30, 14, 1, 1, 0], [-1, 0], [-1, 0], [-1, 0]]; // 0-1 Rocks, GoldOre
mainBlock = [[0, 30, 14, 1, 1, 0], [-1, 0]] // 100% - GOLD ORE
function onDestroyed() {mining_xp += (30 + Math.sqrt(mining_lvl*4))*chance/2;}}
// [IRON ORE] ID15 //
if (blockID == 15) {blockHP = 75; blockName = "Iron ore"; 
randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Stone";
btool = [14, 9, 18, 25, 10, 85, 4]; gtool = [18, 9, 14, 35, 18, 85, 4];
setChance(); chance = chance*Math.sqrt(mining_lvl + smithing_lvl/4);
dropBlock = [[0, 20+chance/2, 2097, 0, 0+Math.sqrt(mining_lvl/5+1), 0], 
[12-chance/2, 30, 15, 1, 1, 0], [-1, 0], [-1, 0], [-1, 0]]; // 0-1 Rocks, IronOre
mainBlock = [[0, 30, 15, 1, 1, 0], [-1, 0]] // 100% - IRON ORE
function onDestroyed() {mining_xp += (20 + Math.sqrt(mining_lvl*3))*chance/2;}}
// [COAL ORE] ID16 //
if (blockID == 16) {blockHP = 60; blockName = "Coal Ore"; 
randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Stone";
btool = [14, 9, 18, 40, 10, 82, 4]; gtool = [18, 9, 14, 60, 18, 82, 4];
setChance(); chance = chance*Math.sqrt(mining_lvl + smithing_lvl/4);
dropBlock = [[0, 21+chance/2, 2097, 0, 0+Math.sqrt(mining_lvl/5+1), 0], 
[10-chance/2, 30, 16, 1, 1, 0], [-1, 0], [-1, 0], [-1, 0]]; // 0-1 Rocks, CoalOre
mainBlock = [[0, 30, 16, 1, 1, 0], [-1, 0]] // 100% - COAL ORE
function onDestroyed() {mining_xp += (8 + Math.sqrt(mining_lvl))*chance/2;}}
// [WOOD] ID17 //
if (blockID == 17) {blockHP = 70; blockName = "Wood"; 
randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Wood";
btool = [15, 5, 100, 10, 5, 10, 5]; gtool = [20, 20, 100, 15, 10, 10, 5];
setChance(); chance = chance*Math.sqrt(woodcut_lvl + crafting_lvl/4);
dropBlock = [[0, 14+chance/2, 280, 1, 2+Math.sqrt(woodcut_lvl/4+1), 0], [22-chance/2, 25+chance/2, 17, 1, 1, blockMD], 
[13-chance/2, 20+chance/2, 5, 1, 1+Math.sqrt(woodcut_lvl/6+0.5), 0], [-1, 0], [-1, 0]]; // Sticks, Wood, Planks
mainBlock = [[0, 30, 17, 1, 1, 0], [-1, 0]]; // 100% - WOOD
function onDestroyed() {woodcut_xp += (4 + Math.sqrt(woodcut_lvl*2))*chance/2;}}
// [LEAVES] ID18 //
if (blockID == 18) {blockHP = 15; blockName = "Leaves"; if (blockMD < 4) {blockMD = blockMD + 8;}
randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Grass";
btool = [50, 70, 40, 30, 20, 15, 40]; gtool = [40, 60, 40, 10, 15, 10, 50];
setChance(); chance = chance*Math.sqrt(harvesting_lvl + woodcut_lvl/4);
dropBlock = [[0, 24+chance/4, 18, 1, 1, blockMD - 8], [24-chance, 28, 2001, 1, 1, 0], // Leaves, Apples
[12-chance/2, 20+chance/2, 280, 0, 1, 0], [6-chance/2, 9+chance/2, 6, 1, 1, blockMD - 8], [-1, 0]]; // Sticks, Saplings 
mainBlock = [[0, 30, 18, 1, 1, 0], [-1, 0]] // 100% - LEAVES
function onDestroyed() {harvesting_xp += (1 + Math.sqrt(harvesting_lvl/2))*chance/2;}}
// [LAPIS LAZULI] ID21 //
if (blockID == 21) {blockHP = 80; blockName = "Lapis Lazuli"; 
randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Stone";
btool = [14, 11, 20, 26, 10, 86, 4]; gtool = [18, 10, 26, 34, 18, 86, 4];
setChance(); chance = chance*Math.sqrt(mining_lvl + smithing_lvl/4);
dropBlock = [[0, 20+chance/2, 2097, 0, 0+Math.sqrt(mining_lvl/5+1), 0], 
[11-chance/2, 30, 21, 1, 1, 0], [-1, 0], [-1, 0], [-1, 0]]; // Rocks, LapisOre
mainBlock = [[0, 30, 21, 1, 1, 0], [-1, 0]] // 100% - LAPIS LAZULI
function onDestroyed() {mining_xp += (30 + Math.sqrt(mining_lvl*4))*chance/2;}} 
// [COBWEB] ID30 //
if (blockID == 30) {blockHP = 20; blockName = "Cobweb"; 
randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Sand";
btool = [80, 40, 50, 50, 15, 15, 40]; gtool = [30, 30, 25, 40, 40, 30, 60];
setChance(); chance = chance*Math.sqrt(harvesting_lvl);
dropBlock = [[0, 24+chance, 30, 1, 1, 0], [-1, 0], [-1, 0], [-1, 0], [-1, 0]]; // Cobweb
mainBlock = [[0, 30, 30, 1, 1, 0], [-1, 0]] // 100% - COBWEB
function onDestroyed() {harvesting_xp += (1 + Math.sqrt(harvesting_lvl))*chance/2;}} 
// [GRASS] ID31 MD1 //
if (blockID == 31 && blockMD == 1) {blockHP = 15; blockName = "Tall Grass";  
randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Grass";
btool = [70, 50, 50, 60, 35, 25, 40]; gtool = [40, 60, 30, 20, 20, 15, 50];
setChance(); chance = chance*Math.sqrt(harvesting_lvl+sword_lvl/4);
dropBlock = [[0, 9+chance, 295, 1, 1, 0], [18-chance/2, 27+chance/2, 2020, 1, 1, 0], 
[-1, 0], [-1, 0], [-1, 0]]; // Seeds, Flower Seeds
mainBlock = [[-1, 0], [-1, 0]]; // NOTHING
function onDestroyed() {harvesting_xp += (1 + Math.sqrt(harvesting_lvl/2))*chance/2;}}
// [ROSE and DANDELION] ID37 ID38 //
if (blockID == 38 || blockID == 37) {blockHP = 8; 
if (blockID == 38) {blockName = "Rose";} if (blockID == 37) {blockName = "Dandelion";}
randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Grass";
btool = [60, 60, 35, 40, 30, 25, 45]; gtool = [30, 80, 15, 5, 15, 20, 65];
setChance(); chance = chance*Math.sqrt(gardening_lvl/2+harvesting_lvl/2);
dropBlock = [[0, 18+chance, blockID, 1, 1, 0], [-1, 0], [-1, 0], [-1, 0], [-1, 0]]; // Flower
mainBlock = [[0, 30, blockID, 1, 1, 0], [-1, 0]] // 100% - FLOWER
function onDestroyed() {harvesting_xp += (1 + Math.sqrt(harvesting_lvl/2))*chance/2}} 
// [MUSHROOM] ID39 ID40 //
if (blockID == 39 || blockID == 40) {blockHP = 15; blockName = "Mushroom";  
randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Grass";
btool = [40, 70, 30, 50, 30, 30, 40]; gtool = [30, 80, 15, 5, 10, 10, 60];
setChance(); chance = chance*Math.sqrt(gardening_lvl/2+harvesting_lvl/2);
dropBlock = [[0, 18+chance, blockID, 1, 1, 0], [-1, 0], [-1, 0], [-1, 0], [-1, 0]]; // Mushroom
mainBlock = [[0, 30, blockID, 1, 1, 0], [-1, 0]] // 100% - MUSHROOM
function onDestroyed() {harvesting_xp += (2 + Math.sqrt(harvesting_lvl))*chance/2}} 
// [DIAMOND] ID56 //
if (blockID == 56) {blockHP = 100; blockName = "Diamond"; 
randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Stone";
btool = [12, 7, 16, 22, 10, 90, 3]; gtool = [16, 11, 24, 30, 18, 90, 3];
setChance(); chance = chance*Math.sqrt(mining_lvl + smithing_lvl/4);
dropBlock = [[0, 20+chance/2, 2097, 0, 0+Math.sqrt(mining_lvl/5+1), 0], 
[16-chance/2, 30, 56, 1, 1, 0], [-1, 0], [-1, 0], [-1, 0]]; // Rocks, DiamondOre
mainBlock = [[0, 30, 56, 1, 1, 0], [-1, 0]] // 100% - DIAMOND ORE
function onDestroyed() {mining_xp += (65 + Math.sqrt(mining_lvl*6))*chance/2;}}
// [WHEAT] ID59 //
if (blockID == 59 && blockMD <= 7) {blockHP = 15+blockMD*2+gardening_lvl; blockName = "Wheat";  
randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Grass";
btool = [70, 60+blockMD*3, 60, 40-blockMD*3, 25, 30, 40]; gtool = [50, 70+blockMD*3, 30, 10, 15, 20, 60];
setChance(); chance = chance*Math.sqrt(gardening_lvl/2 + harvesting_lvl/2);
dropBlock = [[6, 20+chance, 295, 1, 1+Math.sqrt(blockMD), 0],  
[0, 15+chance, 2046, 0, 0+Math.sqrt(blockMD), 0], [-1, 0], [-1, 0], [-1, 0]]; //Seeds and wheat
mainBlock = [[-1, 0], [-1, 0]]; // NOTHING
function onDestroyed() {harvesting_xp += (1 + Math.sqrt(blockMD*2) + Math.sqrt(harvesting_lvl*3))*chance/2;}}
// [RED STONE] ID73 ID74 //
if (blockID == 73 || blockID == 74) {blockHP = 120; blockName = "Red Stone"; 
randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Stone";
btool = [14, 11, 20, 28, 10, 88, 4]; gtool = [18, 10, 26, 36, 18, 88, 4];
setChance(); chance = chance*Math.sqrt(mining_lvl + smithing_lvl/4);
dropBlock = [[0, 20+chance/2, 2097, 0, 0+Math.sqrt(mining_lvl/5+1), 0], 
[10-chance/2, 30, 73, 1, 1, 0], [-1, 0], [-1, 0], [-1, 0]]; // Rocks, RedstoneOre
mainBlock = [[0, 30, 73, 1, 1, 0], [-1, 0]] // 100% - REDSTONE ORE
function onDestroyed() {mining_xp += (25 + Math.sqrt(mining_lvl*3))*chance/2;}}
// [CACTUS] ID81 //
if (blockID == 81) {for (var i = 1; world.getBlockID(blockx, blocky + i, blockz) == 81; i++) {}
blockHP = 30+Math.sqrt(harvesting_lvl*i); blockName = "Cactus";  
randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Cloth";
btool = [70, 40, 60, 60, 30, 25, 10]; gtool = [60, 30, 40, 15, 20, 20, 40];
setChance(); chance = chance*Math.sqrt(harvesting_lvl);
dropBlock = [[0, 22+chance, 81, 1, 1, 0], [-1, 0], [-1, 0], [-1, 0], [-1, 0]]; // Cactus
mainBlock = [[-1, 0], [-1, 0]]; // NOTHING
function onDestroyed() {for (var i = 1; world.getBlockID(blockx, blocky + i, blockz) == 81; i++) 
{var rand = Math.floor(Math.random() * randMax);
if (rand > dropBlock [0] [0] && rand < dropBlock [0] [1]) 
{player.dropItem(Item(dropBlock [0] [2], 1, dropBlock [0] [5])); 
itemSearch = player.getEntitiesWithinRange(0.5); for (var ii = 0; ii < itemSearch.length; ii++) 
{var ent1 = itemSearch[ii]; if (ent1.getClassType() == "Item") 
{ent1 = ent1.setPosition(hitBlock.x + 0.5,hitBlock.y + 0.5 + i,hitBlock.z + 0.5);}}}}
harvesting_xp += (1 + i/2 + Math.sqrt(harvesting_lvl*3))*chance/2;}}
// [CLAY] ID82 //
if (blockID == 82 && tool[4] != 0) {blockHP = 22+Math.sqrt(digging_lvl); blockName = "Clay";  
randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Gravel";
btool = [10, 10, 20, 20, 80, 10, 40]; gtool = [10, 10, 15, 15, 90, 10, 70];
setChance(); chance = chance*Math.sqrt(digging_lvl);
dropBlock = [[0, 22+chance, 337, 3, 5, 0], [-1, 0], [-1, 0], [-1, 0], [-1, 0]]; // 3-5 Clay
mainBlock = [[0, 30, 337, 4, 4, 0], [-1, 0]] // 100% - 4 CLAY
function onDestroyed() {digging_xp += (2 + Math.sqrt(digging_lvl))*chance/2;}}
// [SUGAR CANES] ID83 //
if (blockID == 83) {for (var i = 1; world.getBlockID(blockx, blocky + i, blockz) == 83; i++) {}
blockHP = 15+Math.sqrt(gardening_lvl*i); blockName = "Sugar Canes";  
randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Grass";
btool = [70, 50, 60, 40, 15, 20, 40]; gtool = [50, 70, 40, 15, 20, 15, 60];
setChance(); chance = chance*Math.sqrt(gardening_lvl/2+harvesting_lvl/2);
dropBlock = [[0, 16+chance, 338, 1, 1, 0], [-1, 0], [-1, 0], [-1, 0], [-1, 0]]; // Sugar canes
mainBlock = [[-1, 0], [-1, 0]]; // NOTHING
function onDestroyed() {for (var i = 1; world.getBlockID(blockx, blocky + i, blockz) == 83; i++) 
{var rand = Math.floor(Math.random() * randMax);
if (rand > dropBlock [0] [0] && rand < dropBlock [0] [1]) 
{player.dropItem(Item(dropBlock [0] [2], 1, dropBlock [0] [5])); 
itemSearch = player.getEntitiesWithinRange(0.5); for (var ii = 0; ii < itemSearch.length; ii++) 
{var ent1 = itemSearch[ii]; if (ent1.getClassType() == "Item") 
{ent1 = ent1.setPosition(hitBlock.x + 0.5,hitBlock.y + 0.5 + i,hitBlock.z + 0.5);}}}}
harvesting_xp += (1 + i/2 + Math.sqrt(harvesting_lvl*3))*chance/2;}}
// [FLOWERS] ID207 //
if (blockID == 207) {randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Grass";
btool = [60, 80, 35, 40, 30, 20, 40]; gtool = [30, 70, 15, 5, 20, 15, 60];
setChance(); chance = chance*Math.sqrt(gardening_lvl/2+harvesting_lvl/2);
dropBlock = [[0, 18+chance, 207, 1, 1, blockMD], [25-chance, 28, 2020, 1, 1, 0], [-1, 0], [-1, 0], [-1, 0]]; // Flower
mainBlock = [[-1, 0], [-1, 0]]; // NOTHING
if (blockMD == 0) {blockHP = 25; blockName = "Bloom of gold"; harvesting = 5; dropBlock [0] [1] = 12+chance;}
if (blockMD == 1) {blockHP = 15; blockName = "Butter Leaves"; harvesting = 2; dropBlock [0] [1] = 18+chance;}
if (blockMD == 2) {blockHP = 20; blockName = "Poison Bell"; harvesting = 3; dropBlock [0] [1] = 16+chance;}
if (blockMD == 3) {blockHP = 20; blockName = "Sunpot Breeze"; harvesting = 3; dropBlock [0] [1] = 17+chance;}
if (blockMD == 4) {blockHP = 20; blockName = "Spiked Skull"; harvesting = 4; dropBlock [0] [1] = 15+chance;}
if (blockMD == 5) {blockHP = 20; blockName = "Ice root bloom"; harvesting = 3; dropBlock [0] [1] = 14+chance;}
if (blockMD == 6) {blockHP = 25; blockName = "Nether's Curse"; harvesting = 5; dropBlock [0] [1] = 15+chance;}
if (blockMD == 7) {blockHP = 15; blockName = "Bulky Fungus"; harvesting = 3; dropBlock [0] [1] = 10+chance;}
if (blockMD == 8) {blockHP = 20; blockName = "Desert Rose"; harvesting = 4; dropBlock [0] [1] = 17+chance;}
if (blockMD == 9) {blockHP = 10; blockName = "Small Amethins"; harvesting = 2; dropBlock [0] [1] = 12+chance;}
if (blockMD == 10) {blockHP = 10; blockName = "Light Circles"; harvesting = 2; dropBlock [0] [1] = 12+chance;}
if (blockMD == 11) {blockHP = 15; blockName = "Soft Claws"; harvesting = 3; dropBlock [0] [1] = 15+chance;}
if (blockMD == 12) {blockHP = 12; blockName = "Darely Rose"; harvesting = 2; dropBlock [0] [1] = 13+chance;}
if (blockMD == 13) {blockHP = 15; blockName = "Dynamo Mystic"; harvesting = 3; dropBlock [0] [1] = 12+chance;}
if (blockMD == 14) {blockHP = 30; blockName = "Star of Aether"; harvesting = 5; dropBlock [0] [1] = 18+chance;}
if (blockMD == 15) {blockHP = 25; blockName = "Cups of Stump"; harvesting = 3; dropBlock [0] [1] = 8+chance;}
function onDestroyed() {harvesting_xp += (harvesting/1.5 + Math.sqrt(harvesting_lvl*harvesting)/3)*chance/2;}}
// [FISHING NET] ID209 MD2 //
if (blockID == 209 && blockMD == 2 && tool[4] != 0) {blockHP = 16; blockName = "Fishing Net";  
randMax = 30; changeTo = [0, 0]; upper_block = 0; soundType = "Cloth";
btool = [40, 30, 25, 20, 20, 20, 60]; gtool = [10, 20, 10, 30, 20, 20, 80];
setChance(); chance = chance*Math.sqrt(fishing_lvl + crafting_lvl/4);
dropBlock = [[0, 24+chance, 2008, 1, 1, 0], [24-chance, 30, 287, 1, 9, 0], 
[-1, 0], [-1, 0], [-1, 0]]; // Fishing Net, Strings
mainBlock = [[-1, 0], [-1, 0]] // NOTHING
function onDestroyed() {world.setBlockID(hitBlock.x,hitBlock.y,hitBlock.z,9);
for (i = 0; netA [i] != undefined && netA [i] [7] != undefined &&
(hitBlock.x != netA [i] [7] [0] || hitBlock.y != netA [i] [7] [1] || hitBlock.z != netA [i] [7] [2]); i++) {}
if (netA [i] != undefined && netA [i] [7] != undefined  && netA [i] [8] != 0) 
{pinv.addItem(Item(netA [i] [8],1)); fishing_xp += netA [i] [9];}
fishing_xp += 0.05; netA [i] = [false, 0, 0, 0, false, false, 0, 0, 0, 0, 0];}}
// [DIRT] ID2 ID3 //
if ((blockID == 2 || blockID == 3) && itemID == 2086) {blockHP = 20+gardening_lvl*blockID/2; blockName = "Ploughing Dirt";  
randMax = 30; changeTo = [60, 0]; upper_block = 0; soundType = "Dirt";
btool = [10, 30, 50, 40, 70, 20, 40]; gtool = [20, 40, 20, 20, 60, 15, 60];
setChance(); chance = chance*Math.sqrt(gardening_lvl + digging_lvl/3);
dropBlock = [[0, 9+chance, 295, 1, 1, 0], [-1, 0], [-1, 0], [-1, 0], [-1, 0]]; // Seeds
mainBlock = [[-1, 0], [-1, 0]]; // NOTHING
function onDestroyed() {gardening_xp += (1+Math.sqrt(gardening_lvl*blockID))*chance/2;}}
// [UPPER DETECTION] //
var blockID = world.getBlockID(hitBlock.x,hitBlock.y+1,hitBlock.z);
var blockMD = world.getMetadata(hitBlock.x,hitBlock.y+1,hitBlock.z);
// [DEAD FLOWER] ID208 MD1 //
if (blockID == 208 && blockMD == 1) {blockHP = 20; blockName = "Dead Plant"; 
randMax = 30; changeTo = [0, 0]; upper_block = 1; soundType = "Grass";
btool = [65, 70, 40, 50, 25, 20, 45]; gtool = [30, 60, 15, 5, 20, 15, 70];
setChance(); chance = chance*Math.sqrt(gardening_lvl/3 + harvesting_lvl);
dropBlock = [[0, 20+chance, blockID, 1, 1, blockMD], [-1, 0], [-1, 0], [-1, 0], [-1, 0]]; // Flower
mainBlock = [[-1, 0], [-1, 0]]; // NOTHING
function onDestroyed() {harvesting_xp += Math.sqrt(harvesting_lvl*2)*chance/2;}}
// [FLOWER] ID232 //
if (blockID == 232) {randMax = 30; changeTo = [0, 0]; upper_block = 1; soundType = "Grass";
btool = [60, 80, 40, 40, 20, 10, 50]; gtool = [30, 60, 20, 10, 10, 10, 60];
setChance(); chance = chance*Math.sqrt(gardening_lvl/2 + harvesting_lvl/2);
dropBlock = [[0, 18+chance, 232, 1, 1, blockMD],  
[25-chance, 28, 2020, 1, 1, 0], [-1, 0], [-1, 0], [-1, 0]]; // Flower
mainBlock = [[-1, 0], [-1, 0]]; // NOTHING
if (blockMD == 0) {blockHP = 20;   	blockName = "Ocean Bell"; 		 	harvesting = 3;  dropBlock [0] [1] = 15+chance;}
if (blockMD == 1) {blockHP = 30;  	blockName = "Carrot";    			harvesting = 3;  dropBlock [0] [1] = 20+chance;}
if (blockMD == 2) {blockHP = 35;  	blockName = "Bett";               	harvesting = 4;  dropBlock [0] [1] = 20+chance;}
if (blockMD == 3) {blockHP = 20;  	blockName = "Salad";              	harvesting = 3;  dropBlock [0] [1] = 20+chance;}
if (blockMD == 4) {blockHP = 15;   	blockName = "Diamond Dust";       	harvesting = 4;  dropBlock [0] [1] = 12+chance;}
if (blockMD == 5) {blockHP = 20; 	blockName = "Pearly Bush";        	harvesting = 4;  dropBlock [0] [1] = 15+chance;}
if (blockMD == 6) {blockHP = 25;  	blockName = "Pillow Curls";       	harvesting = 5;  dropBlock [0] [1] = 16+chance;}
if (blockMD == 7) {blockHP = 30; 	blockName = "White Eye Bloom";    	harvesting = 5;  dropBlock [0] [1] = 18+chance;}
if (blockMD == 8) {blockHP = 10;   	blockName = "Pink Drops";         	harvesting = 3;  dropBlock [0] [1] = 12+chance;}
if (blockMD == 9) {blockHP = 25;  	blockName = "Pink King's Flower"; 	harvesting = 5;  dropBlock [0] [1] = 18+chance;}
if (blockMD == 10) {blockHP = 10;  	blockName = "Orange Smily"; 		harvesting = 2;  dropBlock [0] [1] = 15+chance;}
if (blockMD == 11) {blockHP = 20; 	blockName = "Prince of Lions"; 	 	harvesting = 4;  dropBlock [0] [1] = 16+chance;}
if (blockMD == 12) {blockHP = 15;  	blockName = "Sadness Bells";		harvesting = 3;  dropBlock [0] [1] = 14+chance;}
if (blockMD == 13) {blockHP = 15;  	blockName = "Cosmos Bloom"; 		harvesting = 4;  dropBlock [0] [1] = 13+chance;}
if (blockMD == 14) {blockHP = 12;  	blockName = "Purple Crystals"; 	 	harvesting = 2;  dropBlock [0] [1] = 12+chance;}
if (blockMD == 15) {blockHP = 40; 	blockName = "Mystic Bush"; 		 	harvesting = 4;  dropBlock [0] [1] = 20+chance;}
function onDestroyed() {harvesting_xp += (harvesting/1.5 + Math.sqrt(harvesting_lvl*harvesting)/3)*chance/2;}} 

bnArray = ""; i = hitBlock.x; if (i < 1000 && i > -1000) {if (i < 100 && i > -100) {if (i < 10 && i > -10) 
{bnArray += "000" + i;} else {bnArray += "00" + i;}} else {bnArray += "0" + i;}} else {bnArray += i;} i = hitBlock.y;
if (i < 1000 && i > -1000) {if (i < 100 && i > -100) {if (i < 10 && i > -10) 
{bnArray += "000" + i;} else {bnArray += "00" + i;}} else {bnArray += "0" + i;}} else {bnArray += i;} i = hitBlock.z;
if (i < 1000 && i > -1000) {if (i < 100 && i > -100) {if (i < 10 && i > -10) {bnArray += "000" + i;} 
else {bnArray += "00" + i;}} else {bnArray += "0" + i;}} else {bnArray += i;}
if (blockArray [bnArray] != undefined && mainBlock [0] [0] != -1) 
{chance = 0.50; dropBlock = mainBlock;} blockMaxHP = blockHP;}

else {if (blockID == 206 && blockMD == 8) {} else {cPower = 0; for (i = 0; tool [i] != undefined; i++) 
{cPower += power*(tool[i]*btool[i])/25000;} blockHP = Math.max(blockHP-cPower,0);
if (cPower != 0) {if (itemID == 468 && Math.random()*2/(cPower+timing/10) > 1) 
{pHealth -= 1+Math.sqrt(blockHP/5)/(cPower+1); player.attackEntityFrom(player, 1);} else {timing = 0;}}
sound.playSound3D("sound." + soundType + "Kill", hitBlock.x + 0.5, hitBlock.y + 0.5, hitBlock.z + 0.5);
if (ent.damage < maxDamage) {ent.damage += damageGet;} 
else {pinv.consumeItemAmount(itemID,maxDamage,1); chat.print(breakSpeech); sound.playSoundUI("sound.break");}}

if (blockHP == 0 && blockMaxHP > 0) 
{var rand = Math.floor(Math.random() * randMax);
for (i = 0; dropBlock [i] != undefined && dropBlock [i] [0] != -1; i++) {
	if (rand > dropBlock [i] [0] && rand < dropBlock [i] [1]) {
		j = dropBlock [i] [3] + Math.random() * (dropBlock [i] [4] - dropBlock [i] [3])
		for (k = 0; k < j; k++) {player.dropItem(Item(dropBlock [i] [2], 1, dropBlock [i] [5]));}
	}
}
itemSearch = player.getEntitiesWithinRange(0.5);
for (var i = 0; i < itemSearch.length; i++) {var ent1 = itemSearch[i]; if (ent1.getClassType() == "Item") 
{ii = 0.5; if (changeTo [0] != 0) {ii = 1.2} ent1 = ent1.setPosition(hitBlock.x + ii,hitBlock.y + ii,hitBlock.z + ii);}}
onDestroyed(); world.setBlockIDAndMetadata(hitBlock.x,hitBlock.y+upper_block,hitBlock.z,changeTo[0],changeTo[1]);
if (itemID == 468) {unarmed_xp += (blockMaxHP/6+Math.sqrt(unarmed_lvl*1.5))*chance/2;} blocksDestroyed++;
blockHP = 0; blockMaxHP = 0; blockx = 0; blocky = 0; blockz = 0; blockDestroyed = blockID;
sound.playSound3D("sound." + soundType + "Gone", hitBlock.x + 0.5, hitBlock.y + 0.5, hitBlock.z + 0.5);}}}