Interface MutableDataComponentHolder

All Superinterfaces:
DataComponentHolder, IDataComponentHolderExtension
All Known Implementing Classes:
FluidStack, ItemStack

public interface MutableDataComponentHolder extends DataComponentHolder
  • Method Details

    • set

      @Nullable <T> T set(DataComponentType<? super T> componentType, @Nullable T value)
      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 additional updateContext.
    • 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 additional updateContext.
    • 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

      @Nullable <T> T remove(DataComponentType<? extends T> componentType)
      Removes a data component.
    • remove

      @Nullable default <T> T remove(Supplier<? extends DataComponentType<? extends T>> componentType)
      Removes a data component.
    • copyFrom

      default void copyFrom(DataComponentHolder src, DataComponentType<?>... componentTypes)
      Copies all data components from src
    • copyFrom

      default void copyFrom(DataComponentHolder src, Supplier<? extends DataComponentType<?>>... componentTypes)
      Copies all data components from src
    • applyComponents

      void applyComponents(DataComponentPatch patch)
      Applies a set of component changes to this stack.
    • applyComponents

      void applyComponents(DataComponentMap components)
      Applies a set of component changes to this stack.
    • copyFrom

      private <T> void copyFrom(DataComponentType<T> componentType, DataComponentHolder src)