#Mass mystical agriculture seeds & Insolator

11 messages · Page 1 of 1 (latest)

marsh fjord
#

Hello,

I am working on a script that enables all mystical agriculture seeds to work in the thermal Insolator. Right now, I am adding a recipe for each seed. While that works, it's gonna take a while for all the seeds. Is there a more efficient way?

wanton deltaBOT
#

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

amber grail
#

you can call "let". the following should be about what you need

let mysticalInsolate = (material, chance) => {
    let seed = `mysticalagriculture:${material}_seeds`
    let essence = `mysticalagriculture:${material}_essence`

    event.custom({
        "type": "thermal:insolator",
        "ingredient": {
            "item": seed
        },
        "result": [
            {
                "item": essence,
                "chance": chance
            },
            {
                "item": seed
            },
            {
                "item": "mysticalagriculture:fertilized_essence",
                "chance": 0.1
            }
        ],
        "experience": 0.15
    })
}

mysticalInsolate("deepslate", 0.8)
mysticalInsolate("diamond", 0.8)

I think this should work based on my understanding of mystical agriculture. This example should always give the seed back, as well as an essence sometimes at the chance you specify.

marsh fjord
#

Okay
Ill give it a try

royal slate
#

Functions in JS are just objects with a property of being callable

#

In fact, all of these are valid ways you can declare a function:

// Function statement
function mysticalInsolate(material, chance) {
  // ...
}
// Function expression
let mysticalInsolate = function (material, chance) {
  // ...
}
// Arrow function expression
let mysticalInsolate = (material, chance) => {
  // ...
}
marsh fjord
#

Ill post what i have in a bit

#
ServerEvents.recipes(event =>
{
let mysticalInsolate = (material, chance) =>
    {
        let seed = 'mysticalagriculture:${material}_seeds'
        let essence = 'mysticalagriculture:${material}_essence'

        event.custom(
            {
                "type": "thermal:insolator",
                "ingredient":
                {
                    "item": seed
                },
                "result":
                [
                    {
                        "item": essence,
                        "chance": chance
                    },
                    {
                        "item": seed
                    },
                    {
                        "item": "mysticalagriculture:fertilized_essence",
                        "chance": 0.1
                    }
                ],
                "experience": 0.15
            }
        )
    }

    mysticalInsolate("dragon_egg", 0.8)
})
#

I found the error, I used ' instead of `