#Sophisticated backpacks upgrade recipe

15 messages · Page 1 of 1 (latest)

digital oracle
#

I'm new to kubejs and i don't know how to make that, when upgrading backpack to higher level, backpack will remain it's inventory. I saw examples for older versions but now they don't work. I'm working on 1.21.1 Neoforge version.

flint kernelBOT
#

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

terse spruce
#

use Sophisticated itself's recipe type

#

with event.custom

warm condorBOT
#

You can add, remove, and modify recipes with KubeJS. The wiki has a page on that!
If you want to learn how to add recipes to any mod, click the Custom button.

digital oracle
#

thank you so much, it works now. I will paste code here so others will know how to do that.

#
ServerEvents.recipes(event =>{
event.custom({
  "type": "sophisticatedbackpacks:backpack_upgrade",
  "category": "misc",
  "key": {
    "B": {
      "item": "sophisticatedbackpacks:backpack"
    },
    "I": {
      "item": "minecraft:iron_block"
    },
    "G": {
      "item": "minecraft:iron_ingot"
    }
  },
  "pattern": [
    "IGI",
    "GBG",
    "IGI"
  ],
  "result": {
    "count": 1,
    "id": "sophisticatedbackpacks:iron_backpack"
  }
  })
})
#

Can i give to that recipe a custom id?

terse spruce
#

yes sure

#
event.custom({}).id("custom_id_here")
#

for example:

ServerEvents.recipes(event =>{
  event.custom({
    "type": "sophisticatedbackpacks:backpack_upgrade",
    "category": "misc",
    "key": {
      "B": {
        "item": "sophisticatedbackpacks:backpack"
      },
      "I": {
        "item": "minecraft:iron_block"
      },
      "G": {
        "item": "minecraft:iron_ingot"
      }
    },
    "pattern": [
      "IGI",
      "GBG",
      "IGI"
    ],
    "result": {
      "count": 1,
      "id": "sophisticatedbackpacks:iron_backpack"
    }
  }).id("custom_iron_backpack_upgrade")
})
digital oracle
#

Thanks a lot

digital oracle
#

I spent like 3 hours trying to make it work