mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Merge branch 'stable' into minor-next
This commit is contained in:
commit
fba51e3bf9
@ -519,7 +519,12 @@ abstract class Entity{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function attack(EntityDamageEvent $source) : void{
|
public function attack(EntityDamageEvent $source) : void{
|
||||||
if($this->isFireProof() && ($source->getCause() === EntityDamageEvent::CAUSE_FIRE || $source->getCause() === EntityDamageEvent::CAUSE_FIRE_TICK)){
|
if($this->isFireProof() && (
|
||||||
|
$source->getCause() === EntityDamageEvent::CAUSE_FIRE ||
|
||||||
|
$source->getCause() === EntityDamageEvent::CAUSE_FIRE_TICK ||
|
||||||
|
$source->getCause() === EntityDamageEvent::CAUSE_LAVA
|
||||||
|
)
|
||||||
|
){
|
||||||
$source->cancel();
|
$source->cancel();
|
||||||
}
|
}
|
||||||
$source->call();
|
$source->call();
|
||||||
@ -686,8 +691,10 @@ abstract class Entity{
|
|||||||
if($fireTicks < 0 || $fireTicks > 0x7fff){
|
if($fireTicks < 0 || $fireTicks > 0x7fff){
|
||||||
throw new \InvalidArgumentException("Fire ticks must be in range 0 ... " . 0x7fff . ", got $fireTicks");
|
throw new \InvalidArgumentException("Fire ticks must be in range 0 ... " . 0x7fff . ", got $fireTicks");
|
||||||
}
|
}
|
||||||
$this->fireTicks = $fireTicks;
|
if(!$this->isFireProof()){
|
||||||
$this->networkPropertiesDirty = true;
|
$this->fireTicks = $fireTicks;
|
||||||
|
$this->networkPropertiesDirty = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function extinguish() : void{
|
public function extinguish() : void{
|
||||||
@ -700,12 +707,13 @@ abstract class Entity{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function doOnFireTick(int $tickDiff = 1) : bool{
|
protected function doOnFireTick(int $tickDiff = 1) : bool{
|
||||||
if($this->isFireProof() && $this->fireTicks > 1){
|
if($this->isFireProof() && $this->isOnFire()){
|
||||||
$this->fireTicks = 1;
|
$this->extinguish();
|
||||||
}else{
|
return false;
|
||||||
$this->fireTicks -= $tickDiff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->fireTicks -= $tickDiff;
|
||||||
|
|
||||||
if(($this->fireTicks % 20 === 0) || $tickDiff > 20){
|
if(($this->fireTicks % 20 === 0) || $tickDiff > 20){
|
||||||
$this->dealFireDamage();
|
$this->dealFireDamage();
|
||||||
}
|
}
|
||||||
|
@ -507,7 +507,7 @@ abstract class Living extends Entity{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function attack(EntityDamageEvent $source) : void{
|
public function attack(EntityDamageEvent $source) : void{
|
||||||
if($this->noDamageTicks > 0){
|
if($this->noDamageTicks > 0 && $source->getCause() !== EntityDamageEvent::CAUSE_SUICIDE){
|
||||||
$source->cancel();
|
$source->cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1199,10 +1199,6 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
|||||||
return !$this->gamemode->equals(GameMode::CREATIVE());
|
return !$this->gamemode->equals(GameMode::CREATIVE());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isFireProof() : bool{
|
|
||||||
return $this->isCreative();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDrops() : array{
|
public function getDrops() : array{
|
||||||
if($this->hasFiniteResources()){
|
if($this->hasFiniteResources()){
|
||||||
return parent::getDrops();
|
return parent::getDrops();
|
||||||
@ -1440,6 +1436,10 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
|||||||
$this->entityBaseTick($tickDiff);
|
$this->entityBaseTick($tickDiff);
|
||||||
Timings::$entityBaseTick->stopTiming();
|
Timings::$entityBaseTick->stopTiming();
|
||||||
|
|
||||||
|
if($this->isCreative() && $this->fireTicks > 1){
|
||||||
|
$this->fireTicks = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if(!$this->isSpectator() && $this->isAlive()){
|
if(!$this->isSpectator() && $this->isAlive()){
|
||||||
Timings::$playerCheckNearEntities->startTiming();
|
Timings::$playerCheckNearEntities->startTiming();
|
||||||
$this->checkNearEntities();
|
$this->checkNearEntities();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user