Altay icon indicating copy to clipboard operation
Altay copied to clipboard

Vanilla implementation of the walking mobs

Open yoraze opened this issue 4 years ago • 0 comments

Description

Did you notice that mobs load the server very much? Vanilla servers deal with this problem like this: if there are no players next to the mob, the mob does not move until the players approach it.

Justification

This should significantly reduce the load on the server.

Alternative methods

Some check is required to see if there are any players nearby. If there are more than 0, the mob moves; if it is not, the mob does not move.

if(count($this->getViewers()) > 0){
    // Perhaps this is not correct.
    $this->onBehaviorUpdate();
}

Additionally

  • The text has been translated using Google. I hope he translated everything correctly.
  • Perhaps these changes will cause MobSpawner-> despawnMobs () to become meaningless, which will be a very good upgrade. My players really didn’t like that mobs disappear when they go far from home. :(

yoraze avatar Sep 05 '19 18:09 yoraze