KubeJS

KubeJS

61M Downloads

NBT Outputs seem broken in 1605.3.15-build.75

TemperedFool opened this issue ยท 4 comments

commented

This is Enigmatica 6 dev, with forge version 36.2.0; we have a bunch of recipes with NBT output, for example the following script:

onEvent('recipes', (event) => {
    const recipes = [
        /*{
            cast: {
                tag: 'tconstruct:casts/single_use/gem'
            },
            cast_consumed: true,
            fluid: {
                name: 'kubejs:molten_cobalt_bee',
                amount: 500
            },
            result: 'resourcefulbees:cobalt_bee_spawn_egg',
            cooling_time: 600
        }*/
        {
            cast: {
                item: 'resourcefulbees:bee_jar'
            },
            cast_consumed: true,
            fluid: {
                name: 'kubejs:molten_cobalt_bee',
                amount: 500
            },
            result: Item.of('resourcefulbees:bee_jar', {Entity: "resourcefulbees:cobalt_bee", BeeType: "cobalt", Color: "#209EBD"}).toJson(),
            cooling_time: 200,
            id: 'tconstruct:kjs_cobalt_bee_jar'
        },
        {
            cast: {
                item: 'resourcefulbees:bee_jar'
            },
            cast_consumed: true,
            fluid: {
                name: 'kubejs:liquid_skyslime_bee',
                amount: 500
            },
            result: Item.of('resourcefulbees:bee_jar', {Entity: "resourcefulbees:skyslime_bee", BeeType: "skyslime", Color: "#72CFCB"}).toJson(),
            cooling_time: 100,
            id: 'tconstruct:kjs_skyslime_bee_jar'
        },
        {
            cast: {
                item: 'resourcefulbees:bee_jar'
            },
            cast_consumed: true,
            fluid: {
                name: 'kubejs:liquid_ichor_bee',
                amount: 500
            },
            result: Item.of('resourcefulbees:bee_jar', {Entity: "resourcefulbees:ichor_bee", BeeType: "ichor", Color: "#FDAB69"}).toJson(),
            cooling_time: 100,
            id: 'tconstruct:kjs_ichor_bee_jar'
        },
        {
            cast: {
                item: 'resourcefulbees:bee_jar'
            },
            cast_consumed: true,
            fluid: {
                name: 'kubejs:liquid_enderslime_bee',
                amount: 500
            },
            result: Item.of('resourcefulbees:bee_jar', {Entity: "resourcefulbees:enderslime_bee", BeeType: "enderslime", Color: "#C75EFF"}).toJson(),
            cooling_time: 100,
            id: 'tconstruct:kjs_enderslime_bee_jar'
        }
    ];

    recipes.forEach((recipe) => {
        const re = event.custom({
            type: 'tconstruct:casting_table',
            cast: recipe.cast,
            cast_consumed: recipe.cast_consumed,
            fluid: recipe.fluid,
            result: recipe.result,
            cooling_time: recipe.cooling_time
        });
        if (recipe.id) {
            re.id(recipe.id);
        }
    });
});

In build.73 it produces the following:

image

but in build.75:

image

Seems like something between messed up my use of Item.of() to produce outputs with NBT. If this isn't the correct way to do this and I've run into something getting depreciated, just let me know what I should be doing instead!

Edit: In case it's not clear, in the first image you can see the bee jars are full of happy looking little bees; in the second they're empty as the outputs don't have any NBT (despite having NBT in the script).

commented

I'll also add that using .weakNBT() with the NBT Ingredient Predicate mod (https://www.curseforge.com/minecraft/mc-mods/nbt-ingredient-predicate) just seems to strip NBT from the ingredient.

Code:

onEvent('recipes', (event) => {

    const newRecipes = [
        {
            output: 'resourcefulbees:mana_bee_spawn_egg',
            pattern: ['   ', ' A ', '   '],
            key: {
                A: Item.of('resourcefulbees:bee_jar', {Entity: "resourcefulbees:iron_bee", BeeType: "iron"}).weakNBT()
            }
        }
    ];

    newRecipes.forEach((recipe) => {
        if (recipe.id) {
            event.shaped(recipe.output, recipe.pattern, recipe.key).id(recipe.id);
        } else {
            event.shaped(recipe.output, recipe.pattern, recipe.key);
        }
    });
});

Result:
image

commented

Lat requested that for the main issue I swap .toJson() for .toResultsJson(), but this yielded the same results as above.

commented

I believe the main issue here has been fixed with build 80. Going to test the secondary issue with weakNBT() later.

commented

Alright, build 80 also seems to resolve the .weakNBT() issue. Thanks y'all!