How to use the Gas API?
maehschaf opened this issue · 6 comments
Hi!
I would like to add Gases to a mod I am coding and would love to make them compatible with Mekanisms Gases. The easiest solution would be to simply use the Mekanism Gas API within my mod and therefore include the mekanism.api.gas package in the sources of my mod similar to the cofh energy api. If I do understand the MIT license correctly I am allowed to include the code but have to add a copy of the license if I am using a "substantial portion" of the code. So the question is: Is the Gas API a substantial portion? Where would I need to include it? Would I have to somehow mention it in my own License? Is there a better way to include the API? Should I write my own gas system? Or simply what would be your advice for adding gases to a mod?
I hope I am not boring you with that kind of stuff...
Greetings, maehschaf
Forge & Mekanism gasses are not compatible at all..
So you want to optionally depend on gasses or have it at all times? If you want it all times, just depend on it and make Mekanism a required dependency, repacking causes the API to be loaded at all times, even if Mekanism isn't loaded. That would confuse a lot of other mods.
I can try to make an example, but currently I've got not that much spare time
I want to have gases all the time. I just would have preferred to use an existing system instead of creating a new one… I would prefer to have as few required dependencies as possible to keep things simple... Is there another option? Otherwise I will just make my own gas system and try to keep it compatible with mekanism…
Hello!
I would suggest NOT repackaging it, as it could cause mayor issues when we decide to update it.
You have however two options:
As a Mekanism developer I would say to use the API listed on the Mekanism site as a dependency, not repackaging, but only depending. Can't find an example right now, but I know some other mods use it.
As other developers prefer, use the Forge fluid .isGaseous() method on its fluids.
If you want a full compatibility with Mekanism, go for the first option.
If you need any help/more info, please feel free to ask ;)
First: Thank you for the quick answer!
The problem with only depending is that I can only use the API when Mekanism is installed which is not necessarily the case so I would still need to use some other gas system internally... I will look into the forge fluid system and just wanted to ask how compatible it is with Mekanism. About repackaging: Can I be sure that the classes from Mekanism are loaded first when I set it as a dependency (Since the forge docs say that "..the listed mods will load before...")? Because if that is the case there should be no problem with you updating the API and I will have to keep the method calls in my mod updated anyways :)
As Thommy mentioned, Mekanism gasses are their own thing entirely.
Probably the best option is to add some compatibility code to use Mek's GasStack
in whatever system you decide to use (either Forge FluidStack
s or your own custom classes).
Do not ship the API, it will only cause issues and is completely unnecessary.