/***Script utilisé lorsqu'on utilise la pelle***/

if (hitBlock != null && world.getMetadata(hitBlock.x, hitBlock.y, hitBlock.z) == 1 && world.getBlockID(hitBlock.x, hitBlock.y, hitBlock.z) == 2) {
    player.swingMainHand();
	world.setBlockIDAndMetadata(hitBlock.x, hitBlock.y, hitBlock.z, 2, 0);
	sound.playSound3D("sound.shovel",hitBlock.x,hitBlock.y,hitBlock.z);
    var rand = Math.floor(Math.random() * 20);
    switch (rand) {
	case 0 :
		player.dropItem(Item(266)); // Rubis vert
	case 1 :
	case 2 : 
		player.dropItem(Item(266));
	case 3 :
	case 4 :
		player.dropItem(Item(266));
		break;
	case 5 :
		player.dropItem(Item(266));
		break;
	case 6 :
		player.dropItem(Item(266));
		break;
	case 7 :
	case 8 :
	case 9 :
		player.dropItem(Item(262, 5)); // Flèche
		break;
	case 10 :
	case 11 :
	case 12 :
		player.dropItem(Item(289, 3)); // Mana
		break;
	case 13 :
	case 14 : 
		player.dropItem(Item(264)); // Rubis bleu
		break;
	case 15 :
		player.dropItem(Item(265)); // Rubis jaune
		break;
    }
    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 + 1.5, hitBlock.z + 0.5);
}   }   }

if (hitBlock != null && world.getMetadata(hitBlock.x, hitBlock.y, hitBlock.z) == 2 && world.getBlockID(hitBlock.x, hitBlock.y, hitBlock.z) == 2) {
    player.swingMainHand();
	world.setBlockIDAndMetadata(hitBlock.x, hitBlock.y, hitBlock.z, 2, 0);
	sound.playSound3D("sound.shovel",hitBlock.x,hitBlock.y,hitBlock.z);
 {
        player.dropItem(Item(469));// Quart de coeur
    }
    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 + 1.5, hitBlock.z + 0.5);
}   }   }