#Need help with creating helper function

4 messages · Page 1 of 1 (latest)

merry meadow
#

Hi, I'm trying to wrap a custom recipe in a helper function to avoid spaghetti. The code is interpreted without any error but the function doesn't produce any recipes. I would be glad if someone could enlighten me as to why. Recipe type example: (https://github.com/BluSunrize/ImmersiveEngineering/blob/1.20.1/src/generated/resources/data/immersiveengineering/recipes/blastfurnace/steel.json)

function blastFurnace(input, output, slag, time) {
      slag = slag == undefined ? 'forge:slag' : slag;
      time = time == undefined ? 1200 : time;


      let inputType = input[0] == '#' ? 'tag' : 'item';
      let outputType = output[0] == '#' ? 'tag' : 'item';
      let slagType = slag[0] == '#' ? 'tag' : 'item';

      let template = {
        "type": "immersiveengineering:blast_furnace",
        "input": {},
        "result": {},
        "slag": {},
        "time": time
      }

      template.input[inputType] = input;
      template.result[outputType] = output;
      template.slag[slagType] = slag;

      event.custom(template)
}

blastFurnace('#forge:raw_materials/aluminum', '#forge:ingots/aluminum')
blastFurnace('minecraft:ancient_debris', 'minecraft:netherite_scrap')
visual coralBOT
#

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

jagged treeBOT
#

You can find your KubeJS server log in /minecraft/logs/kubejs/server.log.
If you are on 1.18 or below it will be called server.txt.
Please send it if asked, as it contains helpful information.

atomic dove
#

Btw you can use InputItem(string).toJson() to get the json automatically so you don't need to construct it