Mineuniverse
Log in Register
Mods

LibGamerule

A library mod to add gamerules
by Martmists
Claim this project
28,205 downloads
0 likes
Updated Jun 30, 2026
0 hypes

LibGamerule

Libgamerule allows for easily adding custom gamerules on the Fabric modloader.

Usage (for mod devs)

// Adding a boolean gamerule GameRules.RuleKey<BooleanRule> MY_GAMERULE = Gamerule.register(
​ ​ ​ ​ "myGameRule", // name in /gamerule
​ ​ ​ ​ BooleanRule.create(true) // default to true
);

// Get the gamerule data
boolean value = Gamerule.get(MY_GAMERULE);

Supported Rule types:

  • BooleanRule
  • DoubleRule (+min/max)
  • IntRule (+min/max)
  • EnumRule (Any Enum)
  • StringRule (greedy strings)

Libcd support (datapack/modpack devs)

Conditions (note: does not support enums)

{
​ ​ "when": [
​ ​ ​ ​ {
​ ​ ​ ​ ​ ​ "comment": "Boolean gamerule check",
​ ​ ​ ​ ​ ​ "libgamerule:gamerule_has_value": "my_gamerule"
​ ​ ​ ​ },
​ ​ ​ ​ {
​ ​ ​ ​ ​ ​ "comment": "Typed gamerule check",
​ ​ ​ ​ ​ ​ "libgamerule:gamerule_has_value": {
​ ​ ​ ​ ​ ​ ​ ​ "name": "my_gamerule_typed",
​ ​ ​ ​ ​ ​ ​ ​ "type": "int",
​ ​ ​ ​ ​ ​ ​ ​ "value": 10
​ ​ ​ ​ ​ ​ }
​ ​ ​ ​ }
​ ​ ]
}

Creating gamerules in scripts

var GameruleTweaker = libcd.require("libgamerule.GameruleTweaker");
GameruleTweaker.addGamerule("my_gamerule", "boolean", false);
GameruleTweaker.addGamerule("my_gamerule_typed", "integer", 7);

No files available for download.

More from Martmists

AOF:Skyblock Custom
957
Gunpowder Permissions
874
Informed Load 2
81
Dungeon Forcer
764
TitleScreenNotice
7,430
NoWaterCaves
5,191

You Might Also Like

Vivecraft
A Minecraft VR mod on a loader of your choice!
9,988,339
Athena
A crossplatform (Forge/Fabric) solution to connected block textures for 1.19.4+
99,799,527
Lodestone
A collection of code used throughout projects under the Lodestar team.
9,914,417
TheDragonLib
A library for most of sokratis12GR's Mods
9,910,232
Multi Mob Library
A library mod containing essential files for Daveyx0's mob mods
9,892,767
FTB Library (Forge) (Legacy)
FTB Library is a library mod that is used for some of our mods.
98,265,314