1. Wiki
  2. /Entities
  3. /minecraft:despawn

minecraft:despawn

Don't want to write this by hand? GodCraft sets minecraft:despawn for you with a switch.Get GodCraft

Overview

minecraft:despawn is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Removes the entity from the world when the normal despawn rules or your own filters say so. Use it to clean up mobs far from players.

Fields

FieldTypeDefaultDescription
despawn_from_chanceBoolean"true"Whether the random chance rule is used.
despawn_from_distanceJSON ObjectnoneWhether the min and max player distance rule is used, with its distances.
despawn_from_inactivityBoolean"true"Whether the entity can despawn after being idle for a while.
despawn_from_simulation_edgeBoolean"true"Whether the entity vanishes right away at the edge of the simulation distance.
filtersMinecraft FilternoneYour own conditions for despawning; when set, the normal rules are skipped.
min_range_inactivity_timerInteger"30"Seconds the entity must stay idle before it can despawn.
min_range_random_chanceInteger"800"Gives a 1 in this number chance to despawn.
remove_child_entitiesBoolean"false"Also removes entities linked to this one, such as leashed mobs.

Example

Inside the components object of BP/entities/<name>.json (values are the defaults or placeholders):

BP/entities/<name>.json
{
  "minecraft:despawn": {
    "despawn_from_chance": "true",
    "despawn_from_distance": {},
    "despawn_from_inactivity": "true",
    "despawn_from_simulation_edge": "true",
    "filters": {},
    "min_range_inactivity_timer": "30",
    "min_range_random_chance": "800",
    "remove_child_entities": "false"
  }
}

We use cookies to improve your experience and analyse site traffic. Learn more