Interface DataComponentHolder
- All Known Implementing Classes:
DataComponentEditor, ItemDefinition, ItemStack
public interface DataComponentHolder
Something that carries a patch over an item's default components.
- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T> @Nullable Tget(DataComponentType<T> type) Reads a component off this holder.default <T> TgetOrDefault(DataComponentType<T> type, T fallback) default booleanhas(DataComponentType<?> type)
-
Method Details
-
components
DataComponentMap components()- Returns:
- the patch this holder carries
- Since:
- 0.1.0
-
get
Reads a component off this holder.- Type Parameters:
T- the component's value type- Parameters:
type- the component to read- Returns:
- the value, or
null - Since:
- 0.1.0
-
getOrDefault
- Type Parameters:
T- the component's value type- Parameters:
type- the component to readfallback- returned when the component is unset- Returns:
- the value, or
fallback - Since:
- 0.1.0
-
has
- Parameters:
type- the component to test- Returns:
truewhen this holder patches it- Since:
- 0.1.0
-