Class DataComponent
java.lang.Object
com.saicone.rtag.data.DataComponent
Class to invoke methods from multiple DataComponent classes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classClass wrapper to invoke methods from map and patch data component types builder.
This is not the real class, it's just a bridge between to set and get values before build.static classClass to invoke methods from DataComponentHolder.
This type of data component object (as the name said) is just a holder for DataComponentMap to delegate methods.static classClass to invoke methods from DataComponentMap.
A component map acts like an immutable map in java with the regular conception of components by Mojang.static classClass to invoke methods from PatchedDataComponentMap.
A patched map is a subclass of DataComponentMap but mutable, that means all the methods from component map are applicable in a patched map.static classClass to invoke methods from DataComponentPatch.
Instead of patched map, a component patch acts like a cloneable object that can be introduced into maps and also hold empty values to future deletion. -
Method Summary
-
Method Details
-
get
Get a declared component type from data component object.- Parameters:
component- the data component to get component.type- the DataComponentType instance that declares a component type.- Returns:
- the component declared type from data component cache if exists, null otherwise.
- Throws:
IllegalArgumentException- if the provided component is not a compatible data component type.
-
getOptional
public static Optional<Object> getOptional(Object component, Object type) throws IllegalArgumentException Get a declared component type from data component object wrapped as optional object.- Parameters:
component- the data component to get component.type- the DataComponentType instance that declares a component type.- Returns:
- the component declared type from data component cache wrapped into optional object.
- Throws:
IllegalArgumentException- if the provided component is not a compatible data component type.
-