Class CustomGameRuleCategory
java.lang.Object
net.fabricmc.fabric.api.gamerule.v1.CustomGameRuleCategory
Utility class for creating custom game rule categories with full control over the name.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCustomGameRuleCategory(net.minecraft.resources.Identifier id, net.minecraft.network.chat.Component name) Creates a custom game rule category. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic <T> Optional<CustomGameRuleCategory> getCategory(net.minecraft.world.level.gamerules.GameRule<T> rule) Gets the custom category a game rule is registered to.net.minecraft.resources.IdentifiergetId()net.minecraft.network.chat.ComponentgetName()inthashCode()
-
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 categoryname- the name of this category
-
-
Method Details
-
getId
public net.minecraft.resources.Identifier getId() -
getName
public net.minecraft.network.chat.Component getName() -
equals
-
hashCode
public int hashCode() -
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
-