mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-13 23:15:29 +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;
|
$isPlayer = $this instanceof Player;
|
||||||
|
|
||||||
if($this->dead === true){
|
if($this->dead === true){
|
||||||
++$this->deadTicks;
|
$this->despawnFromAll();
|
||||||
if($this->deadTicks >= 10){
|
if(!$isPlayer){
|
||||||
$this->despawnFromAll();
|
$this->close();
|
||||||
if(!$isPlayer){
|
|
||||||
$this->close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Timings::$tickEntityTimer->stopTiming();
|
Timings::$tickEntityTimer->stopTiming();
|
||||||
return $this->deadTicks < 10;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$hasUpdate = false;
|
$hasUpdate = false;
|
||||||
|
@ -32,6 +32,7 @@ use pocketmine\item\Item as ItemItem;
|
|||||||
use pocketmine\math\Vector3;
|
use pocketmine\math\Vector3;
|
||||||
use pocketmine\nbt\tag\Short;
|
use pocketmine\nbt\tag\Short;
|
||||||
use pocketmine\network\protocol\EntityEventPacket;
|
use pocketmine\network\protocol\EntityEventPacket;
|
||||||
|
use pocketmine\Player;
|
||||||
use pocketmine\Server;
|
use pocketmine\Server;
|
||||||
use pocketmine\utils\BlockIterator;
|
use pocketmine\utils\BlockIterator;
|
||||||
|
|
||||||
@ -150,6 +151,20 @@ abstract class Living extends Entity implements Damageable{
|
|||||||
|
|
||||||
public function entityBaseTick($tickDiff = 1){
|
public function entityBaseTick($tickDiff = 1){
|
||||||
Timings::$timerEntityBaseTick->startTiming();
|
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);
|
parent::entityBaseTick($tickDiff);
|
||||||
|
|
||||||
if($this->dead !== true and $this->isInsideOfSolid()){
|
if($this->dead !== true and $this->isInsideOfSolid()){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user