Class GameruleUtilities
java.lang.Object
com.glektarssza.expandedgamerules.GameruleUtilities
A collection of utilities for interacting with Minecraft's gamerules.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final booleangetBooleanGamerule(net.minecraft.world.level.Level level, String id) Get the boolean value associated with a gamerule.static final booleangetBooleanGamerule(net.minecraft.world.level.Level level, net.minecraft.world.level.GameRules.Key<net.minecraft.world.level.GameRules.BooleanValue> key) Get the boolean value associated with a gamerule.static final intgetIntegerGamerule(net.minecraft.world.level.Level level, String id) Get the integer value associated with a gamerule.static final intgetIntegerGamerule(net.minecraft.world.level.Level level, net.minecraft.world.level.GameRules.Key<net.minecraft.world.level.GameRules.IntegerValue> key) Get the integer value associated with a gamerule.static final net.minecraft.world.level.GameRules.Key<net.minecraft.world.level.GameRules.BooleanValue>register(String name, CustomCategory category, boolean defaultValue) Register a new gamerule.static final net.minecraft.world.level.GameRules.Key<net.minecraft.world.level.GameRules.IntegerValue>register(String name, CustomCategory category, int defaultValue) Register a new gamerule.static final net.minecraft.world.level.GameRules.Key<net.minecraft.world.level.GameRules.BooleanValue>Register a new gamerule.static final net.minecraft.world.level.GameRules.Key<net.minecraft.world.level.GameRules.IntegerValue>Register a new gamerule.
-
Constructor Details
-
GameruleUtilities
public GameruleUtilities()
-
-
Method Details
-
register
public static final net.minecraft.world.level.GameRules.Key<net.minecraft.world.level.GameRules.BooleanValue> register(String name, net.minecraft.world.level.GameRules.Category category, boolean defaultValue) Register a new gamerule.- Parameters:
name- The name of the gamerule to register. Must be unique.category- The category to put the gamerule under.defaultValue- The value to set the gamerule to by default.- Returns:
- A key that can be used to access the gamerule.
-
register
public static final net.minecraft.world.level.GameRules.Key<net.minecraft.world.level.GameRules.BooleanValue> register(String name, CustomCategory category, boolean defaultValue) Register a new gamerule.- Parameters:
name- The name of the gamerule to register. Must be unique.category- The category to put the gamerule under.defaultValue- The value to set the gamerule to by default.- Returns:
- A key that can be used to access the gamerule.
-
register
public static final net.minecraft.world.level.GameRules.Key<net.minecraft.world.level.GameRules.IntegerValue> register(String name, net.minecraft.world.level.GameRules.Category category, int defaultValue) Register a new gamerule.- Parameters:
name- The name of the gamerule to register. Must be unique.category- The category to put the gamerule under.defaultValue- The value to set the gamerule to by default.- Returns:
- A key that can be used to access the gamerule.
-
register
public static final net.minecraft.world.level.GameRules.Key<net.minecraft.world.level.GameRules.IntegerValue> register(String name, CustomCategory category, int defaultValue) Register a new gamerule.- Parameters:
name- The name of the gamerule to register. Must be unique.category- The category to put the gamerule under.defaultValue- The value to set the gamerule to by default.- Returns:
- A key that can be used to access the gamerule.
-
getBooleanGamerule
public static final boolean getBooleanGamerule(net.minecraft.world.level.Level level, net.minecraft.world.level.GameRules.Key<net.minecraft.world.level.GameRules.BooleanValue> key) Get the boolean value associated with a gamerule.- Parameters:
level- The level to retrieve the gamerule value from.key- The key to retrieve the gamerule for.- Returns:
- The boolean value for the gamerule.
-
getBooleanGamerule
Get the boolean value associated with a gamerule.- Parameters:
level- The level to retrieve the gamerule value from.id- The id to retrieve the gamerule for.- Returns:
- The boolean value for the gamerule.
-
getIntegerGamerule
public static final int getIntegerGamerule(net.minecraft.world.level.Level level, net.minecraft.world.level.GameRules.Key<net.minecraft.world.level.GameRules.IntegerValue> key) Get the integer value associated with a gamerule.- Parameters:
level- The level to retrieve the gamerule value from.key- The key to retrieve the gamerule for.- Returns:
- The integer value for the gamerule.
-
getIntegerGamerule
Get the integer value associated with a gamerule.- Parameters:
level- The level to retrieve the gamerule value from.id- The id to retrieve the gamerule for.- Returns:
- The integer value for the gamerule.
-