AtmosphereCraft integration
bence98 opened this issue ยท 5 comments
Here's a brief overview over the API
It is structured like so:
- an AtmosphericServer holds AtmosphericWorld instances for every dimension
- an AtmosphericWorld holds AtmosphericChunk instances for every chunk
- you can interact with an AtmosphericChunk to add or remove gases
Getting an AtmosphericChunk instance:
AtmosphereCraft.getAtmosphericServer().getForWorld(worldObj).getChunk(pos);
where 'pos' may be a Vec3d, a BlockPos or a ChunkPos object
Modifying the atmosphere
Call one of these methods of AtmosphericChunk (true on success, false on fail):
public boolean addGas(AtmosphericGas gas)
public boolean removeGas(AtmosphericGas gas)
public AtmosphericGas getGas(GasType type)
Using AtmosphericGas objects
Constuctor: new AtmosphericGas(GasType type, double amount)
Methods of AtmosphericGas
public GasType getType()
public double getAmount()
Getting GasType objects
GasConstants.<gasname>
Substitute '' with the gases name (n2, o2, smoke, etc)
Example implementation of the furnace TileEntity:
AtmosphericChunk ach = AtmosphereCraft.getAtmosphericServer().getForWorld(worldObj).getChunk(this.getPos());
if(ach.removeGas(new AtmosphericGas(GasConstants.o2, 0.1)))
ach.addGas(new AtmosphericGas(GasConstants.co2, 0.1));
else ach.addGas(new AtmosphericGas(GasConstants.smoke, 0.2));
If you have any remaining questions concerning the API, I am happy to answer them!
Does this need to be done in the tile class? I would rather not add any support for other mods outside of the package that would contain the support.
I did it in the TileEntity's update() function, but if you have a better idea... I mean, you could call (from the TE) a proxy function that would check for loaded mods and execute their corresponding compat code. Do you have something specific as to when and what gases do you want the machines to emit?
No I was going to leave that up to you. There are better ways to have an api that doesn't need a call placed in the mods te. And would allow you to add support for other mods.
Using capability's, the reason I dont like having a call to another mod within the main bit of the code is when we update mc versions is easy to pull it out while we update. Look at for how we do it: https://github.com/TechReborn/TechReborn/tree/1.10.2/src/main/java/techreborn/compat