Minecraft Tag Function

Function tags: #load (runs on world load/server start and every datapack reload) and #tick (runs at the start of every game tick), used to organize and invoke datapack functions in specific contexts.

ZMJJKK123-hub Updated

File contents

Function Tags

This content applies only to Java Edition.

Function tags are groups of functions.

Usage

Function tags can be used with the /function command, which runs all functions in the tag in the order they first appear. If a function is referenced multiple times in a tag and its subtags, it runs only once.

The game provides two special tags:

  • Functions listed in #load run when the world loads or the server starts. They also run on every datapack reload.
  • Functions listed in #tick run at the start of every game tick, repeating continuously.

Vanilla datapacks do not use these tags.

Example

The following example defines the #load tag in the minecraft namespace and adds the example:test function.

data/minecraft/tags/function/load.json:

{
  "values": [
    "example:test"
  ]
}

The game runs example:test once when the datapack loads.

ZMJJKK123-hub/skill-agent/tree/main/core/skills/minecraft-tag-function commit 3195926000

Frequently asked questions

npx skillmds@latest add zmjjkk123-hub/minecraft-tag-function