so i am trying to copy a backpacks contents and then put it in the output backpack heres my code
` ServerEvents.recipes(event => {
//this will give the contents of normal backpack to iron
Ingredient.registerCustomIngredientAction("apply_contents", (itemstack, index, inventory) => {
let contents = inventory.get(inventory.find(Item.of("sophisticatedbackpacks:backpack"))).nbt;
if (itemstack.nbt == null)
itemstack.nbt = {}
itemstack.nbt = itemstack.nbt.merge({ Contents: contents.get("StoredContents") })
return itemstack;
})
event.custom({"type":"minecraft:crafting_shaped","result":{"item":"sophisticatedbackpacks:iron_backpack","count":1},"pattern":[
"GGG",
"GBG",
"WOW"],
"key":{"O":{"item":"minecraft:leather_chestplate"},"B":{"item":"sophisticatedbackpacks:backpack"},"W":{"item":"quark:bonded_leather"},"G":{"item":"mekanism:enriched_iron"}}})
.customIngredientAction("#forge:backpack", "apply_contents_iron")
event.custom({"type":"minecraft:crafting_shaped","result":{"item":"sophisticatedbackpacks:diamond_backpack","count":1},"pattern":[
"GGG",
"MBM",
"WOW"],
"key":{"G":{"item":"mekanism:enriched_diamond"},"M":{"item":"gobber2:gobber2_ingot"},"W":{"item":"mekanism:basic_control_circuit"},"O":{"item":"quark:bonded_leather"},"B":{"item":"sophisticatedbackpacks:gold_backpack"}}})
.customIngredientAction("#forge:backpack", "apply_contents_iron")
event.custom({"type":"minecraft:crafting_shaped","result":{"item":"sophisticatedbackpacks:gold_backpack","count":1},"pattern":[
"GGG",
"GBG",
"WOW"],
"key":{"G":{"item":"mekanism:enriched_gold"},"W":{"item":"quark:bonded_leather"},"O":{"item":"mekanism:basic_control_circuit"},"B":{"item":"sophisticatedbackpacks:iron_backpack"}}})
.customIngredientAction("#forge:backpack", "apply_contents_iron")
}) `