DataComponentPatch

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

Members

static builder() as Builder
script.zs
// DataComponentPatch.builder() as DataComponentPatchBuilder;
DataComponentPatch.builder();

Return Type: DataComponentPatchBuilder

forget(component as DataComponentType<T>) as DataComponentPatch
script.zs
// DataComponentPatch.forget<T>(component as DataComponentType<T>) as DataComponentPatch;
myDataComponentPatch.forget<T>(myDataComponentType);

Parameters:

component Type: DataComponentType<T>

Return Type: DataComponentPatch

getComponent(type as DataComponentType<T>) as T?
script.zs
// DataComponentPatch.getComponent<T>(type as DataComponentType<T>) as T?;
myDataComponentPatch.getComponent<T>(myDataComponentType);

Parameters:

Return Type: T?

Getter
script.zs
// DataComponentPatch.isEmpty as bool
myDataComponentPatch.isEmpty

Return Type: bool

Getter
script.zs
// DataComponentPatch.size as int
myDataComponentPatch.size

Return Type: int

split() as SplitResult
script.zs
// DataComponentPatch.split() as DataComponentPatchSplitResult;
myDataComponentPatch.split();

Return Type: DataComponentPatchSplitResult