PocketMine-MP
5.21.2 git-b2aa6396c3cc2cafdd815eacc360e1ad89599899
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\VanillaItems
;
27
use
pocketmine\network\mcpe\protocol\types\entity\EntityIds
;
28
use
function
mt_rand;
29
30
class
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
}
pocketmine\entity\EntitySizeInfo
Definition
EntitySizeInfo.php:28
pocketmine\entity\Living
Definition
Living.php:82
pocketmine\entity\Zombie
Definition
Zombie.php:30
pocketmine\entity\Zombie\getDrops
getDrops()
Definition
Zombie.php:42
pocketmine\entity\Zombie\getXpDropAmount
getXpDropAmount()
Definition
Zombie.php:64
pocketmine\item\VanillaItems
Definition
VanillaItems.php:335
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