Entity Documentation - minecraft:despawn
minecraft:despawn
compels an entity despawn when the despawn rules or optional filters evaluate to true.
Parameters
Name | Default Value | Type | Description |
---|---|---|---|
despawn_from_distance | not set | JSON Object | Specifies if the "min_distance" and "max_distance" are used in the standard despawn rules. |
despawn_from_chance | true | Boolean | Determines if "min_range_random_chance" is used in the standard despawn rules. |
despawn_from_inactivity | true | Boolean | Determines if the "min_range_inactivity_timer" is used in the standard despawn rules. |
despawn_from_simulation_edge | true | Boolean | Determines if the mob is instantly despawned at the edge of simulation distance in the standard despawn rules. |
filters | not set | Minecraft Filter | The list of conditions that must be satisfied before the entity is despawned. If a filter is defined then standard despawn rules are ignored. |
min_range_inactivity_timer | 30 | Integer | The amount of time in seconds that the mob must be inactive. |
min_range_random_chance | 800 | Integer | A random chance between 1 and the given value. |
remove_child_entities | false | Boolean | If true, all entities linked to this entity in a child relationship (eg. leashed) will also be despawned. |
despawn_from_distance
despawn_from_distance
is a JSON Object that is defined by 2 parameters. Each item has the following properties:
Name | Default Value | Type | Description |
---|---|---|---|
max_distance | 128 | Integer | Maximum distance for standard despawn rules to instantly despawn the mob. |
min_distance | 32 | Integer | Minimum distance for standard despawn rules to try to despawn the mob. |
Example
"minecraft:despawn":{
"despawn_from_distance": {
"max_distance": 128,
"min_distance": 32
},
"despawn_from_chance": false,
"despawn_from_inactivity": false,
"despawn_from_simulation_edge": true,
"min_range_inactivity_timer": 30 ,
"min_range_random_chance": 800,
"remove_child_entities": false,
"filters":{"test": "has_damage", "target": "self"}
}
Vanilla entities examples
zoglin
"minecraft:despawn": {
"filters": {
"any_of": [
{
"all_of": [
{
"test": "is_persistent",
"value": false
},
{
"test": "distance_to_nearest_player",
"operator": ">",
"value": 54
}
]
},
{
"all_of": [
{
"test": "is_persistent",
"value": false
},
{
"test": "inactivity_timer",
"subject": "self",
"value": 30
},
{
"test": "random_chance",
"value": 800
},
{
"test": "distance_to_nearest_player",
"operator": ">",
"value": 32
}
]
}
]
}
}
Vanilla entities using minecraft:despawn
- axolotl
- bat
- blaze
- cat
- cave_spider
- chicken
- cow
- creeper
- dolphin
- donkey
- drowned
- enderman
- endermite
- fish
- fox
- ghast
- glow_squid
- goat
- guardian
- hoglin
- horse
- husk
- llama
- magma_cube
- mooshroom
- mule
- ocelot
- panda
- parrot
- phantom
- pig
- piglin_brute
- piglin
- pillager
- polar_bear
- pufferfish
- rabbit
- ravager
- salmon
- sheep
- silverfish
- skeleton_horse
- skeleton
- slime
- spider
- squid
- stray
- strider
- tropicalfish
- turtle
- vex
- wandering_trader
- witch
- wither_skeleton
- wolf
- zoglin
- zombie_horse
- zombie_pigman
- zombie_villager_v2
- zombie_villager
- zombie
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for