Gamerules - roidrole/Roids-Tweaker GitHub Wiki
Allows creation, modification, activation and deactivation of gamerules
Internally, GameRules are just a way of storing data in the world. We do not expand on this concept, merely exposing it to CraftTweaker.
Import :
import mods.ctutils.world.IGameRules;
You can get an IGameRule object from IWorld.getGameRules()
This object contains information about all games rules.
With it, you can do the following :
| Method | Parameters | Description |
|---|---|---|
| getBoolean | name as String | Gets the value of a boolean GameRule |
| getString | name as String | Gets the value of a string GameRule |
| getInt | name as String | Gets the value of an int GameRule |
| hasRule | name as String | Checks if GameRule exists |
| getRules | [None] | Returns a list of all rule names |
| addGameRule | key as string, value as string, type as string | Adds a GameRule to this world |
| setOrCreateGameRule | key as string, value as string | If GameRule exists, set the value. Otherwise, create it with type any |