Custom Machinery

Custom Machinery

3M Downloads

when the item's NBT data contains nested structures

fafaovo opened this issue ยท 1 comments

commented

minecraft version : 1.16.5 custom-machinery : Custom-Machinery-1.16.5-0.5.8m

I would like to convey that within the kubejs script, the function .produceItem(Item) supports the use of kubejs's Item.of(). However, when the item's NBT data contains nested structures, there appears to be an issue with the item not being produced correctly.

for example

event.recipes.custommachinery.custom_machine("custommachinery:constellation_observatory", 80)
    .requireItem('astralsorcery:parchment')
    .produceItem(Item.of('astralsorcery:constellation_paper', '{astralsorcery:{constellationName:"astralsorcery:discidia"}}'))

This is a star map from Starlight magic
He cannot be produced normally,Even if you can see it in JEI
I think it might be a BUG
So I took an alternative solution

 event.recipes.custommachinery.custom_machine("custommachinery:constellation_observatory", 80)
        .requireItem('astralsorcery:parchment')
        .produceItem(Item.of('astralsorcery:constellation_paper', '{astralsorcery:{constellationName:"astralsorcery:discidia"}}'))
        .requireFunctionOnEnd(ctx => {
            ctx.machine.addItemToSlot(
                "output2",
                'astralsorcery:constellation_paper', '{astralsorcery:{constellationName:"astralsorcery:discidia"}}',
                false);
            return Result.success()
        })

This method can be used normally
But it's weird

commented

Honestly 1.16 in not supported since such a very long time, I forgot how CM/KubeJS/MC handle nbt for items in that version.
If it's a bug it might be fixed in newest versions.