Improve painting performance

these really shouldn't hit the CPU at all considering they are simply static objects ...
This commit is contained in:
Dylan K. Taylor 2020-12-01 23:31:38 +00:00
parent 6d6f8c3c38
commit 10067c1043
3 changed files with 13 additions and 1 deletions

View File

@ -998,6 +998,14 @@ abstract class Entity{
$this->scheduleUpdate();
}
/**
* Called when a random update is performed on the chunk the entity is in. This happens when the chunk is within the
* ticking chunk range of a player (or chunk loader).
*/
public function onRandomUpdate() : void{
$this->scheduleUpdate();
}
/**
* Flags the entity as needing a movement update on the next tick. Setting this forces a movement update even if the
* entity's motion is zero. Used to trigger movement updates when blocks change near entities.

View File

@ -132,6 +132,10 @@ class Painting extends Entity{
}
}
public function onRandomUpdate() : void{
//NOOP
}
public function hasMovementUpdate() : bool{
return false;
}

View File

@ -968,7 +968,7 @@ class World implements ChunkManager{
$chunk = $this->chunks[$index];
foreach($chunk->getEntities() as $entity){
$entity->scheduleUpdate();
$entity->onRandomUpdate();
}
foreach($chunk->getSubChunks() as $Y => $subChunk){