Paper icon indicating copy to clipboard operation
Paper copied to clipboard

copyDataComponents on SmithingTransformRecipe is not working as intended

Open Grabsky opened this issue 2 months ago • 1 comments

Expected behavior

According to javadocs, setting copyDataComponents parameter to false should prevent components to be copied from the base item, to the recipe result.

https://jd.papermc.io/paper/1.21.10/org/bukkit/inventory/SmithingTransformRecipe.html#%3Cinit%3E(org.bukkit.NamespacedKey,org.bukkit.inventory.ItemStack,org.bukkit.inventory.RecipeChoice,org.bukkit.inventory.RecipeChoice,org.bukkit.inventory.RecipeChoice,boolean)

Observed/Actual behavior

Setting this copyDataComponents to false makes no visible effect. Components from the base item are still copied to the recipe result.

Image Image

Steps/models to reproduce

  1. Create and register new SmithingTransformRecipe, where copyDataComponents is set to false.
  2. See that components from base item are still copied to the recipe result.
new SmithingTransformRecipe(NamespacedKey.fromString("example:diamond_pickaxe_from_smithing"), ItemStack.of(Material.DIAMOND_PICKAXE), RecipeChoice.empty(), new RecipeChoice.MaterialChoice(Material.IRON_PICKAXE), new RecipeChoice.MaterialChoice(Material.DIAMOND), false);

Plugin and Datapack List

none

Paper version

[22:09:32 INFO]: Checking version, please wait...
[22:09:32 INFO]: This server is running Paper version 1.21.10-108-main@97452e1 (2025-11-10T18:27:52Z) (Implementing API version 1.21.10-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.10-105-1f31ee5 (MC: 1.21.10)

Other

No response

Grabsky avatar Nov 12 '25 21:11 Grabsky

1.20.4 - Vanilla copies result and applies nbt of input, the behaviour is correct https://github.com/PaperMC/Paper-archive/blob/9de3f75fa2af7c47dc2ed3bcec850b9e245dda21/patches/server/0612-Option-to-prevent-NBT-copy-in-smithing-recipes.patch#L31

1.20.6 - Vanilla copies input and applies components of the result, the resulting behaviour is incorrect https://github.com/PaperMC/Paper-archive/blob/a4f0f5ccd05592dc9be040d8c17d6795baa7b1b8/patches/server/0592-Option-to-prevent-data-components-copy-in-smithing-r.patch#L29

In both cases the copy of nbt/components are wrapped in if, but since the source of the nbt/components reversed the behaviour was broken

masmc05 avatar Nov 12 '25 21:11 masmc05