minecraft:entity_sensor

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 Armadillo uses it in Minecraft Bedrock 1.26.60.5:

{
  "minecraft:entity_sensor": {
    "subsensors": [
      {
        "event": "minecraft:no_threat_detected",
        "cooldown": 0.2,
        "range": [
          7.0,
          2.0
        ],
        "minimum_count": 0,
        "maximum_count": 0,
        "event_filters": {
          "any_of": [
            {
              "test": "is_family",
              "subject": "other",
              "value": "undead"
            },
            {
              "all_of": [
                {
                  "test": "is_family",
                  "subject": "other",
                  "value": "player"
                },
                {
                  "any_of": [
                    {
                      "test": "was_last_hurt_by",
                      "subject": "other"
                    },
                    {
                      "test": "is_sprinting",
                      "subject": "other"
                    },
                    {
                      "test": "is_riding",
                      "subject": "other"
                    }
                  ]
                }
              ]
            }
          ]
        }
      },
      {
        "event": "minecraft:threat_detected",
        "cooldown": 0.2,
        "range": [
          7.0,
          2.0
        ],
        "minimum_count": 1,
        "event_filters": {
          "any_of": [
            {
              "test": "is_family",
              "subject": "other",
              "value": "undead"
            },
            {
              "all_of": [
                {
                  "test": "is_family",
                  "subject": "other",
                  "value": "player"
                },
                {
                  "any_of": [
                    {
                      "test": "was_last_hurt_by",
                      "subject": "other"
                    },
                    {
                      "test": "is_sprinting",
                      "subject": "other"
                    },
                    {
                      "test": "is_riding",
                      "subject": "other"
                    }
                  ]
                }
              ]
            }
          ]
        }
      }
    ]
  }
}

Used by 4

Vanilla entities with minecraft:entity_sensor in their definition:

Related components