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
22
declare(strict_types=1);
23
24
namespace
pocketmine\entity
;
25
26
use
pocketmine\item\Item
;
27
use
pocketmine\item\VanillaItems
;
28
use
pocketmine\network\mcpe\protocol\types\entity\EntityIds
;
29
use
function
mt_rand;
30
31
class
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
}
pocketmine\entity\EntitySizeInfo
Definition
EntitySizeInfo.php:28
pocketmine\entity\Living
Definition
Living.php:82
pocketmine\entity\Zombie
Definition
Zombie.php:31
pocketmine\entity\Zombie\getDrops
getDrops()
Definition
Zombie.php:43
pocketmine\entity\Zombie\getPickedItem
getPickedItem()
Definition
Zombie.php:70
pocketmine\entity\Zombie\getXpDropAmount
getXpDropAmount()
Definition
Zombie.php:65
pocketmine\item\Item
Definition
Item.php:60
pocketmine\item\VanillaItems
Definition
VanillaItems.php:338
pocketmine\network\mcpe\protocol\types\entity\EntityIds
Definition
EntityIds.php:21
pocketmine\entity
Definition
Ageable.php:24
src
entity
Zombie.php
Generated by
1.12.0