PocketMine-MP 5.21.2 git-a6534ecbbbcf369264567d27e5ed70f7f5be9816
Loading...
Searching...
No Matches
Zombie.php
1<?php
2
3/*
4 *
5 * ____ _ _ __ __ _ __ __ ____
6 * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
7 * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
8 * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
9 * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
10 *
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * @author PocketMine Team
17 * @link http://www.pocketmine.net/
18 *
19 *
20 */
21
22declare(strict_types=1);
23
24namespace pocketmine\entity;
25
29use function mt_rand;
30
31class Zombie extends Living{
32
33 public function getNetworkTypeId() : string{ return EntityIds::ZOMBIE; }
34
35 protected function getInitialSizeInfo() : EntitySizeInfo{
36 return new EntitySizeInfo(1.8, 0.6); //TODO: eye height ??
37 }
38
39 public function getName() : string{
40 return "Zombie";
41 }
42
43 public function getDrops() : array{
44 $drops = [
45 VanillaItems::ROTTEN_FLESH()->setCount(mt_rand(0, 2))
46 ];
47
48 if(mt_rand(0, 199) < 5){
49 switch(mt_rand(0, 2)){
50 case 0:
51 $drops[] = VanillaItems::IRON_INGOT();
52 break;
53 case 1:
54 $drops[] = VanillaItems::CARROT();
55 break;
56 case 2:
57 $drops[] = VanillaItems::POTATO();
58 break;
59 }
60 }
61
62 return $drops;
63 }
64
65 public function getXpDropAmount() : int{
66 //TODO: check for equipment and whether it's a baby
67 return 5;
68 }
69
70 public function getPickedItem() : ?Item{
71 return VanillaItems::ZOMBIE_SPAWN_EGG();
72 }
73}