Entity Documentation - minecraft:environment_sensor

minecraft:environment_sensor creates a trigger based on environment conditions.

Parameters

Name Default Value Type Description
triggers not set List The list of triggers that initiate when the environment conditions match the given filter criteria.
Name Default Value Type Description
event not set string The event to run when the conditions are met.
filters not set List / Filter The list of conditions for this trigger to initiate.
target self string The target of the event.

Example

"minecraft:environment_sensor":{
    "triggers":[
       {
          "filters":{
             "all_of":[
                {
                   "test":"is_daytime",
                   "value":true
                },
                {
                   "test":"has_target",
                   "operator":"==",
                   "value":false
                }
             ]
          },
          "event":"minecraft:fox_configure_docile_day"
       }
    ]
 }

Vanilla entities examples

fox

"minecraft:environment_sensor": {
          "triggers": [
            {
              "filters": {
                "all_of": [
                  { "test": "weather_at_position", "operator": "!=", "value": "thunderstorm" },
                  { "test": "is_daytime", "value": true }
                ]
              },
              "event": "minecraft:fox_configure_day"
            },
            {
              "filters": {
                "all_of": [
                  { "test": "weather_at_position", "operator": "!=", "value": "thunderstorm" },
                  { "test": "is_daytime", "value": false }
                ]
              },
              "event": "minecraft:fox_configure_night"
            }
          ]
        }

Vanilla entities using minecraft:environment_sensor