#setRemoveWhenFarAway Distance

Discussion in 'Plugin Development' started by Smeary_Subset, Nov 12, 2023.

  1. Offline


    How far away does an entity have to be for the LivingEntity#setRemoveWhenFarAway() method to remove the entity? And does it remove it when it is far enough away from any player?
  2. Online


    @Smeary_Subset The LivingEntity#setRemoveWhenFarAway() method seems to check the persistence of the entity. I believe an entity is marked as persistent when it has certain attributes, such as a custom name. For entities not marked as persistent, I would imagine they despawn when every player on the server is outside of the server's view distance for that entity type. I believe this setting can be changed in the spigot.yml file in the world-settings.default.entity-tracking-range section, but that's just a guess. You can play around with the values a bit to test it. Note that the values are measured in blocks, not chunks like render distance.
  3. Offline


    Understood, thanks
    KarimAKL likes this.

Share This Page