Interface IGameruleRegistry
- All Known Implementing Classes:
GameruleRegistry
public interface IGameruleRegistry
An interface which defines an object for registering and accessing gamerules.
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleangetBooleanGamerule(net.minecraft.world.level.Level level, String id) Get the current value of a boolean gamerule.default intgetIntegerGamerule(net.minecraft.world.level.Level level, String id) Get the current value of an integer gamerule.default booleanhasGamerule(String id) Check if a gamerule exists.default <T extends net.minecraft.world.level.GameRules.Value<T>>
net.minecraft.world.level.GameRules.Key<T>register(String id, CustomCategory category, net.minecraft.world.level.GameRules.Type<T> type) Register a new gamerule with a custom category.default <T extends net.minecraft.world.level.GameRules.Value<T>>
net.minecraft.world.level.GameRules.Key<T>register(String id, net.minecraft.world.level.GameRules.Category category, net.minecraft.world.level.GameRules.Type<T> type) Register a new gamerule.
-
Method Details
-
hasGamerule
Check if a gamerule exists.- Parameters:
id- The ID of the gamerule to look for.- Returns:
trueif the gamerule exists;falseotherwise.
-
getBooleanGamerule
Get the current value of a boolean gamerule.- Parameters:
id- The resource location of the gamerule to get the boolean value of.- Returns:
- The boolean value of the gamerule.
-
getIntegerGamerule
Get the current value of an integer gamerule.- Parameters:
id- The resource location of the gamerule to get the integer value of.- Returns:
- The integer value of the gamerule.
-
register
default <T extends net.minecraft.world.level.GameRules.Value<T>> net.minecraft.world.level.GameRules.Key<T> register(String id, net.minecraft.world.level.GameRules.Category category, net.minecraft.world.level.GameRules.Type<T> type) throws IllegalStateException Register a new gamerule.- Parameters:
id- The resource location to register the new gamerule at. Must be unqiue.category- The category to register the new gamerule under.type- The type of gamerule to register.- Returns:
- The key of the newly registered gamerule.
- Throws:
IllegalStateException- Thrown if the resource location given is already in use.
-
register
default <T extends net.minecraft.world.level.GameRules.Value<T>> net.minecraft.world.level.GameRules.Key<T> register(String id, CustomCategory category, net.minecraft.world.level.GameRules.Type<T> type) throws IllegalStateException Register a new gamerule with a custom category.- Parameters:
id- The resource location to register the new gamerule at. Must be unqiue.category- The category to register the new gamerule under.type- The type of gamerule to register.- Returns:
- The key of the newly registered gamerule.
- Throws:
IllegalStateException- Thrown if the resource location given is already in use.
-