minecraft:despawn

Dynamic value

Properties

This component has no properties in the official schema: add it as an empty object {} to switch the behaviour on.

Example from the game files

This is how vanilla Piglin Brute uses it in Minecraft Bedrock 1.26.60.5:

{
  "minecraft:despawn": {
    "filters": {
      "any_of": [
        {
          "all_of": [
            {
              "test": "is_persistent",
              "value": false
            },
            {
              "operator": ">",
              "test": "distance_to_nearest_player",
              "value": 54
            }
          ]
        },
        {
          "all_of": [
            {
              "test": "is_persistent",
              "value": false
            },
            {
              "subject": "self",
              "test": "inactivity_timer",
              "value": 30
            },
            {
              "test": "random_chance",
              "value": 800
            },
            {
              "operator": ">",
              "test": "distance_to_nearest_player",
              "value": 32
            }
          ]
        }
      ]
    }
  }
}

Used by 76

Vanilla entities with minecraft:despawn in their definition:

Related components