DataComponentMapBuilder

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

Implements

Undocumented Interfaces

IDataComponentMapBuilderExtensions

Members

addAll(other as DataComponentMap) as Builder
Adds all the DataComponentTypes and values from the other DataComponentMap to the builder.

Returns: The DataComponentMap.Builder with the added values.

script.zs
// Builder.addAll(other as DataComponentMap) as DataComponentMapBuilder;
myBuilder.addAll(myDataComponentMap);

Parameters:

other Type: DataComponentMap - The DataComponentMap to add the DataComponentTypes and values from.

Return Type: DataComponentMapBuilder

build() as DataComponentMap
Builds the DataComponentMap.

Returns: The built DataComponentMap.

script.zs
// Builder.build() as DataComponentMap;
myBuilder.build();

Return Type: DataComponentMap

setComponent(type as DataComponentType<T>, value as T?) as Builder
Sets the value of the data component for the given DataComponentType.

Returns: The DataComponentMap.Builder with the updated value.

script.zs
// Builder.setComponent<T>(type as DataComponentType<T>, value as T?) as DataComponentMapBuilder;
myBuilder.setComponent<T>(myDataComponentType, myT);

Parameters:

type Type: DataComponentType<T> - The DataComponentType to set the value of.
value Type: T? - The value to set the data component to.

Return Type: DataComponentMapBuilder