Class CustomGameRuleCategory

java.lang.Object
net.fabricmc.fabric.api.gamerule.v1.CustomGameRuleCategory

public final class CustomGameRuleCategory extends Object
Utility class for creating custom game rule categories with full control over the name.
See Also:
  • GameRuleCategory
  • Constructor Details

    • CustomGameRuleCategory

      public CustomGameRuleCategory(net.minecraft.resources.Identifier id, net.minecraft.network.chat.Component name)
      Creates a custom game rule category.
      Parameters:
      id - the id of this category
      name - the name of this category
  • Method Details

    • getId

      public net.minecraft.resources.Identifier getId()
    • getName

      public net.minecraft.network.chat.Component getName()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getCategory

      public static <T> Optional<CustomGameRuleCategory> getCategory(net.minecraft.world.level.gamerules.GameRule<T> rule)
      Gets the custom category a game rule is registered to.
      Type Parameters:
      T - the type of value the rule holds
      Parameters:
      rule - the rule
      Returns:
      the custom category this rule belongs to. Otherwise empty