DataComponentPatchBuilder

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.DataComponentPatchBuilder;

Members

build() as DataComponentPatch
Builds the DataComponentPatch.

Returns: The DataComponentPatch.

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

Return Type: DataComponentPatch

remove(type as DataComponentType<T>) as Builder
Removes the DataComponentType from the DataComponentPatch.Builder.

Returns: The DataComponentPatch.Builder with the DataComponentType removed.

script.zs
// Builder.remove<T>(type as DataComponentType<T>) as DataComponentPatchBuilder;
myBuilder.remove<T>(myDataComponentType);

Parameters:

type Type: DataComponentType<T> - The DataComponentType to remove.

Return Type: DataComponentPatchBuilder

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

Returns: The DataComponentPatch.Builder with the value set.

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

Parameters:

type Type: DataComponentType<T> - The DataComponentType to set the value for.
value Type: T - The value to set for the given DataComponentType.

Return Type: DataComponentPatchBuilder

setComponent(type as TypedDataComponent<T>) as Builder
Sets the TypedDataComponent for the given DataComponentType.

Returns: The DataComponentPatch.Builder with the TypedDataComponent set.

script.zs
// Builder.setComponent<T>(type as TypedDataComponent<T>) as DataComponentPatchBuilder;
myBuilder.setComponent<T>(myTypedDataComponent);

Parameters:

Return Type: DataComponentPatchBuilder