Modern Industrialization

Modern Industrialization

4M Downloads

KubeJS documentation?

MechanosG opened this issue · 9 comments

commented

I noticed the closed issue regarding incompatibility with latest KubeJS due to changes they made, but also took note that a version of KubeJS that is still compatible, comes bundled with MI. Is there documentation somewhere on what MI functions/methods are available? I'm looking to change the dust output with macerators, but will likely make use of other tasty bits as well.

commented

You can check the scripts AOF3 uses: https://github.com/TeamAOF/All-of-Fabric-3/tree/master/kubejs/server_scripts. The custom build only fixes some bugs with KubeJS, so you should be able to ask for help on their Discord if you need more.

commented

KubeJS-MI documentation doesn't exist and isn't planned because it's standard KubeJS behavior. I'd really suggest asking for help on LatvianModder's discord, there is nothing special about this build of KubeJS besides a few bugfixes.

commented

I see. So I take that as.. KubeJS-MI documentation doesn't exist and probably isn't planned? I've had bad luck trying to contact anyone through various Discords so I'm a bit leery about going that route. As for AoF3's scripts, I see replaceInput and replaceOutput used a lot with the first argument empty, as to catch everything (including MI machines), which apparently works for replacing MI machine recipes when the item involved is only used by MI. Which should be good enough for what I'm doing; stuff accidentally replaced collateral damage can be removed or fixed after I suppose. But I don't see any examples of adding non-existing recipes to MI machines, or removing recipes only on a specific MI machine, which I assume would take something like.. event.macerator or 'type: 'modern_industrialization:macerator'', etc? Some identifier for MI's machines, if they exist. Guessing they don't lol.

Anyway, thank you for the reply. I think I can make something work good enough using those examples. :)

edit: Poking around in here https://github.com/AztechMC/Modern-Industrialization/blob/master/src/main/resources/data/modpack/kubejs/modern_industrialization_compat.js seems to have what I was looking for actually.

commented

Alright. The KubeJS wiki confused me by using shorthand on everything, and really not explaining anything.. I didn't realize that all compatible machines/blocks can be accessed by event.recipes.[modname].[blockname] and thought that MI had added that, hence me asking here. Although I don't know how I would know what properties/variables are usable without documentation?

some time passes

So I asked the LatvanModder's discord, and the first response was that they thought modders should document the properties available to machines lol, as there may not be a way for KubeJS to get them. For example:

event.recipes.modern_industrialization.assembler({
eu: 8,
duration: 200,
item_inputs: [
{ item: 'modern_industrialization:stainless_steel_large_plate', amount: 4 },
{ item: 'modern_industrialization:advanced_machine_hull', amount: 1 }
],
item_outputs: [
{ item: 'modern_industrialization:turbo_machine_casing', amount: 1 }
],
id: 'modern_industrialization:assembler/turbo_machine_casing'
})

The eu, duration, item_inputs, item_outputs, etc. According to a user named max, KubeJS might not have a way to get those. Not trying to change your mind on documentation or anything though. Just sharing what they told me. I pieced together enough from modern_industrialization_compat.js for what I needed, which was adding recipes to the macerator and assembler.

commented

Well that's just the standard recipe format, the same that is used for every json in this mod.

commented

...a standard recipe format that I wouldn't know if I hadn't found that file, and doesn't seem to be used in AoF3 either. There's others not in that example too, like fluid_inputs and probability. I have no way of knowing what all there is unless I can find the right spots in the source I suppose.

Edit: https://github.com/AztechMC/Modern-Industrialization/blob/master/src/main/java/aztech/modern_industrialization/compat/kubejs/MIRecipeEventHandler.java this maybe? Looks like maybe that's all of them. I'm tired tho.

commented

I'm new to all this. I have no way of knowing what's in your "regular jsons", or that you have used any kind of common naming convention. That would be the purpose of documentation lol. I was just wanting to tweak/add some recipes, and have no idea how MI is structured or anything.

commented

Ah ok, my bad then. In general, KubeJS syntax to add recipes is the syntax used by the mod jsons internally (in src/main/resources/data/<modid>/recipes), without the type: tag and using event.type_namespace.type_path(<rest of json goes here>). Should you need to add e.g. Tech Reborn recipes that would work too... ;)