Living: Get rid of delayed XP spawning, closes #2644

This is not identical to vanilla, but I don't care because it gets rid of edge cases and also makes it easier to integrate with EntityDeathEvent in the future.
This commit is contained in:
Dylan K. Taylor 2019-01-23 12:31:05 +00:00
parent 5a8812b1dc
commit e6d1c1dfbc

View File

@ -644,6 +644,10 @@ abstract class Living extends Entity implements Damageable{
foreach($ev->getDrops() as $item){
$this->getLevel()->dropItem($this, $item);
}
//TODO: check death conditions (must have been damaged by player < 5 seconds from death)
//TODO: allow this number to be manipulated during EntityDeathEvent
$this->level->dropExperience($this, $this->getXpDropAmount());
}
protected function onDeathUpdate(int $tickDiff) : bool{
@ -651,9 +655,6 @@ abstract class Living extends Entity implements Damageable{
$this->deadTicks += $tickDiff;
if($this->deadTicks >= $this->maxDeadTicks){
$this->endDeathAnimation();
//TODO: check death conditions (must have been damaged by player < 5 seconds from death)
$this->level->dropExperience($this, $this->getXpDropAmount());
}
}