minecraft:environment_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 Wolf uses it in Minecraft Bedrock 1.26.60.5:

{
  "minecraft:environment_sensor": {
    "triggers": [
      {
        "filters": {
          "all_of": [
            {
              "test": "bool_property",
              "operator": "!=",
              "domain": "minecraft:has_increased_max_health"
            },
            {
              "test": "has_component",
              "value": "minecraft:is_tamed"
            }
          ]
        },
        "event": "minecraft:increase_max_health"
      },
      {
        "filters": {
          "all_of": [
            {
              "test": "bool_property",
              "operator": "!=",
              "domain": "minecraft:is_armorable"
            },
            {
              "test": "has_component",
              "operator": "!=",
              "value": "minecraft:is_baby"
            },
            {
              "test": "has_component",
              "value": "minecraft:is_tamed"
            }
          ]
        },
        "event": "minecraft:become_armorable"
      },
      {
        "filters": {
          "test": "bool_property",
          "operator": "!=",
          "domain": "minecraft:was_upgraded_to_1_21_100"
        },
        "event": "minecraft:upgrade_to_1_21_100"
      }
    ]
  }
}

Used by 29

Vanilla entities with minecraft:environment_sensor in their definition:

Related components