Difficulty

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.world.Difficulty;

Implements

Difficulty implements the following interfaces:

StringRepresentable

Undocumented Interfaces

Comparable<Enum>

Enum Constants

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

script.zs
// Difficulty.EASY
<constant:minecraft:world/difficulty:easy>
// Difficulty.HARD
<constant:minecraft:world/difficulty:hard>
// Difficulty.NORMAL
<constant:minecraft:world/difficulty:normal>
// Difficulty.PEACEFUL
<constant:minecraft:world/difficulty:peaceful>

Members

Getter
script.zs
// Difficulty.displayName as Component
<constant:minecraft:world/difficulty:easy>.displayName

Return Type: Component

displayName() as Component
script.zs
// Difficulty.displayName() as Component;
<constant:minecraft:world/difficulty:easy>.displayName();

Return Type: Component

Getter
script.zs
// Difficulty.id as int
<constant:minecraft:world/difficulty:easy>.id

Return Type: int

id() as int
script.zs
// Difficulty.id() as int;
<constant:minecraft:world/difficulty:easy>.id();

Return Type: int

Getter
script.zs
// Difficulty.key as string
<constant:minecraft:world/difficulty:easy>.key

Return Type: string

key() as string
script.zs
// Difficulty.key() as string;
<constant:minecraft:world/difficulty:easy>.key();

Return Type: string

Getter
Gets the serialized name.
script.zs
// Difficulty.serializedName as string
<constant:minecraft:world/difficulty:easy>.serializedName

Return Type: string

serializedName() as string
Gets the serialized name.

Returns: the serialized name.

script.zs
// Difficulty.serializedName() as string;
<constant:minecraft:world/difficulty:easy>.serializedName();

Return Type: string