#Create Sequenced Assembly with external steps

138 messages ยท Page 1 of 1 (latest)

wild sluice
#

Somewhat of a successor to emperdog's original script. I tested this in 1.20.1 on a few different things. Some notable differences:

  • emperdog's original script uses dummy items in Create's sequenced assembly to show the recipe steps. Mine does not register anything using Create's default sequenced assembly if there are custom steps. Instead, it only uses the nbt of the transitional item, and each step is shown separately in JEI. It shouldn't be too cluttered.
  • I made the custom lore look as close as possible to the native Create sequenced assembly. The lore also shows if you hold the intermediate transitional item.

Limitations:

  • any custom recipes must preserve nbt data on its inputs and outputs, generally not an issue with the right amount of wrangling
civic tuskBOT
#

Paste version of message.txt from @wild sluice

wild sluice
#

With the following example usage:

  new SequencedAssembly(
    e,
    'create:electron_tube',
    'kubejs:intermediate_transistor'
  )
    .custom('Next: Mix in a mixer', (pre, post) => {
      create.mixing(post, pre)
    })
    .deploy('minecraft:glass_pane')
    .press()
    .fill(Fluid.water(200))
    .outputs('4x pneumaticcraft:transistor')

this results in the following recipes.

#

I'm sure there are tons of edge cases with inputs I haven't handled, let me know if you end up using this and run into bugs.

cedar jackal
#

Hey. Script works great. just wanted to know the
.keephelditem
arg is used

wild sluice
#

Ah that's definitely possible to add to, just pass the argument to the .deploy. I might've left it out.

blazing peak
#

what regestry event does this use?

wild sluice
blazing peak
#

okay

regal pecan
#

holy fuck that is a massive brick of code

true gorge
#

how do I use this? I put the example script in but it says "e isn't defined"

wild sluice
#

e is the server side recipe event

true gorge
#

so why wouldn't it be defined?

true gorge
blazing peak
#

have you never used kubejs before?

#

first off-
dont start off this advanced

and second you need to wrap your code in the event definition

ServerEvents.recipes(e => {
//code here
})```
true gorge
#

I've managed to get it working

#

I've used kubejs before but I have no experience with javascript

blazing peak
blazing peak
true gorge
#

that wasn't an issue for me

#

I know how to do that

#

I had just put "event" instead of "e"

blazing peak
#

Ohh yeah

true gorge
#

I've had some more issues, firstly, is it possible to use chance based outputs? and secondly the recipes don't work if you use keepHeldItem for a deploying step or if the first step of a recipe isn't custom

wild sluice
#

Can you share with me an example of a recipe not working with keephelditem

wild sluice
valid dragon
civic tuskBOT
#

Paste version of SequencedAssembly.js from @valid dragon

valid dragon
#

hi @wild sluice , this one is not working, any idea why?

#

on forge 1.20.1

#

and the file is in serverscripts

wild sluice
valid dragon
#

it only shows an error when I use a custom recipe inbetween

#

let me try to recreate it

#

@wild sluice it says: Error in 'ServerEvents.recipes': ReferenceError: "create" is not defined

#

I think I fixed it

#

by pasting const create = defineCreateRecipes(e)

#

Im gonna test it rn

#

nvm

#

still doesnt work

valid dragon
#

wait I think I just have to replace create.mixing with e.recipes.create.mixing

valid dragon
#

yeah that did it

valid dragon
#

how would I add a step that uses the matamorphosis crafting from cognition? I have

#

.custom('Next: craft in a metamorphosis machine from cognition', (pre, post) => {
toJson(
{
"type": "experienceobelisk:molecular_metamorphosis",
"ingredient1": {
"item": pre
},
"count1": 2,
"ingredient2": {
"item": "minecraft:grass_block"
},
"count2": 1,
"ingredient3": [],
"count3": 0,
"result": {
"item": post,
"count": 1
},
"cost": 16,
"processTime": 20
}
)
})

#

right now

#

but it thinks toJson is the recipe so it's not working

wild sluice
wild sluice
#

You can use e.custom with that json

valid dragon
#

thanks for the help

#

I tried to make my own version of your create recipe script for the matamorphoser but it keeps saying that the script cannot be called or something

#

this is the code

#

/**

  • @param {Internal.RecipesEventJS_} e
    */
    const definedumbahhrecipes = (e) => {
    return {
    metamorphosis: (in1, c1, in2, c2, in3, c3, res, cres, cost, processTime) => {
    return ServerEvents.lowPriorityData(event => {
    event.addJson('cognition:data/experienceobelisk/recipes/metamorpher/jemoeder', {
    "type": "experienceobelisk:molecular_metamorphosis",
    "ingredient1": {
    "item": in1
    },
    "count1": c1,
    "ingredient2": {
    "item": in2
    },
    "count2": c2,
    "ingredient3": {
    "item": in3
    },
    "count3": c3,
    "result": {
    "item": res,
    "count": cres
    },
    "cost": cost,
    "processTime": processTime
    })
    })
    }
    }}
    ServerEvents.recipes((e) => {
    const yuhh = definedumbahhrecipes(e)
    yuhh.metamorphosis("minecraft:dirt", 2, "minecraft:grass", 1, "minecraft:emerald", 3, "minecraft:diamond", 2, 20, 20)
    })
#

excuse the crude naming

#

I now have this for the main sequenced assembly using the e custom like you suggested but the first two steps dont show up

#

ServerEvents.recipes(e => {
new SequencedAssembly(
e,
'create:electron_tube',
'minecraft:dirt'
)
.custom('Next: Mix in a mixer', (pre, post) => {
e.recipes.create.mixing(post, pre)
})
.custom('Next: craft in a metamorphosis machine from cognition', (pre, post) => {

    {

"type"; "experienceobelisk:molecular_metamorphosis",
"ingredient1"; {
"item"; pre
};
"count1"; 2,
"ingredient2"; {
"item"; "minecraft:grass_block"
};
"count2"; 1,
"ingredient3"; [],
"count3"; 0,
"result"; {
"item"; post,
"count"; 1
};
"cost"; 16,
"processTime"; 20
}
})
.deploy('minecraft:grass')
.press()
.fill(Fluid.water(200))
.outputs('minecraft:diamond')
})

#

at least it doesnt show in jei

#

my game keeps crashing when I try the recipe

wild sluice
valid dragon
#

wait I can js send the file

#

give me a sec

civic tuskBOT
#

Paste version of SequencedAssembly.js from @valid dragon

valid dragon
#

like this?

#

sorry Im kinda new to coding but I like it and I wanna get better

wild sluice
valid dragon
#

aha

wild sluice
valid dragon
#

oh no problem

#

but jei doesnt matter

wild sluice
valid dragon
#

its just when I try the recipe my game crashes

wild sluice
#

The other thing is that pre and post are actually items, not json data, you have to serialize it as json to use e.custom

wild sluice
valid dragon
#

Im gonna look up every word you just said

wild sluice
wild sluice
valid dragon
#

yh sure

#

I appreciate the effort youre making

wild sluice
#

๐Ÿ‘

valid dragon
#

I think I figured out the json serializing

#

I now have JSON.stringify(pre)

#

and post

#

nvm it still just crashes the game

valid dragon
civic tuskBOT
#

Paste version of SequencedAssembly.js from @valid dragon

valid dragon
#

Im stuck with this rn Im going to sleep cause its late for me but I look forward to your advice

wild sluice
#

Okay, so I see what you're trying to do. First, the callback takes three arguments, with the third being optional, of the form:

new SequencedAssembly(...)
  .custom((pre, post, toJson) => {
     e.custom({
       "type": "experienceobelisk:molecular_metamorphosis",
       ...
       "ingredient1": {
         "item": toJson(pre)
       }
     })
   })
   .outputs(...)

The reason you cannot do JSON.stringify is that the pre/post items have nbt data.

Second, your syntax is incorrect in a lot of places. You have a ; instead of a : in a lot of JSON. You should probably learn basic JavaScript syntax to figure that out. I also suggest picking a code editor and using a formatter like PrettierJS so it's easy to read.

Third:

const definedumbahhrecipes = (e) => {
  return {
    metamorphosis: (in1, c1, in2, c2, in3, c3, res, cres, cost, processTime) => {
      return
    }
  
}}
ServerEvents.recipes((e) => {
  const yuh = definedumbahhrecipes(e)
  yuh.metamorphosis("minecraft:dirt", 2, "minecraft:grass", 1, "minecraft:emerald", 3, "minecraft:diamond", 2, 20, 20)
})

You should probably fill this out to make sure it works correctly with e.custom. One error at a time, you have a lot of other stuff going on in this file that makes it hard to debug.

valid dragon
#

alr thanks for the tips Im gonna try some stuff right now!

valid dragon
civic tuskBOT
#

Paste version of sequncedassemblyrecipes.js from @valid dragon

valid dragon
#

I have this now, when I try to view the recipe in JEI it works fine until I get to the metamorph step and it just crashes immediately

valid dragon
civic tuskBOT
#

Paste version of customrecipehandlertest.js from @valid dragon

valid dragon
#

I have this for the metamorphosis crafting using your method with the create crafts and it shows no errors in kubejs but when I load the world it says: cannot find function metamorphosis in object function

#

on line 35

valid dragon
#

Im enjoying your pack so far btw :)

valid dragon
valid dragon
wild sluice
wild sluice
# valid dragon I have this for the metamorphosis crafting using your method with the create cra...

You didn't call the function that defines the obj.

ServerEvents.recipes(e => {
  const test = definerecipes(e)
  ...
})

I wouldn't suggest doing complicated stuff like this unless you know JS.You can just make a regular helper function instead of attaching it to the event.

const metamorphosis = (e, in1, c1, ...) => {
  return e.custom({
    "type": "experienceobelisk:molecular_metamorphosis",
    ...
  })
}

toJson is a function specifically provided by the Sequenced Assembly wrapper for its internals.

wild sluice
wild sluice
#

Instead of debugging via crashes, it's better to start from your logs to see what/why it crashed. Also, failed recipes generally won't crash minecraft, they'll just fail to load.

valid dragon
#

ill check everything rn

valid dragon
#

I just tried everything and nothing worked until I realized that none of my kubejs scripts are working rn

valid dragon
#

and also, some progress

#

e.custom({
"type": "experienceobelisk:molecular_metamorphosis",
"ingredient1": {
"item": "minecraft:grass"
},
"count1": 3,
"ingredient2": {
"item": "minecraft:dirt"
},
"count2": 6,
"ingredient3": {
"item": "minecraft:emerald"
},
"count3": 4,
"result": {
"item": "minecraft:diamond",
"count": 1
},
"cost": 17,
"processTime": 13
}
)

#

this code works

#

so you can use e.custom to make the recipes

#

now I just have to fix the helper

#

Im trying to go step by step and Im now trying to fix the helper so I can implement it in the sequenced assembly

civic tuskBOT
#

Paste version of customrecipehandlertest.js from @valid dragon

valid dragon
#

I have this and it returns no crashes, no errors but also no recipes, any idea what's wrong?

wild sluice
# valid dragon

This won't work because metamorphosis isn't returning a function anymore, it registers your recipe and returns the recipe.

You want metamorphosis(e, "minecraft:dirt", 2, "minecraft:grass", 1, ...)

If you're doing it this way, you shouldn't JSON.stringify the arguments.

const test = metamorphosis(e) is a function call for metamorphosis, which calls e.custom() with null arguments for the rest of the arguments.

valid dragon
wild sluice
#

Just define a simple function that takes the event e and args and sets up the e.custom call.

valid dragon
wild sluice
#

no, it's exactly what you have, just call the function instead:

const metamorphosis = (e, in1, c2, ...) => {
  return e.custom({
    "type": "experienceobelisk:molecular_metamorphosis",
    "ingredient1": {
      "item": in1
    },
    "count1": c1,
    ....
   })
}
ServerEvents.recipes(e => {
  metamorphosis(e, 'minecraft:wood', 1, ...)
})

Now that I look at this schema, it probably will not work with the SequencedAssembly wrapper. ingredient1, count1 is a very nonstandard way of doing it, it definitely doesn't support nbt.

valid dragon
#

ah ok thanks Ill do it rn

valid dragon
wild sluice
valid dragon
#

ah, thanks

limpid pasture
#

@wild sluice wanted to clear with you that I could use the code (with credit and such) in a pack

wild sluice
untold elk
#

can someone tell me what Im doing wrong here?
For context I have create slice in dice so there is a machine specifically for it, but it doesnt have built in kubejs compat
Or can someone direct me on how to add custom support for sequenced assembly compatability via data