We're playing on a server with 10-15 people and ancient tomes from the quark mod are too hard to get with this many people looting. We decided we wanted to add a recipe for them. I would've done this with a datapack because that's what I know how to make but regular recipes don't support nbt and both my input items and result need nbt data to be functional items. I was told using kubejs could do the trick but I honestly have no idea how to work with javascript. What I'm trying to do (if even possible) is have a recipe that looks like this https://cdn.discordapp.com/attachments/796383470686699554/1138216338045816912/u3dNHcO.png where the enchanted books have to be vanilla max level versions of the tome you placed the middle and it should give you two tomes of the one you put in, essentially doubling your tome at the cost of 4 enchanted books.
#I need some help setting up recipes that include nbt data
47 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
and I guess an additional question is if this works server side only or if everyone has to install it.
Send your code here instead of a screenshot
It makes it easier to diagnose your code and help you fix it or make the required changes/additions.
For items with nbt you can do /kjs_hand with your item in your main hand, you will get a chat massage copy the first Line (should start with Item.of(), this you then place instead of the string.
??tryitandsee
if you want to know how to add recipes at all:
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.
Am I missing a dependancy?
ServerEvents.recipes(event => {
event.shaped(
Item.of('quark:ancient_tome', '{StoredEnchantments:[{id:"minecraft:power",lvl:5s}]}', 2), // arg 1: output
[
'ABA',
'BCB', // arg 2: the shape (array of strings)
'ABA'
],
{
A: 'minecraft:experience_bottle',
B: ('minecraft:enchanted_book').enchant('minecraft:power', 5), //arg 3: the mapping object
C: ('quark:ancient_tome', '{StoredEnchantments:[{id:"minecraft:power",lvl:5s}]}')
}
)
console.log('Hello! The recipe event has fired!')
})
this is what I have
still have the log thing in
till it's working I'll keep it in
that's not how you do it...
what am I doing wrong then?
{
A: 'minecraft:experience_bottle',
B: Item.of('minecraft:enchanted_book').enchant('minecraft:power', 5), //arg 3: the mapping object
C: Item.of('quark:ancient_tome', '{StoredEnchantments:[{id:"minecraft:power",lvl:5s}]}')
}
u already did it as output

ServerEvents.recipes(event => {
event.shaped(Item.of('quark:ancient_tome', '{StoredEnchantments:[{id:"minecraft:power",lvl:5s}]}', 2), [
'ABA',
'BCB',
'ABA'
], {
A: 'minecraft:experience_bottle',
B: Item.of('minecraft:enchanted_book').enchant('minecraft:power', 5),
C: Item.of('quark:ancient_tome', '{StoredEnchantments:[{id:"minecraft:power",lvl:5s}]}')
})
})
you forgot Item.of at the beginning of some inputs
??basics
To create KubeJS scripts, you'll need:
- a proper code editor,
- some programming (more specifically, javascript) knowledge,
- common sense.
Oh I forgot the shaped
no...?
no, u forgot the Item.of
wait no I didnt
and I fixed that here ⬆️
I still get this error when using that code
ohh waitr
ServerEvents.recipes(event => {
event.shaped(Item.of('quark:ancient_tome', 2, '{StoredEnchantments:[{id:"minecraft:power",lvl:5s}]}'), [
'ABA',
'BCB',
'ABA'
], {
A: 'minecraft:experience_bottle',
B: Item.of('minecraft:enchanted_book').enchant('minecraft:power', 5),
C: Item.of('quark:ancient_tome', '{StoredEnchantments:[{id:"minecraft:power",lvl:5s}]}')
})
})
the count, correct
also, I recommend getting probejs
??kjsaddons
ProbeJS is an addon mod for KubeJS that generates typings files for VSCode, allowing VSCode to offer autocompletions for a ton of things!
Mod by @sacred panther
helps a lot
Ticket re-opened!
So it's not working yet apparently, the recipe doesn't respect the input nbt, I tried using sharpness books and it still gave me power
item are ignore nbt on 1.19 by default
so you will have to add .strongNBT() at the end of the Item.ofs, like this:
ServerEvents.recipes(event => {
event.shaped(Item.of('quark:ancient_tome', 2, '{StoredEnchantments:[{id:"power",lvl:5s}]}'), [
'ABA',
'BCB',
'ABA'
], {
A: 'experience_bottle',
B: Item.of('enchanted_book').enchant('power', 5).strongNBT(),
C: Item.of('quark:ancient_tome', '{StoredEnchantments:[{id:"power",lvl:5s}]}').strongNBT()
})
})
thanks