Smithing recipe error
LILPRINCES opened this issue ยท 1 comments
Issue description
I tried to use Smithing recipe to make a weapon upgrade function, the jei recipe shows correct but the actual situation is wrong.
Steps to reproduce
No response
Script used
The crafttweaker.log file
Minecraft version
1.16
Modloader
Forge
Modloader version
36.2.2
CraftTweaker version
7.1.2.489
Other relevant information
No response
The latest.log file
Smithing recipes use the original input to make the output, this means that it copies the NBT from the input to the output.
JEI shows the correct result because that is the base item that is being outputted, but because damage is done via NBT, it is transferred from the input item, to the output item when it is crafted, like so:
public ItemStack getCraftingResult(IInventory inv) {
ItemStack itemstack = this.result.copy(); // This gets the output that you wrote
CompoundNBT compoundnbt = inv.getStackInSlot(0).getTag();
if (compoundnbt != null) {
itemstack.setTag(compoundnbt.copy()); // This sets the tag on the output to be the tag of the input, including the data.
}
return itemstack;
}
Right now there isn't a solution for this, it is just how vanilla handles smithing recipes. I can maybe look into it in the future.