Home Commands Examples Getting Started With Scripts Global Keywords 1.21 Migration Guide
Equipable IItemStack ItemCooldowns ItemDefinition ItemStack UseOnContext
BracketDumpers BracketHandlers BracketValidators ResourceLocationBracketHandler

Rarity

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

script.zs
import crafttweaker.api.item.property.Rarity;

Implements

Rarity implements the following interfaces:

StringRepresentable

Undocumented Interfaces

IExtensibleEnum,Comparable<Enum>

Enum Constants

Rarity is an enum with 4 constants. They are accessible like so:

script.zs
// Rarity.COMMON
<constant:minecraft:item/rarity:common>
// Rarity.EPIC
<constant:minecraft:item/rarity:epic>
// Rarity.RARE
<constant:minecraft:item/rarity:rare>
// Rarity.UNCOMMON
<constant:minecraft:item/rarity:uncommon>

Members

Getter
Gets the color of this Rarity
script.zs
// Rarity.color as ChatFormatting
<constant:minecraft:item/rarity:common>.color

Return Type: ChatFormatting

color() as ChatFormatting
Gets the color of this Rarity

Returns: The color of this Rarity.

script.zs
// Rarity.color() as ChatFormatting;
<constant:minecraft:item/rarity:common>.color();

Return Type: ChatFormatting

Getter
Gets the serialized name.
script.zs
// Rarity.serializedName as string
<constant:minecraft:item/rarity:common>.serializedName

Return Type: string

serializedName() as string
Gets the serialized name.

Returns: the serialized name.

script.zs
// Rarity.serializedName() as string;
<constant:minecraft:item/rarity:common>.serializedName();

Return Type: string