Repository: PaperMC/Paper
File: paper-api/src/main/java/org/bukkit/inventory/ItemStack.java (Java)

Code before:
     * @param type the data component type
     */
    @org.jetbrains.annotations.ApiStatus.Experimental
    public void resetData(final io.papermc.paper.datacomponent.@NotNull DataComponentType type) {
        this.craftDelegate.resetData(type);
    }

    /**
     * Copies the values of components from the provided ItemStack. Will only copy the value of components from the
     * source ItemStack that are set or overridden.
     *
     * @param source the item stack to copy from
     */
    @org.jetbrains.annotations.ApiStatus.Experimental
    public void copyDataFrom(final @NotNull ItemStack source) {
        this.copyDataFrom(source, null);
    }

    /**
     * Copies the values of components from the provided ItemStack. Will only copy the value of components from the
     * source ItemStack that are set or overridden.
     *
     * @param source the item stack to copy from
     * @param filter predicate for which components to copy
     */
    @org.jetbrains.annotations.ApiStatus.Experimental
    public void copyDataFrom(final @NotNull ItemStack source, final java.util.function.@Nullable Predicate<io.papermc.paper.datacomponent.@NotNull DataComponentType> filter) {
        this.craftDelegate.copyDataFrom(source, filter);
    }

    /**
     * Checks if the data component type is overridden from the default for the
     * item type.
     *
     * @param type the data component type
     * @return {@code true} if the data type is overridden
     */
    @org.jetbrains.annotations.ApiStatus.Experimental
    public boolean isDataOverridden(final io.papermc.paper.datacomponent.@NotNull DataComponentType type) {
        return this.craftDelegate.isDataOverridden(type);
    }

    /**
     * Checks if this itemstack matches another given itemstack excluding the provided components.
     * This is useful if you are wanting to ignore certain properties of itemstacks, such as durability.
     *
     * @param item the item to compare
     * @param excludeTypes the data component types to ignore
     * @return {@code true} if the provided item is equal, ignoring the provided components
     */
    @org.jetbrains.annotations.ApiStatus.Experimental

Review comment (suggestion):
Maybe a code example here would be nice, something that shows you can just create a constant list of types, and then use `THAT_LIST::contains` as the parameter in order to nicely copy data from a specific list

Code after:
     *
     * @param type the data component type
     */
    @org.jetbrains.annotations.ApiStatus.Experimental
    public void resetData(final io.papermc.paper.datacomponent.@NotNull DataComponentType type) {
        this.craftDelegate.resetData(type);
    }

    /**
     * Copies component values and component removals from the provided ItemStack.
     * <p>
     * Example:
     * <pre>{@code
     * Set<DataComponentType> types = Set.of(
     *     DataComponentTypes.CONSUMABLE,
     *     DataComponentTypes.ENCHANTMENT_GLINT_OVERRIDE,
     *     DataComponentTypes.RARITY
     * );
     *
     * ItemStack source = ItemStack.of(Material.ENCHANTED_GOLDEN_APPLE);
     * ItemStack target = ItemStack.of(Material.GOLDEN_CARROT);
     *
     * target.copyDataFrom(source, types::contains);
     * }</pre>
     *
     * @param source the item stack to copy from
     * @param filter predicate for which components to copy
     */
    @org.jetbrains.annotations.ApiStatus.Experimental
    public void copyDataFrom(final @NotNull ItemStack source, final @NotNull Predicate<io.papermc.paper.datacomponent.@NotNull DataComponentType> filter) {
        this.craftDelegate.copyDataFrom(source, filter);
    }

    /**
     * Checks if the data component type is overridden from the default for the
     * item type.
     *
     * @param type the data component type
     * @return {@code true} if the data type is overridden
     */
    @org.jetbrains.annotations.ApiStatus.Experimental
    public boolean isDataOverridden(final io.papermc.paper.datacomponent.@NotNull DataComponentType type) {
        return this.craftDelegate.isDataOverridden(type);
    }

    /**
     * Checks if this itemstack matches another given itemstack excluding the provided components.
     * This is useful if you are wanting to ignore certain properties of itemstacks, such as durability.
     *
     * @param item the item to compare
     * @param excludeTypes the data component types to ignore