mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
Merge branch '3.5'
This commit is contained in:
@ -327,7 +327,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
/** @var int */
|
||||
public $lastUpdate;
|
||||
/** @var int */
|
||||
public $fireTicks = 0;
|
||||
protected $fireTicks = 0;
|
||||
/** @var bool */
|
||||
public $canCollide = true;
|
||||
|
||||
@ -925,8 +925,8 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
|
||||
public function setOnFire(int $seconds) : void{
|
||||
$ticks = $seconds * 20;
|
||||
if($ticks > $this->fireTicks){
|
||||
$this->fireTicks = $ticks;
|
||||
if($ticks > $this->getFireTicks()){
|
||||
$this->setFireTicks($ticks);
|
||||
}
|
||||
|
||||
$this->setGenericFlag(self::DATA_FLAG_ONFIRE, true);
|
||||
@ -941,8 +941,12 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
|
||||
/**
|
||||
* @param int $fireTicks
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function setFireTicks(int $fireTicks) : void{
|
||||
if($fireTicks < 0 or $fireTicks > 0x7fff){
|
||||
throw new \InvalidArgumentException("Fire ticks must be in range 0 ... " . 0x7fff . ", got $fireTicks");
|
||||
}
|
||||
$this->fireTicks = $fireTicks;
|
||||
}
|
||||
|
||||
|
@ -314,7 +314,7 @@ abstract class Projectile extends Entity{
|
||||
|
||||
$entityHit->attack($ev);
|
||||
|
||||
if($this->fireTicks > 0){
|
||||
if($this->isOnFire()){
|
||||
$ev = new EntityCombustByEntityEvent($this, $entityHit, 5);
|
||||
$ev->call();
|
||||
if(!$ev->isCancelled()){
|
||||
|
Reference in New Issue
Block a user