Skip to content
Artem Khrapov edited this page Oct 24, 2017 · 4 revisions

How it works?


EcologyMod adds an environmental pollution system to Minecraft.

It consists mainly of PollutionManager and WorldProcessingThread. PollutionManager stores and processes(including diffusion) pollution information. WorldProcessingThread is a thread which processes world chunks, calculating their pollution and handles all pollution emissions.

Note: The pollution system by default is enabled only for the dimension 0 (Overworld). To activate it for other dimensions, add their indices to "allowedDimensions" property in the EcologyMod config (configs/ecomod.cfg)


So, in the PollutionManager all chunks have a property called PollutionData which consist of 3 parameters: air, water, soil. They define pollution level of the chunk.

Pollution is being emitted to the chunk either by tile entities (see TEPollutionConfig or TEPC) or by pollution sources when triggered.



Pollution Sources

Pollution Source is a data structure which has its ID and PollutionData that is being emitted when the source is triggered.

PollutionSources is located at (minecraft_location)/config/ecomod/PollutionSources.json

If you want PollutionSourcesConfig to stop updating change the "version" property to "custom".

The default list of pollution sources can be found at: https://github.com/Artem226/MinecraftEcologyMod/blob/1.11/PollutionSources.json

Default Sources

  • Bonemeal pollution is triggered when bonemeal is used.
  • Explosion pollution per its power is triggered when an explosion occurs. The emission is being multiplied by the explosion power.
  • Tree growing pollution reducing is triggered when a sapling being grown into a tree. The emission is negative thus it reduces the chunk pollution.
  • Hoe plowing reducing is triggered when grass is being plowed by a player with a hoe. The emission is negative thus it reduces the chunk pollution.
  • Leaves reduction is triggered by leaves updates. The emission is negative thus it reduces the chunk pollution.
  • Fire pollution is triggered by fire updates.
  • Smelted item pollution is triggered by a furnace when an item is being smelted.
  • Concentrated pollution explosion pollution is triggered by concentrated pollution explosion.
  • Brewing potion pollution is triggered when a potion is being brewed.
  • Advanced filter reduction is triggered by an advanced pollution filter. The emission is negative thus it reduces the chunk pollution.
  • Expired item is triggered when an item lifetime is being expired if not blacklisted or overridden.

Pollution emitted by Tile Entities

Every WorldPollutionThread run Tile Entities in loaded chunks will emit pollution as included in the TEPollutionConfig.

TEPollutionConfig is located at (minecraft_location)/config/ecomod/TEPollutionConfig.json

If you want TEPollutionConfig to stop updating change the "version" property to "custom".

The default TEPollutionConfig: https://github.com/Artem226/MinecraftEcologyMod/blob/1.11/TEPC.json

Diffusion

Every WorldPollutionThread run every chunk will spread its pollution to the loaded neighbors.

Air spreads according to the config-defined value. Water pollution spreads at a halved rate. Soil pollution spreads even slower.

Diffusion function:

    public void diffuse(ChunkPollution c)
    {
        int i = c.getX();
        int j = c.getZ();

        PollutionData to_spread = c.getPollution().clone();

        to_spread = to_spread.multiplyAll(EMConfig.diffusion_factor * EMConfig.wptcd / 60);
        to_spread.multiply(PollutionType.WATER, 0.5F);

        to_spread.multiply(PollutionType.SOIL, 0.07F);

        float count = 0;

        if(addPollutionIfLoaded(i + 1, j, to_spread))count--;
        if(addPollutionIfLoaded(i - 1, j, to_spread))count--;
        if(addPollutionIfLoaded(i, j - 1, to_spread))count--;
        if(addPollutionIfLoaded(i, j + 1, to_spread))count--;

        addPollutionIfLoaded(i, j, to_spread.multiplyAll(count));
    }

Pollution Effects

Information about pollution effects can be found at the other wiki page:

Pollution Effects