Added Error -> Exception handling

This commit is contained in:
Shoghi Cervantes
2014-10-28 20:43:36 +01:00
parent 0fce83c671
commit b6f7ee20fc
11 changed files with 114 additions and 76 deletions

View File

@ -23,7 +23,7 @@ namespace pocketmine\entity;
use pocketmine\event\entity\EntityDamageByEntityEvent;
use pocketmine\item\Item;
use pocketmine\item\Item as ItemItem;
use pocketmine\nbt\tag\String;
use pocketmine\network\protocol\AddMobPacket;
use pocketmine\network\protocol\SetEntityMotionPacket;
@ -83,19 +83,19 @@ class Zombie extends Monster{
public function getDrops(){
$drops = [
Item::get(Item::FEATHER, 0, 1)
ItemItem::get(Item::FEATHER, 0, 1)
];
if($this->lastDamageCause instanceof EntityDamageByEntityEvent and $this->lastDamageCause->getEntity() instanceof Player){
if(mt_rand(0, 199) < 5){
switch(mt_rand(0, 2)){
case 0:
$drops[] = Item::get(Item::IRON_INGOT, 0, 1);
$drops[] = ItemItem::get(ItemItem::IRON_INGOT, 0, 1);
break;
case 1:
$drops[] = Item::get(Item::CARROT, 0, 1);
$drops[] = ItemItem::get(ItemItem::CARROT, 0, 1);
break;
case 2:
$drops[] = Item::get(Item::POTATO, 0, 1);
$drops[] = ItemItem::get(ItemItem::POTATO, 0, 1);
break;
}
}