PocketMine-MP 5.15.1 git-5ef247620a7c6301a849b54e5ef1009217729fc8
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
28use function mt_rand;
29
30class Zombie extends Living{
31
32 public static function getNetworkTypeId() : string{ return EntityIds::ZOMBIE; }
33
34 protected function getInitialSizeInfo() : EntitySizeInfo{
35 return new EntitySizeInfo(1.8, 0.6); //TODO: eye height ??
36 }
37
38 public function getName() : string{
39 return "Zombie";
40 }
41
42 public function getDrops() : array{
43 $drops = [
44 VanillaItems::ROTTEN_FLESH()->setCount(mt_rand(0, 2))
45 ];
46
47 if(mt_rand(0, 199) < 5){
48 switch(mt_rand(0, 2)){
49 case 0:
50 $drops[] = VanillaItems::IRON_INGOT();
51 break;
52 case 1:
53 $drops[] = VanillaItems::CARROT();
54 break;
55 case 2:
56 $drops[] = VanillaItems::POTATO();
57 break;
58 }
59 }
60
61 return $drops;
62 }
63
64 public function getXpDropAmount() : int{
65 //TODO: check for equipment and whether it's a baby
66 return 5;
67 }
68}