How to Make a Game Rule in Minecraft (Mod Maker guide)
Learn how to create a custom Game rule in 9Minecraft Mod Maker right in your browser. A Game rule is a customizable parameter for a specific in-game world.
Open the Studio and your workspace
Open 9Minecraft Mod Maker in your web browser. There is nothing to download or install.
Open an existing workspace or start a new one. Make sure your workspace uses one of the supported versions for this element, which are NeoForge 26.1.2 or NeoForge 1.21.1.
Add a Game rule element
Click the green plus button in your workspace to create a new mod element.
Find the World generation group and select Game rule to open the editor.
Set the Machine name and display name
Fill in the Machine name field first. This is the game rule name which is displayed in-game in commands to modify or enable the game rules.
Next, type a friendly title into the Game rule name field. This is the display name used on the game rules setting screen.
Write the Game rule description
Find the Game rule description field.
Write a clear explanation of what your rule does. This text is used on the game rules setting screen when a player hovers over your game rule.
Choose the Category
Look at the Category field. It is used for the classification of the game rules depending on what they do.
You can use vanilla names from the dropdown to use existing vanilla game rule categories, or enter a custom name to use mod-namespaced game rule categories.
Pick the Game rule type and Default value
In the Game rule type field, select the best type depending on your plans. Choose Number if the game rule can only be modified to be an integer, or choose Logic if the game rule can only be a boolean (true or false).
Then fill in the Default value field. Your game rule will have this value until a player or a command in the game changes it.
Save, test with Build & run, and export
Save your new Game rule element in the editor.
Click Build & run to test your rule in a world, check it on the game rules setting screen, and try changing it with commands. When everything works, export your mod.
Tips
- Keep your Machine name simple and easy to remember because players will type it into in-game commands.
- Make sure your Game rule description clearly explains what happens when the rule is changed, since players see it when hovering over the rule on the setting screen.
- Pick Logic for your Game rule type if you just want a simple true or false toggle, or pick Number if you need an integer value.
- Use the Category dropdown to put your rule into a familiar vanilla category so players can find it easily.