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.
import crafttweaker.api.component.DataComponentPatch;
Description
Stores information about changes that should be made to aDataComponentMap
, keeping track of which DataComponentType
s should be added or removed. Members
static builder() as Builder
Creates a new DataComponentPatch.Builder.script.zs
Returns: A new DataComponentPatch.Builder.
DataComponentPatch.builder();
Return Type:
DataComponentPatchBuilder
forget(component as DataComponentType<T>) as DataComponentPatch
Removes a script.zs
DataComponentType
from the DataComponentPatch
.Returns: The DataComponentPatch
with the DataComponentType
removed.
myDataComponentPatch.forget<T>(myDataComponentType);
Parameters:
Return Type:
DataComponentPatch
getComponent(type as DataComponentType<T>) as T?
Gets the value for the given script.zs
DataComponentType
.Returns: The value for the given DataComponentType
.
myDataComponentPatch.getComponent<T>(myDataComponentType);
Parameters:
Return Type:
T?
Getter
Checks if the script.zs
DataComponentPatch
is empty.// DataComponentPatch.isEmpty as boolmyDataComponentPatch.isEmpty
Return Type:
bool
Getter
Gets the size of the script.zs
DataComponentPatch
.// DataComponentPatch.size as intmyDataComponentPatch.size
Return Type:
int
split() as SplitResult
Splits the script.zs
DataComponentPatch
into a DataComponentPatch.SplitResult containing the added and removed DataComponentMap
s.Returns: A DataComponentPatch.SplitResult containing the added and removed DataComponentMap
s.
myDataComponentPatch.split();
Return Type:
DataComponentPatchSplitResult