Skip to content

Commit 740abe1

Browse files
committed
Update CraftSmithingTransformRecipe
1 parent 0f1f084 commit 740abe1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTransformRecipe.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import net.minecraft.server.MinecraftServer;
44
import net.minecraft.world.item.crafting.RecipeHolder;
5+
import net.minecraft.world.item.crafting.TransmuteResult;
56
import org.bukkit.NamespacedKey;
67
import org.bukkit.inventory.ItemStack;
78
import org.bukkit.inventory.RecipeChoice;
@@ -28,12 +29,13 @@ public static CraftSmithingTransformRecipe fromBukkitRecipe(SmithingTransformRec
2829
@Override
2930
public void addToCraftingManager() {
3031
ItemStack result = this.getResult();
31-
32-
final SmithingTransformRecipe recipe = new SmithingTransformRecipe(
32+
final net.minecraft.world.item.ItemStack nmsStack = CraftItemStack.asNMSCopy(result);
33+
final net.minecraft.world.item.crafting.SmithingTransformRecipe recipe = new net.minecraft.world.item.crafting.SmithingTransformRecipe(
3334
this.toNMSOptional(this.getTemplate(), false),
34-
this.toNMSOptional(this.getBase(), false),
35+
this.toNMS(this.getBase(), false),
3536
this.toNMSOptional(this.getAddition(), false),
36-
CraftItemStack.asNMSCopy(result), this.willCopyDataComponents()
37+
new TransmuteResult(nmsStack.getItemHolder(), nmsStack.getCount(), nmsStack.getComponentsPatch())
38+
, this.willCopyDataComponents()
3739
);
3840
MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftRecipe.toMinecraft(this.getKey()), recipe)); // Paper - Option to prevent data components copy
3941
}

0 commit comments

Comments
 (0)