mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-20 15:41:33 +00:00
Drop experience on death
This commit is contained in:
@@ -510,7 +510,9 @@ abstract class Living extends Entity implements Damageable{
|
||||
$this->deadTicks += $tickDiff;
|
||||
if($this->deadTicks >= $this->maxDeadTicks){
|
||||
$this->endDeathAnimation();
|
||||
//TODO: spawn experience orbs here
|
||||
|
||||
//TODO: check death conditions (must have been damaged by player < 5 seconds from death)
|
||||
$this->level->dropExperience($this, $this->getXpDropAmount());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -660,6 +662,14 @@ abstract class Living extends Entity implements Damageable{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the amount of XP this mob will drop on death.
|
||||
* @return int
|
||||
*/
|
||||
public function getXpDropAmount() : int{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $maxDistance
|
||||
* @param int $maxLength
|
||||
|
@@ -57,4 +57,9 @@ class Zombie extends Monster{
|
||||
|
||||
return $drops;
|
||||
}
|
||||
|
||||
public function getXpDropAmount() : int{
|
||||
//TODO: check for equipment and whether it's a baby
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user