Package net.neoforged.neoforge.common
Interface MutableDataComponentHolder
- All Superinterfaces:
DataComponentHolder
,IDataComponentHolderExtension
- All Known Implementing Classes:
FluidStack
,ItemStack
-
Method Summary
Modifier and TypeMethodDescriptionvoid
applyComponents
(DataComponentMap components) Applies a set of component changes to this stack.void
Applies a set of component changes to this stack.default void
copyFrom
(DataComponentHolder src, Supplier<? extends DataComponentType<?>>... componentTypes) Copies all data components fromsrc
default void
copyFrom
(DataComponentHolder src, DataComponentType<?>... componentTypes) Copies all data components fromsrc
private <T> void
copyFrom
(DataComponentType<T> componentType, DataComponentHolder src) default <T> T
remove
(Supplier<? extends DataComponentType<? extends T>> componentType) Removes a data component.<T> T
remove
(DataComponentType<? extends T> componentType) Removes a data component.default <T> T
set
(Supplier<? extends DataComponentType<? super T>> componentType, T value) Sets a data component.<T> T
set
(DataComponentType<? super T> componentType, T value) Sets a data component.default <T> T
update
(Supplier<? extends DataComponentType<T>> componentType, T value, UnaryOperator<T> updater) Updates a data component if it exists.default <T,
U> 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> T
update
(DataComponentType<T> componentType, T value, UnaryOperator<T> updater) Updates a data component if it exists.default <T,
U> 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 net.minecraft.core.component.DataComponentHolder
get, getComponents, getOrDefault, has
Methods inherited from interface net.neoforged.neoforge.common.extensions.IDataComponentHolderExtension
addToTooltip, addToTooltip, get, getOrDefault, has
-
Method Details
-
set
Sets a data component. -
set
@Nullable default <T> T set(Supplier<? extends DataComponentType<? super T>> componentType, @Nullable T value) Sets a data component. -
update
@Nullable default <T,U> 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
@Nullable default <T,U> 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
@Nullable default <T> T update(DataComponentType<T> componentType, T value, UnaryOperator<T> updater) Updates a data component if it exists. -
update
@Nullable default <T> 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
-