minecraft:timer

Adds a timer after which an event will fire.

Properties

PropertyTypeDefaultWhat it does
loopingBooleantrueIf true, the timer will restart every time after it fires.
randomIntervalBooleantrueIf true, the amount of time on the timer will be random between the min and max values specified in time.
timeObject—Amount of time in seconds for the timer. Specified as a pair of numbers (min and max). Incompatible with random_time_choices.
minDecimal0
maxDecimal0
time_down_eventObject{"event": "", "filters": {"AND": null, "NOT": null, "OR":…Event to fire when the time on the timer runs out.
eventText""
targetTextself, other, player, target, parent, baby, block, damager, holder, item"self"
filtersObject or List of object{"AND": null, "NOT": null, "OR": null, "all": null, "all_…Filters allow data objects to specify test criteria which allows their use. Filters can be defined by a single object of type (Filter Test), an array of tests, collection groups, or a combination of these objects.
testText—The name of the test to apply.
subjectBoolean or Integer or Decimal or Text—The subject of this filter test.
operatorBoolean or Integer or Decimal or Text—The comparison to apply with 'value'.
domainBoolean or Integer or Decimal or Text—The domain the test should be performed in.
valueBoolean or Integer or Decimal or Text—The value being compared with the test.
random_time_choicesList of object[]This is a list of objects, representing one value in seconds that can be picked before firing the event and an optional weight. Incompatible with time.
valueDecimal0
weightInteger0

Example from the game files

This is how vanilla Wandering Trader uses it in Minecraft Bedrock 1.26.60.5:

{
  "minecraft:timer": {
    "looping": false,
    "random_time_choices": [
      {
        "value": 2400,
        "weight": 50
      },
      {
        "value": 3600,
        "weight": 50
      }
    ],
    "time_down_event": {
      "event": "minecraft:start_despawn",
      "target": "self"
    }
  }
}

Used by 19

Vanilla entities with minecraft:timer in their definition:

Related components