#Replace recipe with original item NBT included

46 messages · Page 1 of 1 (latest)

fast linden
#

Hi! I'm trying to replace a recipe conflict for the Tetra toolbelt like so:

// String mesh recipe conflicts with Tetra rope
event.remove({ output: 'tetra:modular_toolbelt' });
event.shaped('tetra:modular_toolbelt', [
    ' R ',
    'R R',
    ' R ',
], {
    R: 'farmersdelight:rope',
});

But it isn't removed because of NBT data attached to the crafted item. This instead creates a recipe for a "blank" version of the toolbelt without NBT. The blank toolbelt opens its interface, but does not have any other functionality, due to Tetra's modular material system.

The toolbelt is a very special item that is described here in more detail: https://tetra.fandom.com/wiki/Toolbelt

I don't want to have to manually copy every value from /data into my KubeJS script. Is it possible for KubeJS to inherit the default NBT data from the original recipe?

hearty blazeBOT
#

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

tacit wraith
#

try using event.replaceInput(item)

fast linden
# tacit wraith try using event.replaceInput(*item*)
// String mesh recipe conflicts with Tetra rope
// event.remove({ output: 'tetra:modular_toolbelt' });
// event.shaped('tetra:modular_toolbelt', [
//     ' R ',
//     'R R',
//     ' R ',
// ], {
//     R: 'farmersdelight:rope',
// });
event.replaceInput({ output: 'tetra:modular_toolbelt' }, 'minecraft:string', 'farmersdelight:rope');

did i do something wrong? seems like maybe it's not replacing this item at all because of its NBT

#

there's a recipe ID... does it have to do with that?

tacit wraith
#

or true

fast linden
#

syntax seems fine?

tacit wraith
#

yes it is fine

#

held item and write /kubejs hand

#

try with nbt thing

fast linden
tacit wraith
#

because recipe output has nbt

fast linden
#

right

tacit wraith
#

click on green text to copy

fast linden
#

ah sweet, how would i implement this then?

#

would prefer to not have to rewrite it though, but it is what it is

tacit wraith
#

simply paste it into {output: here}

#

if that doesn't work just re-create the recipe you want and give id that has original recipes id

fast linden
#

not sure

tacit wraith
#

because you put id on replaceInput function

fast linden
#

oh okay lol

#

what should i do?

tacit wraith
#

create the recipe you want with event.shaped

#

and add .id()

#

for example

#

but replace the output with that green text you copied

fast linden
#

ahh okay, i'll try it

fast linden
#
// String mesh recipe conflicts with Tetra rope
const modular_toolbelt = Item.of('tetra:modular_toolbelt', '{id:"d5fdaa4d-04d7-4f71-8f7a-2a3d4b0b9fe4","toolbelt/belt":"toolbelt/belt","toolbelt/belt_material":"belt/rope","toolbelt/slot1":"toolbelt/strap_slot1","toolbelt/strap_slot1_material":"strap1/leather"}');
event.remove({ output: modular_toolbelt });
event.shaped(modular_toolbelt, [
    ' R ',
    'R R',
    ' R ',
], {
    R: 'farmersdelight:rope',
}).id('tetra:toolbelt_modular');
#

thanks so much!!

hearty blazeBOT
#

Ticket closed!

fast linden
#

i do wish there was a way to just inherit the nbt, but this works

#

also, is that id parameter in the modular toolbelt NBT important to change every time? @tacit wraith

#

or should i just remove it from the data entirely?

#

it does seem to change every time i craft the item, so never mind i guess?

#

probably better to remove the NBT id anyways

#

at least in the code - i'm assuming tetra generates a fresh one every time

#

tried removing ID from NBT, works great

tacit wraith
#

it is much better than manually removing the recipe

fast linden
#

i've been doing stuff like this in my code:

event.remove({ output: 'backpacked:backpack' });
event.shaped('backpacked:backpack', [
// ...
#

so i should just use .id from now on?

tacit wraith