Entity: don't rebuild metadata every tick unless an associated property changed

this should improve performance back to PM3 levels.
This commit is contained in:
Dylan K. Taylor
2021-05-17 20:05:52 +01:00
parent bdce781c6d
commit 5a14c1cb89
8 changed files with 42 additions and 3 deletions

View File

@ -62,11 +62,15 @@ class PrimedTNT extends Entity implements Explosive{
throw new \InvalidArgumentException("Fuse must be in the range 0-32767");
}
$this->fuse = $fuse;
$this->networkPropertiesDirty = true;
}
public function worksUnderwater() : bool{ return $this->worksUnderwater; }
public function setWorksUnderwater(bool $worksUnderwater) : void{ $this->worksUnderwater = $worksUnderwater; }
public function setWorksUnderwater(bool $worksUnderwater) : void{
$this->worksUnderwater = $worksUnderwater;
$this->networkPropertiesDirty = true;
}
public function attack(EntityDamageEvent $source) : void{
if($source->getCause() === EntityDamageEvent::CAUSE_VOID){