[Suggestion/Request] Forge Gas API
ASpieler opened this issue ยท 7 comments
would you be willing to consider using the Forge Gas API?
there are many of us that use your mod in conjunction with other mods like Ender IO, etc. that have (or had) gas pipes/conduits that at one point worked with Mekanism machines, and no longer do, due to API changes in Mekanism. I have seen multiple mentions from different sources that if you would use the Forge 'liquid' API and the 'isGaseous' method, then maintaining compatibility would be much easier.
So, as a user, and a mod pack builder, I ask you please, please consider moving Mekanism to Forge's built-in API.
I'm not a coder but I do think that I understand the basics enough to answer your question.
Short answer: No. There is no Forge Gas API.
Long Answer: Ender IO no longer has Gas Conduits because of two reasons.
- Mekanism's Gas API has changed with the new version of Mekanism, so Ender IO would have to rewrite them.
- Ender IO is 'not willing to touch Mekanism with a 10 foot pole in its current condition' (paraphrased from a comment on Ender IO's github a while ago). Aiden's busy with school, so there has been very little development for many months now, and a lot of things in the mod are broken at the moment.
If a fluid (Liquid or Gas) is on the "Liquid API" then it can be handled by any mod using the Liquid API in any fluid container or transporter. I'm fairly certain that "isGaseous" is simply to adjust the rendering to show fill level of a tank by adjusting the opacity rather than the height of the rendered fluid.
Mekanism clearly wants to separate Liquids and Gasses rather than consider them both fluids. To do this, it has to use a separate API for the gasses (Liquids are already on the liquid API). Since there isn't a standards (Forge) one, Mekanism has to provide its own or find and share one from another mod that also separates gasses.
Forge is probably never going to implement a Gas API. Only a handful of mods choose to separate liquids and gasses, and separating them now would cause all sorts of problems. Would Steam be a Gas? If no, then it's confusing and contradictory. If yes, then you are forcing every mod that uses steam to add another pipe, even if steam is the only gas they use. Most of those mods would simply make their fluid pipes work with both APIs and destroy the separation anyway. Forge also doesn't implement APIs unless they are really common or necessary. It resisted adding the Forge Energy API until recently (after Minecraft 1.8), and RF style power is a few orders of magnitude more common than separated Gasses.
@VT-14 I am a coder, and there is a forge 'gas' api (so to speak), any 'fluid' registered using their 'fluid' api can be a liquid or a gas, as determined by the 'isGaseous' boolean.
The folks over at EnderIO, if you paid a little more attention to that very same reddit post, state that if Mekanism was using the forge 'fluid' api, they could make their conduits compatible, and keep fluids and gasses separate simply by checking 'isGaseous' when the gas or fluid was being inserted into the conduit.
I haven't seen the reddit post, so feel free to link that.
The only documentation that I found said that isGaseous helps with rendering. I have some questions that would help my understanding, but I assume most of those are addressed in the reddit post you mentioned.
Is that the right link? That reddit thread makes no mention of isGaseous. All that really said was that there is a Forge Gas API, though I can't find a separate API and everyone else is saying it's an option under the fluid api.
When I look in the Forge Fluid API at isGaseous, all I find is
/**
* This indicates if the fluid is gaseous.
*
* Useful for rendering the fluid in containers and the world.
*
* Generally this is associated with negative density fluids.
*/
protected boolean isGaseous;
If there is something that can be done on the fluid side to limit the gases to only certain pipes/conduits, then I could see that working. If the check you are mentioning is on the conduit side, then I see a lot of mods not checking properly or not caring and using their combined fluid conduits for both rather than respecting Mekanism and using separate conduits.
On a sidenote, density is mass divided by volume. Negative density would require either negative volume (what?) or negative mass (again, what?). lol.
@VT-14 I will preface this by stating I am not a Java programmer, but I would assume that it would be as simple as having the gas and fluid piping test for the isGaseous key. If true AND the piping supports Gas, allow transfer. If true AND the piping DOES NOT support Gas, disallow transfer. Then simply reverse the function and outcomes (eg. If false and the piping supports Gas only, disallow transfer.)
That's just my two cents. Also, I would assume they mean negative density as in a lesser density than the normal fluid (steam is less dense on a molecular level than water).
Veddy