
/function
Runs a function from a data pack. Its basic form is /function <name>; it has 8 syntax forms and 4 arguments. Permission: Cheats / op 2.
/function syntax
Game dataEvery form the game accepts. Words in <angle brackets> are arguments you fill in; everything else is typed as is.
/function <name>/function <name> <arguments>/function <name> with block <source>/function <name> with block <source> <path>/function <name> with entity <source>/function <name> with entity <source> <path>/function <name> with storage <source>/function <name> with storage <source> <path>/function examples
Ready-to-paste examples (cheats on). @s is you, @p the nearest player, @a everyone, @e every entity.
/function mypack:setup- Runs every command in the setup function of the mypack data pack.
/function arguments
What each argument expects, with the limits the game enforces.
| Argument | Expects | Limits |
|---|---|---|
<name> | Function ID or #tag | — |
<arguments> | NBT compound {…} | — |
<source> | Block coordinates (x y z, ~ relative, ^ local) | — |
<path> | NBT path | — |
Other commands
Data: Minecraft Java Edition 26.3 game files. How we source this
Runs a function from a data pack. It has 8 syntax forms and can be run by: Cheats / op 2.
See Also
Help us maintain accuracy! If you notice incorrect stats, missing data, or any issues, your feedback directly improves the quality of our data for the entire community.
/function FAQ (Java 26.3)
What does /function do in Minecraft?
Runs a function from a data pack.
What is the syntax of /function?
The basic form is /function <name>. All forms are listed above.
What is an example of /function?
/function mypack:setup — Runs every command in the setup function of the mypack data pack.
Do you need cheats for /function?
Yes: Cheats / op 2. In singleplayer turn on Allow Cheats (or open to LAN with cheats).