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

Fragmentum [NeoForge Edition]
The lightweight framework for the Obscuria Collection multi-loader mods
992,307
Iguana Lib
An iguana lib core for my mods.
992,164
Potentials
Library to allow mod developers to use cross platform capabilities
981,373
SDM Engine Core
The game engine in Minecraft!
980,484
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