#How to create a multiblock machine processing faster than regular machine in kjs
53 messages · Page 1 of 1 (latest)
thanks
btw can machine be made to have a fixed amount of parallel
.machine((holder) => new $SteamMulti(holder, 4)) ik that steam machines can
but idk about electric
ok tkx
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
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
yeah registered
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?
i mean duplcate the oringinal recipe and modfiy their duration and eut to make a muitibloick that processing faster
ah, for that you would have to look at jei and copy it all by hand
i know how to register recipes(regular way) thats in gtm docs
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
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
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?
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?
yes
sad
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
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
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
that is really imprssive
thanks
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
You shouldn't need an entire new recipe type, just a custom recipe modifier.