Class GameRuleFactory

java.lang.Object
me.shedaniel.architectury.registry.GameRuleFactory

public final class GameRuleFactory extends Object
A utility class for creating game rule types.
  • Method Summary

    Modifier and Type
    Method
    Description
    static 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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 value
      changedCallback - 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 value
      changedCallback - a callback that is called when the rule's value is changed
      Returns:
      the created type