#Multi Step Recipe with Mekanism

122 messages · Page 1 of 1 (latest)

upbeat vector
#

I am looking to create a recipe chain that can use a single item and progress through a series of machines to create an output, similar to the create sequenced assembly. i expected to use NBT data to control recipes but that seems like its not being respected by Mek. I have added the files do you can see where im going with this. What am i doing wrong? can i use Create Sequenced Assembly to complete this with Mek machines? is there something else i would be better off doing instead?

tulip pondBOT
#

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

eternal domeBOT
#

Paste version of step_1.json, step_2.json, step_3.json, step_4.json, step_5.json from @upbeat vector

agile wolf
#

these are all datapack recipes and have nothing to do with KJS

upbeat vector
agile wolf
#

you need to ask Mekanism or check the minecraft wiki

upbeat vector
#

the problem im having is understanding how to generate the individual steps without overwriting or just allowing all interchangeably

agile wolf
#

i know how KJS works. i said what i said
you do with that information as you will.

upbeat vector
#

LUL_devcord so if i come back with this exact same thing in one file instead of 5 (using JS instead of JSON) you will be more willing to assist me. got it... gimme like 6 hours while i figure out how to rewrite everything ive made (200+ files) to accommodate that

#

nvm, i just used AI to rewrite this shit quick and dirty so i can at least understand what the fuck im doing wrong. or if its even possible...

ServerEvents.recipes(event => {

  const WAFER = 'sgcommunity_pack:incomplete_mosfet_wafer'

  function waferSNBT(step, text) {
    return `{display:{Lore:['"${text}"']},step:${step}}`
  }

  // Step 1 → Step 2
  event.recipes.mekanism.injecting({
    item_input: { item: "sgcommunity_pack:silicon_wafer", count: 1 },
    chemical_input: { amount: 1, chemical: "mekanism:silicon" },
    output: { id: WAFER, nbt: waferSNBT(2, "Step 2: Inject Water Vapor (2000mb)") }
  })

  // Step 2 → Step 3
  event.recipes.mekanism.injecting({
    item_input: { item: WAFER, count: 1, nbt: waferSNBT(2, "Step 2: Inject Water Vapor (2000mb)") },
    chemical_input: { amount: 2000, tag: "mekanism:water_vapor" },
    output: { id: WAFER, nbt: waferSNBT(3, "Step 3: Etch Wafer") }
  })

  // Step 3 → Step 4
  event.recipes.mekanism.injecting({
    item_input: { item: WAFER, count: 1, nbt: waferSNBT(3, "Step 3: Etch Wafer") },
    chemical_input: { amount: 400, chemical: "mekanism:hydrofluoric_acid" },
    output: { id: WAFER, nbt: waferSNBT(4, "Step 4: Inject Boron") }
  })

  // Step 4 → Step 5
  event.recipes.mekanism.injecting({
    item_input: { item: WAFER, count: 1, nbt: waferSNBT(4, "Step 4: Inject Boron") },
    chemical_input: { amount: 400, chemical: "mekanism:boron_trifluoride" },
    output: { id: WAFER, nbt: waferSNBT(5, "Step 5: Inject Phosphorus") }
  })

  // Step 5 → Final MOSFET Wafer
  event.recipes.mekanism.injecting({
    item_input: { item: WAFER, count: 1, nbt: waferSNBT(5, "Step 5: Inject Phosphorus") },
    chemical_input: { amount: 200, chemical: "mekanism:phosphorus" },
    output: { id: "sgcommunity_pack:mosfet_wafer" }
  })

})
#

Should I be using NBT data to mek control recipes? should i use something else?

#

is there a better way? im open to any ideas on how this is supposed to work

#

im not keen on making separate items for each recipe and i would like to control the input/output of each recipe using an NBT like system... instead of just doing multiple items and seperate recipes

#

(but if thats the final result i will deal with it)

upbeat vector
#

I also posted all this in the Mek discord to see if anyone there can help

upbeat vector
#

I could use some assistance if anyone wants to chime in. I still havent figured out a better way...

fickle ore
edgy rivet
#

Well

#

Your output is using id

#

Mek outputs use items

#

Here I’ll summarize

#

The idea is possible, but the script is using the wrong Mekanism recipe format. The main issues are that the output is written with id instead of item, the NBT item input is in the wrong format, the injecting keys may not match the exact 1.20.1 Mekanism schema, and mekanism:silicon is probably invalid there because silicon is an item, not a chemical. So what needs to be fixed is the recipe structure itself: use the correct output key, convert the item input to proper NBT ingredient format, and match the exact field names/types your Mekanism version expects.
@upbeat vector

upbeat vector
upbeat vector
# fickle ore just use intermediary items?

There are five recipe chains similar to this and this is the smallest one I would rather not create 100 new items and clog up JEI with the same thing over and over again...

edgy rivet
#

Use this

#

ServerEvents.recipes(event => {
const BASE_WAFER = 'sgcommunity_pack:incomplete_mosfet_wafer'

function waferComponents(step, text) {
return {
'minecraft:custom_data': {
sgcommunity_pack: {
mosfet_step: step
}
},
'minecraft:lore': [
{ text: text, color: 'gray' }
]
}
}

function waferInput(step, text) {
return {
ingredient: {
type: 'neoforge:components',
items: [BASE_WAFER],
components: waferComponents(step, text),
strict: false
},
amount: 1
}
}

function waferOutput(step, text) {
return {
id: BASE_WAFER,
count: 1,
components: waferComponents(step, text)
}
}

// Step 1 -> Step 2
event.custom({
type: 'mekanism:injecting',
item_input: {
ingredient: { item: 'sgcommunity_pack:silicon_wafer' },
amount: 1
},
chemical_input: {
tag: 'mekanism:water_vapor',
amount: 2000
},
output: waferOutput(2, 'Step 2: Inject Water Vapor (2000 mB)')
})

// Step 2 -> Step 3
event.custom({
type: 'mekanism:injecting',
item_input: waferInput(2, 'Step 2: Inject Water Vapor (2000 mB)'),
chemical_input: {
chemical: 'mekanism:hydrofluoric_acid',
amount: 400
},
output: waferOutput(3, 'Step 3: Etch Wafer')
})

// Step 3 -> Step 4
event.custom({
type: 'mekanism:injecting',
item_input: waferInput(3, 'Step 3: Etch Wafer'),
chemical_input: {
chemical: 'mekanism:boron_trifluoride',
amount: 400
},
output: waferOutput(4, 'Step 4: Inject Boron')
})

// Step 4 -> Step 5
event.custom({
type: 'mekanism:injecting',
item_input: waferInput(4, 'Step 4: Inject Boron'),
chemical_input: {
chemical: 'mekanism:phosphorus',
amount: 200
},
output: waferOutput(5, 'Step 5: Inject Phosphorus')
})

// Step 5 -> Final
event.custom({
type: 'mekanism:injecting',
item_input: waferInput(5, 'Step 5: Inject Phosphorus'),
chemical_input: {
chemical: 'mekanism:phosphorus',
amount: 200
},
output: {
id: 'sgcommunity_pack:mosfet_wafer',
count: 1
}
})
})

#

@upbeat vector

#

Actually

#

Hold on that’s mainly just patched let me send you a clean one

#

ServerEvents.recipes(event => {
const INCOMPLETE = 'sgcommunity_pack:incomplete_mosfet_wafer'
const FINAL = 'sgcommunity_pack:mosfet_wafer'
const START = 'sgcommunity_pack:silicon_wafer'

function waferComponents(step, label) {
return {
'minecraft:custom_data': {
sgcommunity_pack: {
mosfet_step: step,
mosfet_label: label
}
}
}
}

function stagedWaferIngredient(step, label) {
return {
ingredient: {
type: 'neoforge:components',
items: [INCOMPLETE],
components: waferComponents(step, label),
strict: false
},
amount: 1
}
}

function stagedWaferOutput(step, label) {
return {
item: INCOMPLETE,
count: 1,
components: waferComponents(step, label)
}
}

// Step 1 -> Step 2: Inject Water Vapor
event.custom({
type: 'mekanism:injecting',
item_input: {
ingredient: { item: START },
amount: 1
},
chemical_input: {
tag: 'mekanism:water_vapor',
amount: 2000
},
output: stagedWaferOutput(2, 'Step 2: Inject Water Vapor (2000 mB)')
})

// Step 2 -> Step 3: Etch Wafer
event.custom({
type: 'mekanism:injecting',
item_input: stagedWaferIngredient(2, 'Step 2: Inject Water Vapor (2000 mB)'),
chemical_input: {
chemical: 'mekanism:hydrofluoric_acid',
amount: 400
},
output: stagedWaferOutput(3, 'Step 3: Etch Wafer')
})

// Step 3 -> Step 4: Inject Boron
event.custom({
type: 'mekanism:injecting',
item_input: stagedWaferIngredient(3, 'Step 3: Etch Wafer'),
chemical_input: {
chemical: 'mekanism:boron_trifluoride',
amount: 400
},
output: stagedWaferOutput(4, 'Step 4: Inject Boron')
})

// Step 4 -> Final MOSFET Wafer: Inject Phosphorus
event.custom({
type: 'mekanism:injecting',
item_input: stagedWaferIngredient(4, 'Step 4: Inject Boron'),
chemical_input: {
chemical: 'mekanism:phosphorus',
amount: 200
},
output: {
item: FINAL,
count: 1
}
})
})

#

use this and let me know

upbeat vector
#

testing now, one min

edgy rivet
#

Okay

upbeat vector
#

I have created a silicon chemical (actually several chemicals) that is what was in the first recipe. i will add that back myself shortly after i verify that this even works

upbeat vector
# edgy rivet ServerEvents.recipes(event => { const INCOMPLETE = 'sgcommunity_pack:incomplet...
[09:19:35] [ERROR] ! server_scripts:mosfet_chain.js#52: Failed to create custom recipe from json {"type":"mekanism:injecting","item_input":{"ingredient":{"type":"neoforge:components","items":["sgcommunity_pack:incomplete_mosfet_wafer"],"components":{"minecraft:custom_data":{"sgcommunity_pack":{"mosfet_step":2,"mosfet_label":"Step 2: Inject Water Vapor (2000 mB)"}}},"strict":false},"amount":1},"chemical_input":{"chemical":"mekanism:hydrofluoric_acid","amount":400},"output":{"item":"sgcommunity_pack:incomplete_mosfet_wafer","count":1,"components":{"minecraft:custom_data":{"sgcommunity_pack":{"mosfet_step":3,"mosfet_label":"Step 3: Etch Wafer"}}}}}: Failed to read required component 'output: item_stack' - java.lang.IllegalStateException: No key id in MapLike[{"item":"sgcommunity_pack:incomplete_mosfet_wafer","count":1,"components":{"minecraft:custom_data":{"sgcommunity_pack":{"mosfet_step":3,"mosfet_label":"Step 3: Etch Wafer"}}}}]
[09:19:35] [ERROR] ! server_scripts:mosfet_chain.js#63: Failed to create custom recipe from json {"type":"mekanism:injecting","item_input":{"ingredient":{"type":"neoforge:components","items":["sgcommunity_pack:incomplete_mosfet_wafer"],"components":{"minecraft:custom_data":{"sgcommunity_pack":{"mosfet_step":3,"mosfet_label":"Step 3: Etch Wafer"}}},"strict":false},"amount":1},"chemical_input":{"chemical":"mekanism:boron_trifluoride","amount":400},"output":{"item":"sgcommunity_pack:incomplete_mosfet_wafer","count":1,"components":{"minecraft:custom_data":{"sgcommunity_pack":{"mosfet_step":4,"mosfet_label":"Step 4: Inject Boron"}}}}}: Failed to read required component 'output: item_stack' - java.lang.IllegalStateException: No key id in MapLike[{"item":"sgcommunity_pack:incomplete_mosfet_wafer","count":1,"components":{"minecraft:custom_data":{"sgcommunity_pack":{"mosfet_step":4,"mosfet_label":"Step 4: Inject Boron"}}}}]
[09:19:35] [ERROR] ! server_scripts:mosfet_chain.js#74: Failed to create custom recipe from json {"type":"mekanism:injecting","item_input":{"ingredient":{"type":"neoforge:components","items":["sgcommunity_pack:incomplete_mosfet_wafer"],"components":{"minecraft:custom_data":{"sgcommunity_pack":{"mosfet_step":4,"mosfet_label":"Step 4: Inject Boron"}}},"strict":false},"amount":1},"chemical_input":{"chemical":"mekanism:phosphorus","amount":200},"output":{"item":"sgcommunity_pack:mosfet_wafer","count":1}}: Failed to read required component 'output: item_stack' - java.lang.IllegalStateException: No key id in MapLike[{"item":"sgcommunity_pack:mosfet_wafer","count":1}]
#

Failed to read required component 'output: item_stack' - java.lang.IllegalStateException: No key id this error means the output needs id not item

edgy rivet
#

Fuh and I just left my crib

#

Um hold on

#

ServerEvents.recipes(event => {
const INCOMPLETE = 'sgcommunity_pack:incomplete_mosfet_wafer'
const FINAL = 'sgcommunity_pack:mosfet_wafer'
const START = 'sgcommunity_pack:silicon_wafer'

function waferComponents(step, label) {
return {
'minecraft:custom_data': {
sgcommunity_pack: {
mosfet_step: step,
mosfet_label: label
}
}
}
}

function stagedWaferIngredient(step, label) {
return {
ingredient: {
type: 'neoforge:components',
items: [INCOMPLETE],
components: waferComponents(step, label),
strict: false
},
amount: 1
}
}

function stagedWaferOutput(step, label) {
return {
id: INCOMPLETE,
count: 1,
components: waferComponents(step, label)
}
}

event.custom({
type: 'mekanism:injecting',
item_input: {
ingredient: {
item: START
},
amount: 1
},
chemical_input: {
tag: 'mekanism:water_vapor',
amount: 2000
},
output: stagedWaferOutput(2, 'Step 2: Inject Water Vapor (2000 mB)')
})

event.custom({
type: 'mekanism:injecting',
item_input: stagedWaferIngredient(2, 'Step 2: Inject Water Vapor (2000 mB)'),
chemical_input: {
chemical: 'mekanism:hydrofluoric_acid',
amount: 400
},
output: stagedWaferOutput(3, 'Step 3: Etch Wafer')
})

event.custom({
type: 'mekanism:injecting',
item_input: stagedWaferIngredient(3, 'Step 3: Etch Wafer'),
chemical_input: {
chemical: 'mekanism:boron_trifluoride',
amount: 400
},
output: stagedWaferOutput(4, 'Step 4: Inject Boron')
})

event.custom({
type: 'mekanism:injecting',
item_input: stagedWaferIngredient(4, 'Step 4: Inject Boron'),
chemical_input: {
chemical: 'mekanism:phosphorus',
amount: 200
},
output: {
id: FINAL,
count: 1
}
})
})

#

let me know as I’m doing this from my phone atp

edgy rivet
#

@upbeat vector

upbeat vector
edgy rivet
#

Gotchu

upbeat vector
#

Strike that, 2 hours

edgy rivet
upbeat vector
# edgy rivet ServerEvents.recipes(event => { const INCOMPLETE = 'sgcommunity_pack:incomplet...

Failed to read required component 'item_input: flat_sized_ingredient' - java.lang.IllegalStateException: No key tag

  • [12:26:11] [ERROR] ! server_scripts:mosfet_chain.js#37: Failed to create custom recipe from json {"type":"mekanism:injecting","item_input":{"ingredient":{"item":"sgcommunity_pack:silicon_wafer"},"amount":1},"chemical_input":{"tag":"mekanism:water_vapor","amount":2000},"output":{"id":"sgcommunity_pack:incomplete_mosfet_wafer","count":1,"components":{"minecraft:custom_data":{"sgcommunity_pack":{"mosfet_step":2,"mosfet_label":"Step 2: Inject Water Vapor (2000 mB)"}}}}}: Failed to read required component 'item_input: flat_sized_ingredient' - java.lang.IllegalStateException: No key tag in MapLike[{"ingredient":{"item":"sgcommunity_pack:silicon_wafer"},"amount":1}]; No key item in MapLike[{"ingredient":{"item":"sgcommunity_pack:silicon_wafer"},"amount":1}]
edgy rivet
#

Item input shape is wrong

#

Two seconds

#

We fixed the output alr

edgy rivet
# upbeat vector `Failed to read required component 'item_input: flat_sized_ingredient' - java.la...

Replace it with this and let me know, I kinda gotta do these 1 by 1

ServerEvents.recipes(event => {
const INCOMPLETE = 'sgcommunity_pack:incomplete_mosfet_wafer'
const FINAL = 'sgcommunity_pack:mosfet_wafer'
const START = 'sgcommunity_pack:silicon_wafer'

function waferComponents(step, label) {
return {
'minecraft:custom_data': {
sgcommunity_pack: {
mosfet_step: step,
mosfet_label: label
}
}
}
}

function stagedWaferInput(step, label) {
return {
type: 'neoforge:components',
items: [INCOMPLETE],
components: waferComponents(step, label),
strict: false,
amount: 1
}
}

function stagedWaferOutput(step, label) {
return {
id: INCOMPLETE,
count: 1,
components: waferComponents(step, label)
}
}

event.custom({
type: 'mekanism:injecting',
item_input: {
item: START,
amount: 1
},
chemical_input: {
tag: 'mekanism:water_vapor',
amount: 2000
},
output: stagedWaferOutput(2, 'Step 2: Inject Water Vapor (2000 mB)')
})

event.custom({
type: 'mekanism:injecting',
item_input: stagedWaferInput(2, 'Step 2: Inject Water Vapor (2000 mB)'),
chemical_input: {
chemical: 'mekanism:hydrofluoric_acid',
amount: 400
},
output: stagedWaferOutput(3, 'Step 3: Etch Wafer')
})

event.custom({
type: 'mekanism:injecting',
item_input: stagedWaferInput(3, 'Step 3: Etch Wafer'),
chemical_input: {
chemical: 'mekanism:boron_trifluoride',
amount: 400
},
output: stagedWaferOutput(4, 'Step 4: Inject Boron')
})

event.custom({
type: 'mekanism:injecting',
item_input: stagedWaferInput(4, 'Step 4: Inject Boron'),
chemical_input: {
chemical: 'mekanism:phosphorus',
amount: 200
},
output: {
id: FINAL,
count: 1
}
})
})

upbeat vector
#

"per_tick_usage":true

edgy rivet
#

Prefect! Yep you can use this for your step 1 for example

#

event.custom({
type: 'mekanism:injecting',
item_input: {
item: START,
amount: 1
},
chemical_input: {
chemical: 'mekanism:silicon',
amount: 2000
},
per_tick_usage: true,
output: stagedWaferOutput(1, 'Step 1: Inject Silicon (2000 mB)')
})

#

But yea practical read is is:
• per_tick_usage: true = better for a recipe that should draw the chemical gradually while the machine runs
• per_tick_usage: false = better when the machine should only consume the chemical in one shot at completion

upbeat vector
#

thanks man, this is a huge step toward moving to 1.21.1, now i can start applying this setup to the other 50 recipes

edgy rivet
#

Then your water vapor step would become step 1 ->2

upbeat vector
#

yes

edgy rivet
upbeat vector
#

oh

edgy rivet
#

Feel free to friend and dm me if you ever need any future help, apologies for how long it took I had to do this from my phone xd

upbeat vector
#

one last thing

#

the subtext isnt showing up, lemme get screenshots of the old way it was done

edgy rivet
#

Okay

upbeat vector
edgy rivet
#

Use this in your output component right now we have it storing only Minecraft:custom_data

function waferComponents(step, label) {
return {
'minecraft:custom_data': {
sgcommunity_pack: {
mosfet_step: step,
mosfet_label: label
}
},
'minecraft:lore': [
{
text: label,
color: 'gray',
italic: false
}
]
}
}

upbeat vector
#

the steps dont show up in the new version

edgy rivet
#

Here I’ll apply it and send you the new script

#

Lore added back

ServerEvents.recipes(event => {
const INCOMPLETE = 'sgcommunity_pack:incomplete_mosfet_wafer'
const FINAL = 'sgcommunity_pack:mosfet_wafer'
const START = 'sgcommunity_pack:silicon_wafer'

function waferComponents(step, label) {
return {
'minecraft:custom_data': {
sgcommunity_pack: {
mosfet_step: step,
mosfet_label: label
}
},
'minecraft:lore': [
{
text: label,
color: 'gray',
italic: false
}
]
}
}

function stagedWaferInput(step, label) {
return {
type: 'neoforge:components',
items: [INCOMPLETE],
components: waferComponents(step, label),
strict: false,
amount: 1
}
}

function stagedWaferOutput(step, label) {
return {
id: INCOMPLETE,
count: 1,
components: waferComponents(step, label)
}
}

event.custom({
type: 'mekanism:injecting',
item_input: {
item: START,
amount: 1
},
chemical_input: {
tag: 'mekanism:water_vapor',
amount: 2000
},
output: stagedWaferOutput(2, 'Step 2: Inject Water Vapor (2000 mB)')
})

event.custom({
type: 'mekanism:injecting',
item_input: stagedWaferInput(2, 'Step 2: Inject Water Vapor (2000 mB)'),
chemical_input: {
chemical: 'mekanism:hydrofluoric_acid',
amount: 400
},
output: stagedWaferOutput(3, 'Step 3: Etch Wafer')
})

event.custom({
type: 'mekanism:injecting',
item_input: stagedWaferInput(3, 'Step 3: Etch Wafer'),
chemical_input: {
chemical: 'mekanism:boron_trifluoride',
amount: 400
},
output: stagedWaferOutput(4, 'Step 4: Inject Boron')
})

event.custom({
type: 'mekanism:injecting',
item_input: stagedWaferInput(4, 'Step 4: Inject Boron'),
chemical_input: {
chemical: 'mekanism:phosphorus',
amount: 200
},
output: {
id: FINAL,
count: 1
}
})
})

upbeat vector
#

I edited the script to add the silicon back:

ServerEvents.recipes(event => {
    const INCOMPLETE = "sgcommunity_pack:incomplete_mosfet_wafer"
    const FINAL = "sgcommunity_pack:mosfet_wafer"
    const START = "sgcommunity_pack:silicon_wafer"

    function waferComponents(step, label) {
        return {
            "minecraft:custom_data": {
                sgcommunity_pack: {
                    mosfet_step: step,
                    mosfet_label: label
                }
            },
            "minecraft:lore": [
                {
                    text: label,
                    color: "purple",
                    italic: true
                }
            ]
        }
    }

    function stagedWaferInput(step, label) {
        return {
            type: "neoforge:components",
            items: [INCOMPLETE],
            components: waferComponents(step, label),
            strict: false,
            amount: 1
        }
    }

    function stagedWaferOutput(step, label) {
        return {
            id: INCOMPLETE,
            count: 1,
            components: waferComponents(step, label)
        }
    }

    event.custom({
        type: "mekanism:injecting",
        item_input: {
            item: START,
            amount: 1
        },
        chemical_input: {
            tag: "mekanism:silicon",
            amount: 1
        },
        output: stagedWaferOutput(2, "Step 2: Inject Water Vapor"),
        "per_tick_usage": true
    })

    event.custom({
        type: "mekanism:injecting",
        item_input: stagedWaferInput(2, "Step 2: Inject Water Vapor"),
        chemical_input: {
            chemical: "mekanism:water_vapor",
            amount: 1
        },
        output: stagedWaferOutput(3, "Step 3: Etch Wafer"),
        "per_tick_usage": true
    })

    event.custom({
        type: "mekanism:injecting",
        item_input: stagedWaferInput(3, "Step 3: Etch Wafer"),
        chemical_input: {
            chemical: "mekanism:hydrofluoric_acid",
            amount: 1
        },
        output: stagedWaferOutput(4, "Step 4: Inject Boron"),
        "per_tick_usage": true
    })

    event.custom({
        type: "mekanism:injecting",
        item_input: stagedWaferInput(4, "Step 4: Inject Boron"),
        chemical_input: {
            chemical: "mekanism:boron_trifluoride",
            amount: 1
        },
        output: stagedWaferOutput(5, "Step 5: Inject Phosphorus"),
        "per_tick_usage": true
    })

    event.custom({
        type: "mekanism:injecting",
        item_input: stagedWaferInput(5, "Step 5: Inject Phosphorus"),
        chemical_input: {
            chemical: "mekanism:phosphorus",
            amount: 1
        },
        output: {
            id: FINAL,
            count: 1
        },
        "per_tick_usage": true
    })
})

and i get this error:
Failed to read required component 'output: item_stack' - java.lang.IllegalStateException: Not a string: {"text":"Step 2: Inject Water Vapor","color":"purple","italic":true} missed input: {"minecraft:lore":[{"text":"Step 2: Inject Water Vapor","color":"purple","italic":true}]}

i think its trying to read the text: label, color: 'purple', italic: true as a string instead of individual components of a subtext

edgy rivet
#

Oh oops, yea i have them reading it as a string entry instead of a full json text component object, use this one and let me know

ServerEvents.recipes(event => {
const INCOMPLETE = 'sgcommunity_pack:incomplete_mosfet_wafer'
const FINAL = 'sgcommunity_pack:mosfet_wafer'
const START = 'sgcommunity_pack:silicon_wafer'

function waferComponents(step, label) {
    return {
        'minecraft:custom_data': {
            sgcommunity_pack: {
                mosfet_step: step,
                mosfet_label: label
            }
        },
        'minecraft:lore': [
            label
        ]
    }
}

function stagedWaferInput(step, label) {
    return {
        type: 'neoforge:components',
        items: [INCOMPLETE],
        components: waferComponents(step, label),
        strict: false,
        amount: 1
    }
}

function stagedWaferOutput(step, label) {
    return {
        id: INCOMPLETE,
        count: 1,
        components: waferComponents(step, label)
    }
}

event.custom({
    type: 'mekanism:injecting',
    item_input: {
        item: START,
        amount: 1
    },
    chemical_input: {
        tag: 'mekanism:silicon',
        amount: 1
    },
    output: stagedWaferOutput(2, 'Step 2: Inject Water Vapor'),
    per_tick_usage: true
})

event.custom({
    type: 'mekanism:injecting',
    item_input: stagedWaferInput(2, 'Step 2: Inject Water Vapor'),
    chemical_input: {
        chemical: 'mekanism:water_vapor',
        amount: 1
    },
    output: stagedWaferOutput(3, 'Step 3: Etch Wafer'),
    per_tick_usage: true
})

event.custom({
    type: 'mekanism:injecting',
    item_input: stagedWaferInput(3, 'Step 3: Etch Wafer'),
    chemical_input: {
        chemical: 'mekanism:hydrofluoric_acid',
        amount: 1
    },
    output: stagedWaferOutput(4, 'Step 4: Inject Boron'),
    per_tick_usage: true
})

event.custom({
    type: 'mekanism:injecting',
    item_input: stagedWaferInput(4, 'Step 4: Inject Boron'),
    chemical_input: {
        chemical: 'mekanism:boron_trifluoride',
        amount: 1
    },
    output: stagedWaferOutput(5, 'Step 5: Inject Phosphorus'),
    per_tick_usage: true
})

event.custom({
    type: 'mekanism:injecting',
    item_input: stagedWaferInput(5, 'Step 5: Inject Phosphorus'),
    chemical_input: {
        chemical: 'mekanism:phosphorus',
        amount: 1
    },
    output: {
        id: FINAL,
        count: 1
    },
    per_tick_usage: true
})

})

upbeat vector
#

getting closer, it seems that the text is still being a pain somehow...
[13:22:51] [ERROR] ! server_scripts:mosfet_chain.js#38: Failed to create custom recipe from json: Failed to read required component 'output: item_stack' - java.lang.IllegalStateException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 7 path $ missed input: {"minecraft:lore":["Step 2: Inject Water Vapor"]}

edgy rivet
#

Mmm okay

#

I still have it as inject water vapor

#

Hold on

#

Alr this should

#

Have the silicon and lore fixed but let me know again

#

ServerEvents.recipes(event => {
const INCOMPLETE = 'sgcommunity_pack:incomplete_mosfet_wafer'
const FINAL = 'sgcommunity_pack:mosfet_wafer'
const START = 'sgcommunity_pack:silicon_wafer'

function loreLine(label) {
    return JSON.stringify({
        text: label,
        color: 'purple',
        italic: true
    })
}

function waferComponents(step, label) {
    return {
        'minecraft:custom_data': {
            sgcommunity_pack: {
                mosfet_step: step,
                mosfet_label: label
            }
        },
        'minecraft:lore': [
            loreLine(label)
        ]
    }
}

function stagedWaferInput(step, label) {
    return {
        type: 'neoforge:components',
        items: [INCOMPLETE],
        components: waferComponents(step, label),
        strict: false,
        amount: 1
    }
}

function stagedWaferOutput(step, label) {
    return {
        id: INCOMPLETE,
        count: 1,
        components: waferComponents(step, label)
    }
}

event.custom({
    type: 'mekanism:injecting',
    item_input: {
        item: START,
        amount: 1
    },
    chemical_input: {
        tag: 'mekanism:silicon',
        amount: 1
    },
    output: stagedWaferOutput(1, 'Step 1: Inject Silicon'),
    per_tick_usage: true
})

event.custom({
    type: 'mekanism:injecting',
    item_input: stagedWaferInput(1, 'Step 1: Inject Silicon'),
    chemical_input: {
        chemical: 'mekanism:water_vapor',
        amount: 1
    },
    output: stagedWaferOutput(2, 'Step 2: Inject Water Vapor'),
    per_tick_usage: true
})

event.custom({
    type: 'mekanism:injecting',
    item_input: stagedWaferInput(2, 'Step 2: Inject Water Vapor'),
    chemical_input: {
        chemical: 'mekanism:hydrofluoric_acid',
        amount: 1
    },
    output: stagedWaferOutput(3, 'Step 3: Etch Wafer'),
    per_tick_usage: true
})

event.custom({
    type: 'mekanism:injecting',
    item_input: stagedWaferInput(3, 'Step 3: Etch Wafer'),
    chemical_input: {
        chemical: 'mekanism:boron_trifluoride',
        amount: 1
    },
    output: stagedWaferOutput(4, 'Step 4: Inject Boron'),
    per_tick_usage: true
})

event.custom({
    type: 'mekanism:injecting',
    item_input: stagedWaferInput(4, 'Step 4: Inject Boron'),
    chemical_input: {
        chemical: 'mekanism:phosphorus',
        amount: 1
    },
    output: stagedWaferOutput(5, 'Step 5: Inject Phosphorus'),
    per_tick_usage: true
})

event.custom({
    type: 'mekanism:injecting',
    item_input: stagedWaferInput(5, 'Step 5: Inject Phosphorus'),
    chemical_input: {
        chemical: 'mekanism:phosphorus',
        amount: 1
    },
    output: {
        id: FINAL,
        count: 1
    },
    per_tick_usage: true
})

})

upbeat vector
#

no the silicon>vapor steps are all correct, the output of step one tells you what step 2 is (output of step 2 tells you what step 3 is, etc) so the recipes are settled, the only thing its not displaying is lore subtext

#

simmilar to the image i posted above

edgy rivet
#

Ohh my bad then hold on

#

Okay what is it they say

#

8th times the charm xD let me know

#

ServerEvents.recipes(event => {
const INCOMPLETE = 'sgcommunity_pack:incomplete_mosfet_wafer'
const FINAL = 'sgcommunity_pack:mosfet_wafer'
const START = 'sgcommunity_pack:silicon_wafer'

function loreLine(label) {
    return `{"text":"${label}","color":"purple","italic":true}`
}

function waferComponents(step, label) {
    return {
        'minecraft:custom_data': {
            sgcommunity_pack: {
                mosfet_step: step,
                mosfet_label: label
            }
        },
        'minecraft:lore': [
            loreLine(label)
        ]
    }
}

function stagedWaferInput(step, label) {
    return {
        type: 'neoforge:components',
        items: [INCOMPLETE],
        components: waferComponents(step, label),
        strict: false,
        amount: 1
    }
}

function stagedWaferOutput(step, label) {
    return {
        id: INCOMPLETE,
        count: 1,
        components: waferComponents(step, label)
    }
}

event.custom({
    type: 'mekanism:injecting',
    item_input: {
        item: START,
        amount: 1
    },
    chemical_input: {
        tag: 'mekanism:silicon',
        amount: 1
    },
    output: stagedWaferOutput(2, 'Step 2: Inject Water Vapor'),
    per_tick_usage: true
})

event.custom({
    type: 'mekanism:injecting',
    item_input: stagedWaferInput(2, 'Step 2: Inject Water Vapor'),
    chemical_input: {
        chemical: 'mekanism:water_vapor',
        amount: 1
    },
    output: stagedWaferOutput(3, 'Step 3: Etch Wafer'),
    per_tick_usage: true
})

event.custom({
    type: 'mekanism:injecting',
    item_input: stagedWaferInput(3, 'Step 3: Etch Wafer'),
    chemical_input: {
        chemical: 'mekanism:hydrofluoric_acid',
        amount: 1
    },
    output: stagedWaferOutput(4, 'Step 4: Inject Boron'),
    per_tick_usage: true
})

event.custom({
    type: 'mekanism:injecting',
    item_input: stagedWaferInput(4, 'Step 4: Inject Boron'),
    chemical_input: {
        chemical: 'mekanism:boron_trifluoride',
        amount: 1
    },
    output: stagedWaferOutput(5, 'Step 5: Inject Phosphorus'),
    per_tick_usage: true
})

event.custom({
    type: 'mekanism:injecting',
    item_input: stagedWaferInput(5, 'Step 5: Inject Phosphorus'),
    chemical_input: {
        chemical: 'mekanism:phosphorus',
        amount: 1
    },
    output: {
        id: FINAL,
        count: 1
    },
    per_tick_usage: true
})

})

#

Let me also

#

Send you this rq

#

if that still doesn’t worky

#

ServerEvents.recipes(event => {
const INCOMPLETE = 'sgcommunity_pack:incomplete_mosfet_wafer'
const FINAL = 'sgcommunity_pack:mosfet_wafer'
const START = 'sgcommunity_pack:silicon_wafer'

function loreLine(label) {
    return JSON.stringify({
        text: String(label),
        color: 'purple',
        italic: true
    })
}

function waferComponents(step, label) {
    return {
        'minecraft:custom_data': {
            sgcommunity_pack: {
                mosfet_step: step,
                mosfet_label: String(label)
            }
        },
        'minecraft:lore': [
            loreLine(label)
        ]
    }
}

function stagedWaferInput(step, label) {
    return {
        type: 'neoforge:components',
        items: [INCOMPLETE],
        components: waferComponents(step, label),
        strict: false,
        amount: 1
    }
}

function stagedWaferOutput(step, label) {
    return {
        id: INCOMPLETE,
        count: 1,
        components: waferComponents(step, label)
    }
}

event.custom({
    type: 'mekanism:injecting',
    item_input: {
        item: START,
        amount: 1
    },
    chemical_input: {
        tag: 'mekanism:silicon',
        amount: 1
    },
    output: stagedWaferOutput(2, 'Step 2: Inject Water Vapor'),
    per_tick_usage: true
})

event.custom({
    type: 'mekanism:injecting',
    item_input: stagedWaferInput(2, 'Step 2: Inject Water Vapor'),
    chemical_input: {
        chemical: 'mekanism:water_vapor',
        amount: 1
    },
    output: stagedWaferOutput(3, 'Step 3: Etch Wafer'),
    per_tick_usage: true
})

event.custom({
    type: 'mekanism:injecting',
    item_input: stagedWaferInput(3, 'Step 3: Etch Wafer'),
    chemical_input: {
        chemical: 'mekanism:hydrofluoric_acid',
        amount: 1
    },
    output: stagedWaferOutput(4, 'Step 4: Inject Boron'),
    per_tick_usage: true
})

event.custom({
    type: 'mekanism:injecting',
    item_input: stagedWaferInput(4, 'Step 4: Inject Boron'),
    chemical_input: {
        chemical: 'mekanism:boron_trifluoride',
        amount: 1
    },
    output: stagedWaferOutput(5, 'Step 5: Inject Phosphorus'),
    per_tick_usage: true
})

event.custom({
    type: 'mekanism:injecting',
    item_input: stagedWaferInput(5, 'Step 5: Inject Phosphorus'),
    chemical_input: {
        chemical: 'mekanism:phosphorus',
        amount: 1
    },
    output: {
        id: FINAL,
        count: 1
    },
    per_tick_usage: true
})

})

#

This one stops hand building the lore JSON string and lets JSON.stringify do the escaping

edgy rivet
#

Is it erroring at all?

upbeat vector
#

they both come back with the same error

[13:35:41] [ERROR] ! server_scripts:mosfet_chain.js#42: Failed to create custom recipe from json {"type":"mekanism:injecting","item_input":{"item":"sgcommunity_pack:silicon_wafer","amount":1},"chemical_input":{"tag":"mekanism:silicon","amount":1},"output":{"id":"sgcommunity_pack:incomplete_mosfet_wafer","count":1,"components":{"minecraft:custom_data":{"sgcommunity_pack":{"mosfet_step":2,"mosfet_label":"Step 2: Inject Water Vapor"}},"minecraft:lore":[{"text":"${label}","color":"purple","italic":true}]}},"per_tick_usage":true}: Failed to read required component 'output: item_stack' - java.lang.IllegalStateException: Not a string: {"text":"${label}","color":"purple","italic":true} missed input: {"minecraft:lore":[{"text":"${label}","color":"purple","italic":true}]}

#

Not a String

edgy rivet
#

Okay gimmie a minute rq so I don’t keep sending you broken scripts

#

It’s acting like

#

We didn’t change it to JSON stringify

upbeat vector
#

does that help any?

edgy rivet
#

Use this one and tell me if it does the same thing, also I can’t see that channel is shows an unknown

ServerEvents.recipes(event => {
const INCOMPLETE = 'sgcommunity_pack:incomplete_mosfet_wafer'
const FINAL = 'sgcommunity_pack:mosfet_wafer'
const START = 'sgcommunity_pack:silicon_wafer'

function loreLine(label) {
    return JSON.stringify({
        text: String(label),
        color: 'purple',
        italic: true
    })
}

function waferComponents(step, label) {
    return {
        'minecraft:custom_data': {
            sgcommunity_pack: {
                mosfet_step: step,
                mosfet_label: String(label)
            }
        },
        'minecraft:lore': [
            loreLine(label)
        ]
    }
}

function stagedWaferInput(step, label) {
    return {
        type: 'neoforge:components',
        items: [INCOMPLETE],
        components: waferComponents(step, label),
        strict: false,
        amount: 1
    }
}

function stagedWaferOutput(step, label) {
    return {
        id: INCOMPLETE,
        count: 1,
        components: waferComponents(step, label)
    }
}

event.custom({
    type: 'mekanism:injecting',
    item_input: {
        item: START,
        amount: 1
    },
    chemical_input: {
        tag: 'mekanism:silicon',
        amount: 1
    },
    output: stagedWaferOutput(2, 'Step 2: Inject Water Vapor'),
    per_tick_usage: true
})

event.custom({
    type: 'mekanism:injecting',
    item_input: stagedWaferInput(2, 'Step 2: Inject Water Vapor'),
    chemical_input: {
        chemical: 'mekanism:water_vapor',
        amount: 1
    },
    output: stagedWaferOutput(3, 'Step 3: Etch Wafer'),
    per_tick_usage: true
})

event.custom({
    type: 'mekanism:injecting',
    item_input: stagedWaferInput(3, 'Step 3: Etch Wafer'),
    chemical_input: {
        chemical: 'mekanism:hydrofluoric_acid',
        amount: 1
    },
    output: stagedWaferOutput(4, 'Step 4: Inject Boron'),
    per_tick_usage: true
})

event.custom({
    type: 'mekanism:injecting',
    item_input: stagedWaferInput(4, 'Step 4: Inject Boron'),
    chemical_input: {
        chemical: 'mekanism:boron_trifluoride',
        amount: 1
    },
    output: stagedWaferOutput(5, 'Step 5: Inject Phosphorus'),
    per_tick_usage: true
})

event.custom({
    type: 'mekanism:injecting',
    item_input: stagedWaferInput(5, 'Step 5: Inject Phosphorus'),
    chemical_input: {
        chemical: 'mekanism:phosphorus',
        amount: 1
    },
    output: {
        id: FINAL,
        count: 1
    },
    per_tick_usage: true
})

})

#

Oh nvm I see it

#

But yea use this, that error was showing it wasn’t using JSON stringify which is what we just added so let me confirm it’s not rejecting that first

upbeat vector
#

oh im getting invalid color now

#

Invalid color name: purple

#

now i need to figure out what the color was that the original script used

edgy rivet
#

That’s the only invalid?

upbeat vector
#

yea

edgy rivet
#

Add

#

Um

#

Dark or light

#

So it becomes dark_purple or light_purple

#

Cause evidently normal purple doesn’t exist

#

So it’d look like this

function loreLine(label) {
return JSON.stringify({
text: String(label),
color: 'light_purple',
italic: true
})
}

#

Or replace with whatever color you had originally of course

upbeat vector
#

yup it was dark_purple

#

AWESOME

#

everything works exactly like the old script

#

i cant thank you enough for this

edgy rivet
# upbeat vector i cant thank you enough for this

My pleasure bro! As the owner of Arctania we strive on helping people inside and outside of our server, like I said if you have any future issues that have you stumped feel more than free to send me a DM or tag me somewhere and I’ll get to it ASAP, have fun bro!

upbeat vector
#

Yea, once I get home again I'll post the fully functional script and close the ticket.

upbeat vector
#
ServerEvents.recipes(event => {
    const START = 'sgcommunity_pack:silicon_wafer'
    const INCOMPLETE = 'sgcommunity_pack:incomplete_mosfet_wafer'
    const FINAL = 'sgcommunity_pack:mosfet_wafer'

    function loreLine(label) {
        return JSON.stringify({
            text: String(label),
            color: 'dark_purple',
            italic: true
        })
    }

    function waferComponents(step, label) {
        return {
            'minecraft:custom_data': {
                sgcommunity_pack: {
                    circuit_step: step,
                    circuit_label: String(label)
                }
            },
            'minecraft:lore': [
                loreLine(label)
            ]
        }
    }

    function stagedWaferInput(step, label) {
        return {
            type: 'neoforge:components',
            items: [INCOMPLETE],
            components: waferComponents(step, label),
            strict: false,
            amount: 1
        }
    }

    function stagedWaferOutput(step, label) {
        return {
            id: INCOMPLETE,
            count: 1,
            components: waferComponents(step, label)
        }
    }

    event.custom({
        type: "mekanism:injecting",
        item_input: {
            item: START,
            amount: 1
        },
        chemical_input: {
            chemical: "mekanism:silicon",
            amount: 5
        },
        output: stagedWaferOutput(2, "Step 2: Inject Water Vapor"),
        "per_tick_usage": true
    })

    event.custom({
        type: "mekanism:injecting",
        item_input: stagedWaferInput(2, "Step 2: Inject Water Vapor"),
        chemical_input: {
            tag: "mekanism:water_vapor",
            amount: 10
        },
        output: stagedWaferOutput(3, "Step 3: Etch Wafer"),
        "per_tick_usage": true
    })

    event.custom({
        type: "mekanism:injecting",
        item_input: stagedWaferInput(3, "Step 3: Etch Wafer"),
        chemical_input: {
            chemical: "mekanism:hydrofluoric_acid",
            amount: 2
        },
        output: stagedWaferOutput(4, "Step 4: Inject Boron"),
        "per_tick_usage": true
    })

    event.custom({
        type: "mekanism:injecting",
        item_input: stagedWaferInput(4, "Step 4: Inject Boron"),
        chemical_input: {
            chemical: "mekanism:boron_trifluoride",
            amount: 2
        },
        output: stagedWaferOutput(5, "Step 5: Inject Phosphorus"),
        "per_tick_usage": true
    })

    event.custom({
        type: "mekanism:injecting",
        item_input: stagedWaferInput(5, "Step 5: Inject Phosphorus"),
        chemical_input: {
            chemical: "mekanism:phosphorus",
            amount: 1
        },
        output: {
            id: FINAL,
            count: 1
        },
        "per_tick_usage": true
    })
})