#NBT of at least a certain value

17 messages · Page 1 of 1 (latest)

sonic prism
#

Is there a way to include a >= statement in NBT data in a recipe?

Forge v43.2.13
KubeJS v1902.6.1-build.364

Code:

e.shaped('thermal:dynamo_gourmand', [
        ' F ',
        'RMR',
        'ISI'
    ], {
        I: '#forge:ingots/tin',
        R: '#forge:ingots/iron',
        F: 'thermal:rf_coil',
        S: Item.of('spirit:soul_crystal', '{StoredEntity:{Souls:4}}').weakNBT(),
        M: 'excon:complex_mechanism'
    })

Goal: Have a recipe that takes soul crystals with greater than or equal to 4 souls.

Currently the recipe works if the gen contains exactly 4 souls, but I'm struggling to find a way to include logic in the NBT.

Any help is greatly appreciated. I've been searching other support tickets, checking javascript forums, and trying things from the wiki for a good hour now so I'm at a bit of a loss.

grizzled lanternBOT
#

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

sonic prism
#

Just tried defining an array and using that and that also failed:

var souls = [4,5,6,7,8,9,10,12,13]
    e.shaped('thermal:dynamo_gourmand', [
        ' F ',
        'RMR',
        'ISI'
    ], {
        I: '#forge:ingots/tin',
        R: '#forge:ingots/iron',
        F: 'thermal:rf_coil',
        S: Item.of('spirit:soul_crystal', `{StoredEntity:{Souls:${souls}}}`).weakNBT(),
        M: 'excon:complex_mechanism'
    })
shy marlin
#

You could try Ingredient.customNBT('spirit:soul_crystal', nbt => nbt?.StoredEntity?.Souls >= 4)

dusty hedge
#

never knew that existed

sonic prism
#

so it looks like that adds the recipe, but no soul crystals satisfy the requirement. There's nothing in the logs so i'm guessing it's adding NBT, but not registering the logic.

#

gave it a try with weakNBT() too, but that did error and said that it couldn't find the function.

short shore
#

so atm, this isnt possible unless you can find a mod that adds that sort of ingredient

sonic prism
#

ahh okay, thanks for the assist! I won't beat my head against it too much more then.

sonic prism
#

I don't believe that there is a hard cap

dull glen
#

do you know if custom ingredient action is working?

sonic prism
#

I have never used that particular function before. After looking at the example what would i have it return if it doesn't meet the requirement? I can see that it lets me do some logic in a custom action, but i don't totally see how i would use this to prohibit certain recipes.

shy marlin
#

At the cost of not displaying properly in jei/rei, you can do this

    Ingredient.of('spirit:soul_crystal')
      .subtract(Item.of('spirit:soul_crystal', '{StoredEntity:{Souls:3}}').weakNBT())
      .subtract(Item.of('spirit:soul_crystal', '{StoredEntity:{Souls:2}}').weakNBT())
      .subtract(Item.of('spirit:soul_crystal', '{StoredEntity:{Souls:1}}').weakNBT())
      .subtract(Item.of('spirit:soul_crystal').strongNBT())
sonic prism
#

that'll do! Thanks!