Is there a way to make a recipe modifier that transfers the NBT from the first ingredient in a recipe to the output item? I've managed to make one that finds the correct item to copy the NBT from, but I don't know how to transfer the NBT.
/**
* @param {MetaMachine} machine
* @param {Internal.GTRecipe} recipe
* @param {Internal.OCParams} params
* @param {Internal.OCResult} result
*
* @returns {Internal.GTRecipe}
*/
global.keepNBTRecipeModifier = (machine, recipe, params, result) => {
if (!recipe.data.getBoolean("keep_nbt")) return recipe;
const outputs = recipe.outputs.get($ItemRecipeCapability.CAP);
const inputs = recipe.inputs.get($ItemRecipeCapability.CAP);
const reagentItem = inputs[0].content;
const prevOutput = outputs[0];
/** @type {Internal.IItemHandler} */
const itemHandler = machine.holder
.getCapability(
$ForgeCapabilities.ITEM_HANDLER,
machine.getOutputFacingItems()
)
.resolve()
.get();
for (let i = 0; i < 9; i++) {
let inputItem = itemHandler.getStackInSlot(i);
if (reagentItem.test(inputItem)) {
// Transfer inputItem.nbt to output
break;
}
}
return recipe;
};
I'm using gtceu-1.20.1-1.4.6, if that makes any difference.