Skip to content

Modders Info

Artem Khrapov edited this page Jan 6, 2018 · 2 revisions

Modders Info

General interaction

The great way to interact with EcologyMod is EcomodAPI.

1.12.2 - ecomod.api.*

1.11.2 - ecomod.api.*

1.10.2 - ecomod.api.*

1.7.10 - ecomod.api.*

It allows you to interact with PollutionManagers, Blocks, Items and other stuff.

General Pollution Emissions

To emit pollution without bonding to a TileEntity use

ecomod.api.EcomodAPI.emitPollution(World world, org.apache.commons.lang3.tuple.Pair<Integer,Integer> chunkLoc, PollutionData emission, boolean scheduled);

The 'scheduled' property determines whether the emission should be handled by WorldProcessingThread(better for the performance) or applied immediately.

chunkLoc - The Chunk Position(x,z).

Tile Entity emissions

If you want to make a polluting TileEntity you can use several ways:

  1. (The most recommended!) You can implement IPollutionEmitter interface and override
public PollutionData pollutionEmission();

It allows you to create the most flexible polluting behavior.

  1. You can use EcomodAPI.emitPollution(...), however, the pollution will be tile unbound.

  2. You can add your tile to the TEPollutionConfig (recommended for TileEntities without a special behavior) using IMC

    NBTTagCompound nbt = new NBTTagCompound();
    nbt.setString("id", "[your_TileEntity_registry_name]");
    nbt.setDouble("air", your_te_air_pollution);
    nbt.setDouble("water", your_te_water_pollution);
    nbt.setDouble("soil", your_te_soil_pollution);
    FMLInterModComms.sendMessage("ecomod", "add_to_tepc", nbt);

or add it to the main TEPollutionConfig using the Pull Request.

Analyzable Pollution Effects

To make a pollution effect you have to create your own effect behavior (using, for example, event handler) and an effect information object using

 EcomodAPI.addAnalyzerPollutionEffect(String id, String header, String desc, @Nullable ResourceLocation icon, PollutionData triggering_pollution, IAnalyzerPollutionEffect.TriggeringType triggering_type)

making the effect to be shown in the Analyzer if active. 'icon' should be either null or 50x50 png image ResourceLocation.

Then just compare the effect triggering pollution to the chunk pollution the effect is going to happen, and if it is greater (AND or OR by the triggering type) make the effect behavior triggered.


If you want to enhance the original mod by adding new pollution effect, add the effect information to the main effects config and send your effect behavior via the Pull Request.