Pollution

Various machines in GregTech generate pollution that can cause harmful effects to players and even the terrain. Fortunately however, pollution will slowly spread and dissipate over time.

Pollution is currently enabled by default in 2.1.2.0 (stable) and all current dev versions!

Cycle Start
Each tick the pollution controller (piece of code that manages Pollution) will check if the current tick is a factor of 1,200. If it is, then the controller will make a list of all chunks that have pollution in them, and decide from that how many of those chunks should be processed on each tick over the next 1,200 ticks. This process allows for even distribution of CPU consumption over the cycle length (approx 1 minute). The number of chunks processed each tick in a cycle is determined by dividing the total number of chunks that contain pollution by the length of the cycle (1,200). At minimum 1 chunk will be processed per tick.

Cycle Tick
Upon each cycle tick, for each chunk specified to be processed on this tick, first the controller gets the amount of pollution in the chunk. Then it reassigns the pollution value to be 99.45% of what it was before. Next it checks if the pollution value is greater than 400,000. If it is, then it finds each neighboring chunk (not diagonals). For each neighboring chunk, the controller first decides if the pollution can be spread to that chunk. If the pollution of the neighbor times 6, is less than the current chunk's pollution times 5, then it is a valid chunk to spread to, if not then nothing happens with that neighbor.

When spreading to a neighbor, the amount of pollution transferred is defined by taking the current chunk's pollution minus the neighbor's pollution, and then dividing by 20. So if the current chunk has 100,000 gibbl and the neighbor chunk has 20,000 gibbl, then the amount transferred is 4,000 gibbl.

After pollution has been spread to neighbors, the controller decides if any pollution effects should happen in the chunk based on a number of rules which you can see in the next section.

Smog
First, check if the pollution value is above the smog requirement as defined in the config. (as of v1.5.1.2, 500,000 gibbl)

Next get all living entities located inside the chunk. For each check if they (players only) are wearing a full hazmat suit. If they are, then don't do anything, but if not, generate a random number from 0 to 2. Effects are as follows depending on the number (multiple possible):
 * All: apply a digging slowdown debuff
 * 1: apply a weakness debuff
 * 2: apply a movement slowdown debuff

Poison
First, check if the pollution value is above the poison requirement as defined in the config. (as of v1.5.1.2, 750,000 gibbl)

Again, get all living entities, and check if any are wearing a full hazmat suit. If not wearing one, then generate a random number from 0 to 3. Effects are as follows depending on the number (multiple possible):
 * All: apply a hunger debuff
 * 1: apply a confusion debuff
 * 2: apply a poison debuff
 * 3: apply a blindness debuff

Vegetation Destruction
First, check if the pollution value is above the vegetation requirement as defined in the config. (as of v1.5.1.2, 1,000,000 gibbl)

Then run the following code, The loop will continue running until the  value is greater than or equal to the pollution value divided by 25,000.

For each run through the loop, a random (x, y, z) position is chosen inside that chunk. The  value determines the vertical range of where the effect could occur.

Then the  function is called. The pollution controller first ignores Air, Stone, Sand, and Deadbush blocks. Then if the block is a:
 * leaf block, delete it.
 * sugarcane, vine, cocoa, waterlily, wheat, cactus, melon/pumpkin block, melon/pumpkin stem, red/yellow flower, carrot, or a potato, break it and drop it as an item.
 * tallgrass or sapling, change it to a deadbush.
 * mossy-cobblestone block, change it to a regular cobblestone block.
 * grass block, change it to a dirt block.
 * farmland block, change it to a sand block.

The  section of this code is explained in the next effect, Sour Rain.

Sour Rain
After finding a random position within the chunk from the vegetation effect, check if it is currently raining and the pollution value is above the sour rain requirement as defined in the config. (as of v1.5.1.2, 2,000,000 gibbl)

Now check to be sure that the block is:
 * a stone, gravel, or cobblestone block
 * and, has an air block above it,
 * and, can see the sky.

If the block is a:
 * stone block, then change it to cobblestone.
 * cobblestone block, then change it to gravel.
 * or, is a gravel block, then change it to sand.

Reduction and Production
Unfortunately, just like in real life, there is very little that can be done to get rid of pollution. Pollution will naturally dissipate over time albeit rather slowly. There is a mid-high tier multiblock machine called the Air Filter that can be powered to clean the pollution in that chunk, but even that is fairly slow. Or you can use GT++ Scrubbers. So the only way to practically reduce how much pollution you have, is to reduce how much you are producing.

All generators excluding the Steam Turbine, will produce pollution, as well as any Multiblock structures that have a Muffler block, the Charcoal Pit, the Bricked (and Bronze) Blast Furnace, and all GregTech boilers (single block, high pressure, and multiblock versions). Machine explosions will also create massive amounts of pollution all at once: Single block machines will generate 100,000 gibbl each, and multiblock machines will generate 300,000 gibbl each.

Upgrading the muffler in a multiblock will reduce the amount of pollution generated.

Measurement
Pollution in GregTech is measured in gibbl. To find out how much pollution a particular chunk has, you can craft the Portable Scanner device, charge it, then right-click on anything within a specific chunk, and it will print out in chat how much, if any, pollution there is in that chunk.