Minecraft /function command
Java EditionBedrock EditionSince Java 1.12 (17w18a) / Bedrock 1.8.0
Quick answer: Runs every command inside a function file, in order, instantly. Syntax:
function <name>/function executes a .mcfunction file from a data pack (Java) or behavior pack (Bedrock): a plain list of commands, one per line, run in sequence as if typed. Functions are how maps and data packs organize logic - setups, timers, events - and they accept no arguments in vanilla. Combine with /schedule for delayed or repeating runs.
Syntax
| Edition | Syntax |
|---|---|
| Java | function <name> |
| Bedrock | function <name: filepath> |
Targets / arguments: A function file or, in Java, a function tag (#namespace:tag). Requires: Cheats enabled / operator level 2 (Java), 1 (Bedrock).
Examples
/function mypack:setup/arenaJava: run the setup/arena function from the mypack data pack
/function #mypack:tickJava: run every function in the tick tag
/function events/start_gameBedrock: run the start_game function from a behavior pack
Tips
- Functions live in data/<namespace>/functions/ (Java) or functions/ in a behavior pack (Bedrock).
- One command per line, no leading slash; # starts a comment.
- In Java, minecraft:tick and minecraft:load tags run functions automatically every tick or on load.