diff --git a/src/entity/Entity.php b/src/entity/Entity.php index a9fcba9f16..2af2883f73 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -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. diff --git a/src/entity/object/Painting.php b/src/entity/object/Painting.php index 3ccb6b1002..91d9a014d0 100644 --- a/src/entity/object/Painting.php +++ b/src/entity/object/Painting.php @@ -132,6 +132,10 @@ class Painting extends Entity{ } } + public function onRandomUpdate() : void{ + //NOOP + } + public function hasMovementUpdate() : bool{ return false; } diff --git a/src/world/World.php b/src/world/World.php index ef7bdf17de..398ccc7f76 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -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){