How to Make a Function in Minecraft! (Tutorial)
Where is the Function File Stored in Java Edition?
Each function belongs to a specific saved world.
When storing functions, you must first create a new folder under the datafunctions
folder for the saved world. You can then store your function within this new folder. The filename for the function must have a .mcfunction extension.
For example, you could create a new folder called digminecraft
for the saved world called World1. You would then store the function give_diamond.mcfunction
in this new folder. Depending on your version of Minecraft, this function would be saved under one of the following hidden paths (Note: path may be different on your system):
You could then run the file called give_diamond.mcfunction
with the following /function command:
As you can see, you do not need to enter the .mcfunction extension when using the /function command.
TIP #1: Make sure you are in the correct saved world. Since each function is stored under the datafunctions
folder for a specific saved world, the function can only be run from within that saved world.
TIP #2: Always run the /reload command after saving or changing a function file before using the /function command.
Example in Pocket Edition (PE)
To run a function called overpowered in Minecraft PE:
Example in Java Edition (PC/Mac) 12
To run the function digminecraft/give_diamond.mcfunction
with no conditions:
To run the function digminecraft/create_fence.mcfunction
if there is a cow within 20 blocks:
To run the function digminecraft/chest.mcfunction
if there are no llamas within 100 blocks:
FAQ
How do you use the function command?
- Open the Chat Window. The easiest way to run a command in Minecraft is within the chat window.
- Type the Command. In this example, we will run the function called give_diamond.mcfunction in Minecraft Java Edition (PC/Mac) 1.12 with the following command: /function digminecraft:give_diamond.
How do you make a function pack?
- Open the Chat Window. The easiest way to run a command in Minecraft is within the chat window.
- Type the Command. In this example, we will run the function called give_diamond.mcfunction in Minecraft Java Edition (PC/Mac) 1.12 with the following command: /function digminecraft:give_diamond.
How do you make a function in Mcpe?
- Open the Chat Window. The easiest way to run a command in Minecraft is within the chat window.
- Type the Command. In this example, we will run the function called give_diamond.mcfunction in Minecraft Java Edition (PC/Mac) 1.12 with the following command: /function digminecraft:give_diamond.