Home Commands Examples Getting Started With Scripts Global Keywords
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.enchantment.Rarity;

Implements

Undocumented Interfaces

Comparable<Enum>

Enum Constants

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

script.zs
// Rarity.COMMON
<constant:minecraft:enchantment/rarity:common>
// Rarity.RARE
<constant:minecraft:enchantment/rarity:rare>
// Rarity.UNCOMMON
<constant:minecraft:enchantment/rarity:uncommon>
// Rarity.VERY_RARE
<constant:minecraft:enchantment/rarity:very_rare>

Members

Getter
Gets the weight of this Rarity
script.zs
// Rarity.weight as int
<constant:minecraft:enchantment/rarity:common>.weight

Return Type: int

weight() as int
Gets the weight of this Rarity

Returns: The weight of this Rarity.

script.zs
// Rarity.weight() as int;
<constant:minecraft:enchantment/rarity:common>.weight();

Return Type: int