Added Villager spawn egg

This commit is contained in:
Shoghi Cervantes
2014-08-16 14:25:58 +02:00
parent c675605014
commit 52d28795fa
7 changed files with 110 additions and 30 deletions

View File

@@ -24,6 +24,7 @@
*/
namespace pocketmine\block;
use pocketmine\entity\Villager;
use pocketmine\entity\Zombie;
use pocketmine\item\Item;
use pocketmine\level\Level;
@@ -449,7 +450,7 @@ abstract class Block extends Position implements Metadatable{
[Item::CLOCK, 0],
[Item::COMPASS, 0],
[Item::MINECART, 0],
//TODO: Villager
[Item::SPAWN_EGG, Villager::NETWORK_ID],
//[Item::SPAWN_EGG, 10], //Chicken
//[Item::SPAWN_EGG, 11], //Cow
//[Item::SPAWN_EGG, 12], //Pig

View File

@@ -50,28 +50,10 @@ class TallGrass extends Flowable{
}
public function getDrops(Item $item){
$drops = [];
$possibleDrops = array(
array(Item::WHEAT_SEEDS, 0, 1),
array(Item::CARROT, 0, 1),
array(Item::POTATO, 0, 1),
array(Item::BEETROOT_SEEDS, 0, 1),
array(Item::MELON_SEEDS, 0, 1),
array(Item::PUMPKIN_SEEDS, 0, 1),
0,
0,
0,
0,
0,
0,
0,
0,
);
if(($item = $possibleDrops[mt_rand(0, count($possibleDrops) - 1)]) !== 0){
$drops[] = $item;
if(mt_rand(0, 15) === 0){
return [Item::WHEAT_SEEDS, 0, 1];
}
return $drops;
return [];
}
}