mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Fixed burning animations for fireproof entities
creative players are not technically fireproof; they just don't take any damage from fire
This commit is contained in:
parent
8414c78969
commit
763241b11f
@ -691,8 +691,10 @@ abstract class Entity{
|
||||
if($fireTicks < 0 || $fireTicks > 0x7fff){
|
||||
throw new \InvalidArgumentException("Fire ticks must be in range 0 ... " . 0x7fff . ", got $fireTicks");
|
||||
}
|
||||
$this->fireTicks = $fireTicks;
|
||||
$this->networkPropertiesDirty = true;
|
||||
if(!$this->isFireProof()){
|
||||
$this->fireTicks = $fireTicks;
|
||||
$this->networkPropertiesDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function extinguish() : void{
|
||||
@ -705,12 +707,13 @@ abstract class Entity{
|
||||
}
|
||||
|
||||
protected function doOnFireTick(int $tickDiff = 1) : bool{
|
||||
if($this->isFireProof() && $this->fireTicks > 1){
|
||||
$this->fireTicks = 1;
|
||||
}else{
|
||||
$this->fireTicks -= $tickDiff;
|
||||
if($this->isFireProof() && $this->isOnFire()){
|
||||
$this->extinguish();
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->fireTicks -= $tickDiff;
|
||||
|
||||
if(($this->fireTicks % 20 === 0) || $tickDiff > 20){
|
||||
$this->dealFireDamage();
|
||||
}
|
||||
|
@ -1195,10 +1195,6 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
return !$this->gamemode->equals(GameMode::CREATIVE());
|
||||
}
|
||||
|
||||
public function isFireProof() : bool{
|
||||
return $this->isCreative();
|
||||
}
|
||||
|
||||
public function getDrops() : array{
|
||||
if($this->hasFiniteResources()){
|
||||
return parent::getDrops();
|
||||
@ -1436,6 +1432,10 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
$this->entityBaseTick($tickDiff);
|
||||
Timings::$entityBaseTick->stopTiming();
|
||||
|
||||
if($this->isCreative() && $this->fireTicks > 1){
|
||||
$this->fireTicks = 1;
|
||||
}
|
||||
|
||||
if(!$this->isSpectator() && $this->isAlive()){
|
||||
Timings::$playerCheckNearEntities->startTiming();
|
||||
$this->checkNearEntities();
|
||||
|
Loading…
x
Reference in New Issue
Block a user