Skip to content

Using the Minechem API

randomdude999 edited this page Sep 16, 2016 · 7 revisions

Adding a decomposing recipe

Decomposer.addRecipe(ItemStack input, String... outputs)
The outputs are parsed as "amount symbol", you can add multiple outputs. You can find a list of all elements and their symbols and a list of molecules on this wiki.
eg. Decomposer.addRecipe(myItemStack, "3 C", "2 ethanol")
The method also returns a bool if your recipe was added or not.

Adding a synthesis recipe

Synthesiser.addRecipe(ItemStack output, boolean shaped, int energyCost, String... inputs)
The inputs are parsed the same way outputs in decomposing are parsed
eg. Synthesiser.addRecipe(myItemStack, false, 3000, "3 C", "2 ethanol")

For a shaped recipe you can use a blank string to leave a gap, order is top left to bottom right
eg. RecipeAPI.addSynthesisRecipe(myItemStack, true, 3000, "1 C", "1 C", "1 C", "", "1 ethanol", "", "", "1 ethanol", "")
The recipe will be following:

The method also returns a bool if your recipe was added or not.

Adding a molecule

registerMolecule(int id,String name, float colorRed, float colorGreen, float colorBlue, float colorRed2, float colorGreen2, float colorBlue2,String roomStatus,Object... molecule)
registerMolecule(int id,String name,String roomStatus,Object... molecule)
The argument colorRed, colorGreen, colorBlue, colorRed2, colorGreen2, colorBlue2 are the colors of the molecule.
The roomStatus has three available value, "solid", "liquid", "gas".
The molecule argument is the compositions the molecule. It constitutes by Integer and String. The Integer must be in front of the String. The String is a element or a molecule's name. And the Integer means the amount of the String. If amount is 1, you needn't write the Integer.
If you use the second method, the colors will be generated by a randomizer (uses name.hashCode() as seed).
You should register your molecules in FMLPreInitializationEvent.
eg. ChemicalAPI.registerMolecule(300,"testMolecule",1f,1f,1f,1f,1f,1f,"solid","Fr",2,"hydroxide")
It will be following:

Add a fluid chemical reaction

registerFluidChemicalReaction(String chemicalA,String chemicalB,float explosionLevel,String... outputChemicals)
The chemicalA and chemicalB mean which two chemicals will explode when they meet.
The explosionLevel means how large explosion will be created, if it is equal to Float.NaN, it won't explode.
The outputChemicals means what chemical will be generated after reaction. Its value follows like ["H","O","O"], ["hydroxide","Fr"]. Values like ["2H"], ["2","H"] are not available.