mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 02:42:58 +00:00
Added Error -> Exception handling
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user