mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-19 15:35:52 +00:00
Limited death animation to Living entities
This commit is contained in:
parent
04ecbd1a76
commit
ea8f10efa4
@ -528,16 +528,13 @@ abstract class Entity extends Location implements Metadatable{
|
||||
$isPlayer = $this instanceof Player;
|
||||
|
||||
if($this->dead === true){
|
||||
++$this->deadTicks;
|
||||
if($this->deadTicks >= 10){
|
||||
$this->despawnFromAll();
|
||||
if(!$isPlayer){
|
||||
$this->close();
|
||||
}
|
||||
$this->despawnFromAll();
|
||||
if(!$isPlayer){
|
||||
$this->close();
|
||||
}
|
||||
|
||||
Timings::$tickEntityTimer->stopTiming();
|
||||
return $this->deadTicks < 10;
|
||||
return false;
|
||||
}
|
||||
|
||||
$hasUpdate = false;
|
||||
|
@ -32,6 +32,7 @@ use pocketmine\item\Item as ItemItem;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\nbt\tag\Short;
|
||||
use pocketmine\network\protocol\EntityEventPacket;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\Server;
|
||||
use pocketmine\utils\BlockIterator;
|
||||
|
||||
@ -150,6 +151,20 @@ abstract class Living extends Entity implements Damageable{
|
||||
|
||||
public function entityBaseTick($tickDiff = 1){
|
||||
Timings::$timerEntityBaseTick->startTiming();
|
||||
|
||||
if($this->dead === true){
|
||||
++$this->deadTicks;
|
||||
if($this->deadTicks >= 10){
|
||||
$this->despawnFromAll();
|
||||
if(!($this instanceof Player)){
|
||||
$this->close();
|
||||
}
|
||||
}
|
||||
|
||||
Timings::$timerEntityBaseTick->stopTiming();
|
||||
return $this->deadTicks < 10;
|
||||
}
|
||||
|
||||
parent::entityBaseTick($tickDiff);
|
||||
|
||||
if($this->dead !== true and $this->isInsideOfSolid()){
|
||||
|
Loading…
x
Reference in New Issue
Block a user