Minecraft /function command
Runs the commands written in a data pack's .mcfunction file, in order.
Syntax
/function <name>
/function <name> <arguments>
Parts in square brackets are optional, parts in angle brackets are required. You do not type the brackets: Put your own value in their place.
Arguments
| Argument | What it does |
|---|---|
| <name> | The function's ID in the data pack, written as namespace:path. |
| <arguments> | Macro arguments in curly braces, added in 1.20.2. |
Examples
/function og:start
Runs the start command file in the data pack.
Good to know
- The way to write long command chains to a file instead of command blocks.
- After changing the file, you need /reload.
How do I run this command?
Press T in game to open chat (or press / directly), type the command and press Enter. While typing, Tab completes the options. This command counts as a cheat: It needs cheats enabled in a singleplayer world, and operator permission on a server (operator (level 2)).
Related commands
⚙️ More Advanced commands
Minecraft is a product of Mojang Studios. This tool is an independent helper made for players and is not affiliated with Mojang or Microsoft.