Class CustomGameRuleCategory
java.lang.Object
net.fabricmc.fabric.api.gamerule.v1.CustomGameRuleCategory
Utility class for creating custom game rule categories outside of the categories
Minecraft provides
.-
Constructor Summary
ConstructorDescriptionCustomGameRuleCategory(net.minecraft.util.Identifier id, net.minecraft.text.Text name)
Creates a custom game rule category. -
Method Summary
Modifier and TypeMethodDescriptionboolean
static <T extends net.minecraft.world.GameRules.Rule<T>>
Optional<CustomGameRuleCategory>getCategory(net.minecraft.world.GameRules.Key<T> key)
Gets the custom category agame rule key
is registered to.net.minecraft.util.Identifier
getId()
net.minecraft.text.Text
getName()
int
hashCode()
-
Constructor Details
-
CustomGameRuleCategory
public CustomGameRuleCategory(net.minecraft.util.Identifier id, net.minecraft.text.Text 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.util.Identifier getId() -
getName
public net.minecraft.text.Text getName() -
equals
-
hashCode
public int hashCode() -
getCategory
public static <T extends net.minecraft.world.GameRules.Rule<T>> Optional<CustomGameRuleCategory> getCategory(net.minecraft.world.GameRules.Key<T> key)Gets the custom category agame rule key
is registered to.- Type Parameters:
T
- the type of value the rule holds- Parameters:
key
- the rule key- Returns:
- the custom category this rule belongs to. Otherwise
empty
-