minecraft:despawn for you with a switch.Get GodCraftOverview
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
| Field | Type | Default | Description |
|---|---|---|---|
despawn_from_chance | Boolean | "true" | Whether the random chance rule is used. |
despawn_from_distance | JSON Object | none | Whether the min and max player distance rule is used, with its distances. |
despawn_from_inactivity | Boolean | "true" | Whether the entity can despawn after being idle for a while. |
despawn_from_simulation_edge | Boolean | "true" | Whether the entity vanishes right away at the edge of the simulation distance. |
filters | Minecraft Filter | none | Your own conditions for despawning; when set, the normal rules are skipped. |
min_range_inactivity_timer | Integer | "30" | Seconds the entity must stay idle before it can despawn. |
min_range_random_chance | Integer | "800" | Gives a 1 in this number chance to despawn. |
remove_child_entities | Boolean | "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"
}
}