Class GameRuleFactory
java.lang.Object
me.shedaniel.architectury.registry.GameRuleFactory
A utility class for creating game rule types.
-
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.world.level.GameRules.Type<net.minecraft.world.level.GameRules.BooleanValue>
createBooleanRule
(boolean defaultValue) Creates a boolean rule type.static net.minecraft.world.level.GameRules.Type<net.minecraft.world.level.GameRules.BooleanValue>
createBooleanRule
(boolean defaultValue, BiConsumer<net.minecraft.server.MinecraftServer, net.minecraft.world.level.GameRules.BooleanValue> changedCallback) Creates a boolean rule type.static net.minecraft.world.level.GameRules.Type<net.minecraft.world.level.GameRules.IntegerValue>
createIntRule
(int defaultValue) Creates an integer rule type.static net.minecraft.world.level.GameRules.Type<net.minecraft.world.level.GameRules.IntegerValue>
createIntRule
(int defaultValue, BiConsumer<net.minecraft.server.MinecraftServer, net.minecraft.world.level.GameRules.IntegerValue> changedCallback) Creates an integer rule type.
-
Method Details
-
createBooleanRule
public static net.minecraft.world.level.GameRules.Type<net.minecraft.world.level.GameRules.BooleanValue> createBooleanRule(boolean defaultValue) Creates a boolean rule type.- Parameters:
defaultValue
- the rule's default value- Returns:
- the created type
-
createBooleanRule
public static net.minecraft.world.level.GameRules.Type<net.minecraft.world.level.GameRules.BooleanValue> createBooleanRule(boolean defaultValue, BiConsumer<net.minecraft.server.MinecraftServer, net.minecraft.world.level.GameRules.BooleanValue> changedCallback) Creates a boolean rule type.- Parameters:
defaultValue
- the rule's default valuechangedCallback
- a callback that is called when the rule's value is changed- Returns:
- the created type
-
createIntRule
public static net.minecraft.world.level.GameRules.Type<net.minecraft.world.level.GameRules.IntegerValue> createIntRule(int defaultValue) Creates an integer rule type.- Parameters:
defaultValue
- the rule's default value- Returns:
- the created type
-
createIntRule
public static net.minecraft.world.level.GameRules.Type<net.minecraft.world.level.GameRules.IntegerValue> createIntRule(int defaultValue, BiConsumer<net.minecraft.server.MinecraftServer, net.minecraft.world.level.GameRules.IntegerValue> changedCallback) Creates an integer rule type.- Parameters:
defaultValue
- the rule's default valuechangedCallback
- a callback that is called when the rule's value is changed- Returns:
- the created type
-