#How to create a multiblock machine processing faster than regular machine in kjs

53 messages · Page 1 of 1 (latest)

hollow oxide
#

I want to make a machine similar to gtnh(can processing recipe faster than single block) to make this muitiblock more efficent than vanilla gtm machines

need i create a new recipe type and modify and add them from original recipe type one bye one

green crest
#

yes

#

but if you are doing a steam machine, the parallel makes up much more speed

hollow oxide
#

thanks

hollow oxide
#

btw can machine be made to have a fixed amount of parallel

green crest
#

.machine((holder) => new $SteamMulti(holder, 4)) ik that steam machines can

#

but idk about electric

hollow oxide
#

ok tkx

hollow oxide
#

but i have a qustion tho, how to convert a recipe in code
i know that if you add a recipe in gtm, you should use event.recipes.gtceu.NAMESPACE_ID and use gtm's recipe builder(idk is this right expression in english), but how do i get recipe io data (like itemInputs, inputFluids)
or just use their json data
i dont know how to convert recipe object to json(is it recipe.json.getAsJsonArray? idk)
and how to process this

green crest
#

So you already have a multiblock and now you need to make recipes for it?

#

have you registered a recipe type?

#

not json files btw, javascript

hollow oxide
#

yeah registered

green crest
#

after you have the recipe type registered

#

event.recipes.gtceu.pressurized_fission_reactor('fission1')
.itemInputs('3x kubejs:basic_fuel_rod')
.itemOutputs('5x gtceu:low_level_radioactive_waste')
.duration(2000)
.circuit(1)
.EUt(4800)

#

that is an example code block for a recipe

#

and for fluids, .inputFluids('gtceu:oxygen_gas 500') .outputFluids('gtceu:uranium_oxide 1000')

#

do you want to know how chanced outputs work?

hollow oxide
#

i mean duplcate the oringinal recipe and modfiy their duration and eut to make a muitibloick that processing faster

green crest
#

ah, for that you would have to look at jei and copy it all by hand

hollow oxide
#

i know how to register recipes(regular way) thats in gtm docs

green crest
#

what machine are you trying to upgrade?

#

I hope it's one with a managable amount of recipes, because idk the function to change all them automaticcly

hollow oxide
#

emm like all kind of vanilla gtm machine i want it to process faster but not parallel hatches allowed to helping players transition from MV XD

green crest
#

well, that is gonna be a ton of work

#

afaik, there is no way to just change them. so you would have to make new recipes for everything

#

and then remove the old ones with kubejs

#

do you know how to make recipes for these machines and remove other recipes?

hollow oxide
#

im not need to remove that haha also i read the docs

#

are there a lot of people here who speak without having read the doc?

green crest
#

yes

hollow oxide
#

sad

green crest
#

I only work with kubejs, so am I misunderstanding your question? because I might be

#

I do not see a reason to convert kubejs javascript recipe files into json. but that is ofc on the basis of using kubejs

hollow oxide
#

maybe im askin xy problem sorry

#

let me explain

#

im going to make a new recipe type, but its almost a copy from some recipe type

#

so i think i need to use event.forEachRecipesto get that original recipe type

#

but my goal is to modify it to meet my requirements

#

so i need to add it again

#

as far as i know i dont know how to add the recipeobject ( forEachRecipes method give me) to that new recipe type

#

i think i can use json

#

btw i do know how to modify the recipe by recipe.set

green crest
#

then you know more than me on that, could you send me a link if that is explained somewhere? the docs are kinda confusing sometimes

#

and yeah, json files in the datapack section should work

hollow oxide
#

mostly using llm generated XD

green crest
#

that is really imprssive

hollow oxide
#

thanks

hollow oxide
#
ServerEvents.recipes(event => {
function generateUUID() {
        return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
          const r = Math.random() * 16 | 0;
          const v = c === 'x' ? r : (r & 0x3 | 0x8);
          return v.toString(16);
        });
      }

    event.forEachRecipe({ type: 'gtceu:assembler' }, recipe => {
        let originalRecipe = recipe.json.deepCopy()

        originalRecipe.remove('id')
        originalRecipe.add('id', 'gtceu:large_assembler_creepetech/' + generateUUID())
        originalRecipe.remove('type')
        originalRecipe.add('type', 'gtceu:large_assembler_creepetech')
        originalRecipe.remove('category')
        originalRecipe.add('category', 'gtceu:large_assembler_creepetech')

        var aduration = originalRecipe.get('duration')
        var tickInputs = originalRecipe.get('tickInputs').getAsJsonObject()
        var euInputs = tickInputs.get('eu')
        var eu_0 = euInputs.get(0)
        var newEu = eu_0.get('content') * 4
        
        originalRecipe.remove('duration')
        originalRecipe.remove('tickInputs')
        originalRecipe.add('duration', Math.floor(aduration / 5))
        originalRecipe.add('tickInputs', JSON.parse(`{"eu":[{"content":${newEu},"chance":10000,"maxChance":10000,"tierChanceBoost":0}]}`))

        event.custom(originalRecipe.getAsJsonObject());
    });
});```

i figure it out! XD
if somebody get helped please let me know :3
#

but recipe_id from uuid kinda not working

vast night
#

You shouldn't need an entire new recipe type, just a custom recipe modifier.