/***Epée Kokiri, utilisée pour casser les pots ou hautes herbes***/

if (hitBlock != null) 
{
	if(world.getBlockID(hitBlock.x,hitBlock.y,hitBlock.z) == 31) // Si c'est une haute herbe
	{
		world.setBlockID(hitBlock.x,hitBlock.y,hitBlock.z,0);
		sound.playSound3D("sound.bush",hitBlock.x,hitBlock.y,hitBlock.z); // Coupe l'herbe et joue un son
		
		var rand = Math.floor(Math.random() *38); // Sélection des objets à looter
		switch (rand) 
		{
		case 0:
			player.dropItem(Item(262)); // Flèche
		case 1:
			player.dropItem(Item(289)); // Mana
		case 2:
		case 3:
		case 4:
		case 5:
		case 6:
	
		case 7:
			player.dropItem(Item(266)); // Rubis vert
			break;
		case 8:
			player.dropItem(Item(264)); // Rubis bleu
			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 + 0.5, hitBlock.z + 0.5);
			}   
		}
	}
	
	if(world.getBlockID(hitBlock.x,hitBlock.y,hitBlock.z) == 207 && world.getMetadata(hitBlock.x,hitBlock.y,hitBlock.z) == 11) // Si c'est un pot
	{
		world.setBlockID(hitBlock.x,hitBlock.y,hitBlock.z,0);
		sound.playSound3D("sound.pot_shatter",hitBlock.x,hitBlock.y,hitBlock.z); // Détruit le pot et joue un son
		
		var rand = Math.floor(Math.random() *10); // Sélection des objets à looter
		switch (rand) 
		{
		case 0:
		case 1:
			player.dropItem(Item(262)); // Flèche
			player.dropItem(Item(262));
			player.dropItem(Item(262));
			player.dropItem(Item(262));
			player.dropItem(Item(262));
			break;
		case 2:
		case 3:
			player.dropItem(Item(289)); // Mana
			player.dropItem(Item(289));
			player.dropItem(Item(289));
			player.dropItem(Item(289));
			player.dropItem(Item(289));
			break;
		case 4:
		case 5:
		case 6:	
		case 7:
			player.dropItem(Item(266)); // Rubis vert
			break;
		case 8:
			player.dropItem(Item(264)); // Rubis bleu
			break; 
		case 9 :
			player.dropItem(Item(266));
			player.dropItem(Item(266));
			player.dropItem(Item(266));
			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 + 0.5, hitBlock.z + 0.5);
			}   
		}
	}
}/***Epée kokiri, script exécuté lorsqu'on casse un pot***/

if (hitBlock != null) 
{
	if(world.getBlockID(hitBlock.x,hitBlock.y,hitBlock.z) == 31) // Si c'est un pot
	{
		world.setBlockID(hitBlock.x,hitBlock.y,hitBlock.z,0);
		sound.playSound3D("sound.bush",hitBlock.x,hitBlock.y,hitBlock.z);
		
		var rand = Math.floor(Math.random() *38);
		switch (rand) 
		{
		case 0:
			player.dropItem(Item(262)); // Flèche
		case 1:
			player.dropItem(Item(289)); // Mana
		case 2:
		case 3:
		case 4:
		case 5:
		case 6:
	
		case 7:
			player.dropItem(Item(266)); // Rubis vert
			break;
		case 8:
			player.dropItem(Item(264)); // Rubis bleu
			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 + 0.5, hitBlock.z + 0.5);
			}   
		}
	}
}