CustomData

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.component.CustomData;

Operators

in(key as string) as bool
Checks if the CustomData contains the given key.
script.zs
// ((key as string) in CustomData) as bool
myString in myCustomData

Parameters:

key Type: string - The key to check for.

Return Type: bool

Members

contains(key as string) as bool
Checks if the CustomData contains the given key.

Returns: Whether the CustomData contains the given key.

script.zs
// CustomData.contains(key as string) as bool;
myCustomData.contains(myString);

Parameters:

key Type: string - The key to check for.

Return Type: bool

Getter
Gets the copy of the tag of the CustomData.
script.zs
// CustomData.copyTag as CompoundTag
myCustomData.copyTag

Return Type: CompoundTag

Getter
Checks if the CustomData is empty.
script.zs
// CustomData.isEmpty as bool
myCustomData.isEmpty

Return Type: bool

matchedBy(tag as MapData) as bool
Checks if the CustomData matches the given tag.

Returns: Whether the CustomData matches the given tag.

script.zs
// CustomData.matchedBy(tag as MapData) as bool;
myCustomData.matchedBy(myMapData);

Parameters:

tag Type: MapData - The tag to check for.

Return Type: bool

static of(tag as MapData) as CustomData
Creates a new CustomData with the given data.

Returns: The new CustomData.

script.zs
// CustomData.of(tag as MapData) as CustomData;
CustomData.of(myMapData);

Parameters:

tag Type: MapData - The data to create the CustomData from.

Return Type: CustomData

Getter
Gets the size of the CustomData.
script.zs
// CustomData.size as int
myCustomData.size

Return Type: int

update(updater as function(t as MapData) as void) as CustomData
Updates the CustomData with the given updater.

Returns: The updated CustomData.

script.zs
// CustomData.update(updater as function(t as MapData) as void) as CustomData;
myCustomData.update(myConsumer);

Parameters:

updater Type: function(t as MapData) as void - The updater to update the CustomData with.

Return Type: CustomData