TypedDataComponent
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.TypedDataComponent;
Description
Holds aDataComponentType
and its value. Members
applyTo(patchedMap as PatchedDataComponentMap)
Applies the script.zs
TypedDataComponent
to a PatchedDataComponentMap.// TypedDataComponent<T>.applyTo<T>(patchedMap as PatchedDataComponentMap);myTypedDataComponent.applyTo<T>(myPatchedDataComponentMap);
Parameters:
patchedMap: PatchedDataComponentMap
Type: PatchedDataComponentMap
- The PatchedDataComponentMap to apply the TypedDataComponent
to. asIData() as IData
Converts the script.zs
TypedDataComponent
to an IData
.Returns: The IData
representation of the TypedDataComponent
.
myTypedDataComponent.asIData();
Return Type:
IData
implicit as IData
Converts the script.zs
TypedDataComponent
to an IData
.// TypedDataComponent<T> as IDatamyTypedDataComponent as IData
Return Type:
IData
static of<T>(type as DataComponentType<T>, value as T) as TypedDataComponent<T>
Creates a new script.zs
TypedDataComponent
.Returns: A new TypedDataComponent
.
TypedDataComponent<T>.of<T>(myDataComponentType, myT);
Parameters:
value: T
Type: T
- The value of the component.
Return Type:
TypedDataComponent<T>
Getter
Gets the registry name of the stored script.zs
DataComponentType
.// TypedDataComponent<T>.registryName as ResourceLocationmyTypedDataComponent.registryName
Return Type:
ResourceLocation
type() as DataComponentType<T>
Gets the script.zs
DataComponentType
of the TypedDataComponent
.Returns: The DataComponentType
of the TypedDataComponent
.
myTypedDataComponent.type<T>();
Return Type:
DataComponentType<T>
value() as T
Gets the value of the script.zs
TypedDataComponent
.Returns: The value of the TypedDataComponent
.
// TypedDataComponent<T>.value<T>() as T;myTypedDataComponent.value<T>();
Return Type:
T