Interface MutableDataComponentHolder
- All Superinterfaces:
DataComponentGetter, DataComponentHolder, IDataComponentHolderExtension
- All Known Implementing Classes:
FluidStack, ItemStack
-
Method Summary
Modifier and TypeMethodDescriptionvoidapplyComponents(DataComponentMap components) Applies a set of component changes to this stack.voidApplies a set of component changes to this stack.default <T> voidcopyFrom(Supplier<? extends DataComponentType<T>> type, DataComponentGetter getter) Copies a data component from a component getter.default voidcopyFrom(DataComponentHolder src, Supplier<? extends DataComponentType<?>>... componentTypes) Copies all data components fromsrcdefault voidcopyFrom(DataComponentHolder src, DataComponentType<?>... componentTypes) Copies all data components fromsrcdefault <T> voidcopyFrom(DataComponentType<T> type, DataComponentGetter getter) Copies a data component from a component getter.private <T> voidcopyFrom(DataComponentType<T> componentType, DataComponentHolder src) default <T> @Nullable Tremove(Supplier<? extends DataComponentType<? extends T>> componentType) Removes a data component.<T> @Nullable Tremove(DataComponentType<? extends T> componentType) Removes a data component.default <T> @Nullable Tset(Supplier<? extends DataComponentType<T>> componentType, @Nullable T value) Sets a data component.<T> @Nullable Tset(DataComponentType<T> componentType, @Nullable T value) Sets a data component.default <T> @Nullable Tupdate(Supplier<? extends DataComponentType<T>> componentType, T value, UnaryOperator<T> updater) Updates a data component if it exists.default <T,U> @Nullable T update(Supplier<? extends DataComponentType<T>> componentType, T value, U updateContext, BiFunction<T, U, T> updater) Updates a data component if it exists, using an additionalupdateContext.default <T> @Nullable Tupdate(DataComponentType<T> componentType, T value, UnaryOperator<T> updater) Updates a data component if it exists.default <T,U> @Nullable T update(DataComponentType<T> componentType, T value, U updateContext, BiFunction<T, U, T> updater) Updates a data component if it exists, using an additionalupdateContext.Methods inherited from interface DataComponentGetter
get, getOrDefault, getTyped, hasMethods inherited from interface DataComponentHolder
get, getAllOfType, getComponents, getOrDefault, hasMethods inherited from interface IDataComponentHolderExtension
addToTooltip, addToTooltip
-
Method Details
-
set
Sets a data component. -
set
default <T> @Nullable T set(Supplier<? extends DataComponentType<T>> componentType, @Nullable T value) Sets a data component. -
copyFrom
Copies a data component from a component getter. -
copyFrom
default <T> void copyFrom(Supplier<? extends DataComponentType<T>> type, DataComponentGetter getter) Copies a data component from a component getter. -
update
default <T,U> @Nullable T update(DataComponentType<T> componentType, T value, U updateContext, BiFunction<T, U, T> updater) Updates a data component if it exists, using an additionalupdateContext. -
update
default <T,U> @Nullable T update(Supplier<? extends DataComponentType<T>> componentType, T value, U updateContext, BiFunction<T, U, T> updater) Updates a data component if it exists, using an additionalupdateContext. -
update
default <T> @Nullable T update(DataComponentType<T> componentType, T value, UnaryOperator<T> updater) Updates a data component if it exists. -
update
default <T> @Nullable T update(Supplier<? extends DataComponentType<T>> componentType, T value, UnaryOperator<T> updater) Updates a data component if it exists. -
remove
Removes a data component. -
remove
Removes a data component. -
copyFrom
Copies all data components fromsrc -
copyFrom
default void copyFrom(DataComponentHolder src, Supplier<? extends DataComponentType<?>>... componentTypes) Copies all data components fromsrc -
applyComponents
Applies a set of component changes to this stack. -
applyComponents
Applies a set of component changes to this stack. -
copyFrom
-