/function

Cheats / op 2Java 26.3

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.

Who can use it
Cheats / op 2
Syntax forms
8
Arguments
4

/function syntax

Game data

Every 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.

/function arguments
ArgumentExpectsLimits
<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.

Report an Issue

/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).