#my code isnt working

1 messages · Page 1 of 1 (latest)

winter skiff
#

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")

}) `
tranquil chasmBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

winter skiff
#

i say "dont think" but i tried it but didnt work so maybe its something else i dont know about

winter skiff
#

my code isnt working

quartz rapids
#

just gotta use the type and it should be pretty drop-in

winter skiff
#

omg ty so much

#

i was just looking at older posts trying to figure it out

#

Less goo