How to Make a Function in Minecraft (Mod Maker guide)
Learn how to create a custom Function in 9Minecraft Mod Maker right in your browser. A Function allows players to run command sets whenever it is called in the game.
Open the Studio and a workspace
Open 9Minecraft Mod Maker directly in your web browser. Since it runs online, there is nothing to download or install.
Open your existing workspace or create a new one. Make sure your project uses a supported version: NeoForge 26.1.2, NeoForge 1.21.1, Data pack 26.1, Data pack 1.21.1, or Bedrock add-on 26.1.
Add a new Function element
Click the green plus button in your workspace to add a new mod element.
Look in the Logic & code group and select Function.
Choose the Function namespace
Look for the Function namespace field in the editor.
You have two options here. Select Mod if the function is used for your mod only. You will call such a function as ${modid}:${registryname}.
Select Minecraft if the function is used with some Minecraft options. You will call such a function as minecraft:${registryname}.
Set the Function registry name
Next, fill in the Function registry name field.
You can write your function name in one word or with several words separated by underscore(s). Good examples are advancement or advancement_biome_reward.
Save your Function
Double-check that your Function namespace and Function registry name are filled out properly.
Save your element so your workspace remembers the changes.
Test with Build & run and export
Click Build & run to test your new Function and make sure your command sets run properly when called.
When everything works the way you want, export your project to use it in Minecraft.
Tips
- Always use underscores instead of spaces in the Function registry name field, such as advancement_biome_reward.
- Remember how to call your function based on the Function namespace you picked: either ${modid}:${registryname} for Mod or minecraft:${registryname} for Minecraft.
- Check that your workspace is set to a supported target like NeoForge 26.1.2, NeoForge 1.21.1, Data pack 26.1, Data pack 1.21.1, or Bedrock add-on 26.1.