Rarity

Importing the class

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.

ZenScript
Copy
import crafttweaker.api.item.Rarity;

Extending Enum<Rarity>

Rarity extends Enum<Rarity>. That means all methods available in Enum<Rarity> are also available in Rarity

Static Methods

create

Creates a new Rarity with the given name and given color.

Returns: A new Rarity with the given name and color
Return Type: Rarity

ZenScript
Copy
// Rarity.create(name as string, formatting as TextFormatting) as Rarity

Rarity.create("insanely epic", <formatting:obfucated>);
ParameterTypeDescription
namestringThe name of the new Rarity.
formattazioneTextFormattingThe color of the rarity.

Static Properties

NameTypeHa GetterHa SetterDescription
COMMONRaritytruefalseNo Description Provided
EPICRaritytruefalseNo Description Provided
RARERaritytruefalseNo Description Provided
UNCOMMONRaritytruefalseNo Description Provided

Methods

color

Gets the color of this Rarity

Returns: The color of this Rarity.
Return Type: TextFormatting

ZenScript
Copy
// Rarity.color() as TextFormatting

myRarity.color();

Properties

NameTypeHa GetterHa SetterDescription
colorTextFormattingtruefalseGets the color of this Rarity