Pollution Update/Rebalance

This commit is contained in:
Blood-Asp 2016-10-25 20:22:56 +02:00
parent 3c3231c4f8
commit 7926877ed1
15 changed files with 78 additions and 29 deletions

View file

@ -12,6 +12,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachin
import gregtech.api.net.GT_Packet_TileEntity;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.*;
import gregtech.common.GT_Pollution;
import ic2.api.Direction;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFire;
@ -25,6 +26,7 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.ChunkPosition;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@ -1118,6 +1120,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
}
}
}
GT_Pollution.addPollution(new ChunkPosition(getXCoord(), getYCoord(), getZCoord()), 100000);
mMetaTileEntity.doExplosion(aAmount);
}
}

View file

@ -210,7 +210,7 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity
}
if(tProducedEU>0&&getPollution()>0){
GT_Pollution.addPollution(new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()),
(int) ((tProducedEU * getPollution()/500)+1));
(int) ((tProducedEU * getPollution()/(500*mTier))+1));
}
}

View file

@ -12,7 +12,7 @@ import net.minecraft.world.ChunkPosition;
public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch {
public GT_MetaTileEntity_Hatch_Muffler(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 0, "Outputs the Pollution (Pollution might come later)");
super(aID, aName, aNameRegional, aTier, 0, "Outputs the Pollution (Might cause acidic rains and poisoning)");
}
public GT_MetaTileEntity_Hatch_Muffler(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
@ -21,7 +21,7 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch {
@Override
public String[] getDescription() {
return new String[]{mDescription, "DO NOT OBSTRUCT THE OUTPUT!"};
return new String[]{mDescription, "DO NOT OBSTRUCT THE OUTPUT!","Reduces Pollution to "+calculatePollutionReduction(100)+"%"};
}
@Override
@ -60,9 +60,13 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch {
}
public boolean polluteEnvironment() {
GT_Pollution.addPollution(new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 1000 - (95*mTier));
GT_Pollution.addPollution(new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), calculatePollutionReduction(1000));
return (mTier > 1 && getBaseMetaTileEntity().getRandomNumber(mTier) != 0) || getBaseMetaTileEntity().getAirAtSide(getBaseMetaTileEntity().getFrontFacing());
}
public int calculatePollutionReduction(int aPollution){
return (int) (aPollution *(Math.pow(0.7, mTier-1)));
}
@Override
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {

View file

@ -1,11 +1,11 @@
package gregtech.common;
package gregtech.common;
import gregtech.GT_Mod;
import gregtech.api.objects.XSTR;
import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
@ -18,7 +18,37 @@ import java.util.ArrayList;
import java.util.List;
public class GT_Pollution {
/**
* Pollution dispersion until effects start:
* Calculation: ((Limit * 0.01) + 2000) * (4 <- spreading rate)
*
* SMOG(500k) 466.7 pollution/sec
* Poison(750k) 633,3 pollution/sec
* Dying Plants(1mio) 800 pollution/sec
* Sour Rain(1.5mio) 1133.3 pollution/sec
*
* Pollution producers (pollution/sec)
* Bronze Boiler(20)
* Lava Boiler(20)
* High Pressure Boiler(20)
* Bronze Blast Furnace(50)
* Diesel Generator(14/28/75)
* Gas Turbine(7/14/37)
* Charcoal Pile(100)
*
* Large Diesel Generator(300)
* Electric Blast Furnace(100)
* Implosion Compressor(2000)
* Large Boiler(240)
* Large Gas Turbine(160)
* Multi Smelter(100)
* Pyrolyse Oven(400)
*
* Machine Explosion(100,000)
*
* Muffler Hatch Pollution reduction:
* LV (0%), MV (30%), HV (52%), EV (66%), IV (76%), LuV (84%), ZPM (89%), UV (92%), MAX (95%)
*/
static List<ChunkPosition> tList = null;
static int loops = 1;
@ -54,7 +84,7 @@ public class GT_Pollution {
for(ChunkPosition tNPos : tNeighbor){
if(GT_Proxy.chunkData.containsKey(tNPos)){
int tNPol = GT_Proxy.chunkData.get(tNPos)[1];
if(tNPol<tPollution && tNPol*120 < tPollution*100){
if(tNPol<tPollution && tNPol*12 < tPollution*10){
int tDiff = tPollution - tNPol;
tDiff = tDiff/10;
tNPol += tDiff;
@ -62,7 +92,7 @@ public class GT_Pollution {
GT_Proxy.chunkData.get(tNPos)[1] = tNPol;
}
}else{
GT_Utility.getUndergroundOil(aWorld,tPos.chunkPosX*16,tPos.chunkPosZ*16);
GT_Utility.getUndergroundOil(aWorld,tNPos.chunkPosX<<4,tNPos.chunkPosZ<<4);
}
}}
int[] tArray = GT_Proxy.chunkData.get(tPos);
@ -72,23 +102,33 @@ public class GT_Pollution {
//Create Pollution effects
// Smog filter TODO
if(tPollution > GT_Mod.gregtechproxy.mPollutionSmogLimit){
AxisAlignedBB chunk = AxisAlignedBB.getBoundingBox(tPos.chunkPosX<<4, 0, tPos.chunkPosZ<<4, tPos.chunkPosX<<4+16, 256, tPos.chunkPosZ<<4+16);
List<EntityLivingBase> tEntitys = aWorld.getEntitiesWithinAABB(EntityLivingBase.class, chunk);
for(EntityLivingBase tEnt : tEntitys){
if(!GT_Utility.isWearingFullGasHazmat(tEnt) && tRan.nextInt(tPollution/2000) > 40){
int ran = tRan.nextInt(3);
if(ran==0)tEnt.addPotionEffect(new PotionEffect(Potion.weakness.id, Math.min(tPollution/2500,1000), tPollution/400000));
if(ran==1)tEnt.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, Math.min(tPollution/2500,1000), tPollution/400000));
if(ran==2)tEnt.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, Math.min(tPollution/2500,1000), tPollution/400000));
}
}
// Poison effects
if(tPollution > GT_Mod.gregtechproxy.mPollutionPoisonLimit){
AxisAlignedBB chunk = AxisAlignedBB.getBoundingBox(tPos.chunkPosX*16, 0, tPos.chunkPosZ*16, tPos.chunkPosX*16+16, 256, tPos.chunkPosZ*16+16);
List<EntityLiving> tEntitys = aWorld.getEntitiesWithinAABB(EntityLiving.class, chunk);
for(EntityLiving tEnt : tEntitys){
if(tRan.nextInt(tPollution/25000) > 20){
tEnt.addPotionEffect(new PotionEffect(Potion.poison.id, tPollution/25000, 1));
}
for(EntityLivingBase tEnt : tEntitys){
if(!GT_Utility.isWearingFullGasHazmat(tEnt) && tRan.nextInt(tPollution/2000) > 20){
int ran = tRan.nextInt(3);
if(ran==0)tEnt.addPotionEffect(new PotionEffect(Potion.poison.id, Math.min(tPollution/2500,1000), tPollution/500000));
if(ran==1)tEnt.addPotionEffect(new PotionEffect(Potion.confusion.id, Math.min(tPollution/2500,1000), 1));
if(ran==2)tEnt.addPotionEffect(new PotionEffect(Potion.blindness.id, Math.min(tPollution/2500,1000), 1));
}
}
// killing plants
if(tPollution > GT_Mod.gregtechproxy.mPollutionVegetationLimit){
int f = 20;
for(;f<(tPollution/25000);f++){
int x =tPos.chunkPosX*16+(tRan.nextInt(16));;
int x =tPos.chunkPosX<<4+(tRan.nextInt(16));;
int y =60 +(-f+tRan.nextInt(f*2+1));
int z =tPos.chunkPosZ*16+(tRan.nextInt(16));
int z =tPos.chunkPosZ<<4+(tRan.nextInt(16));
damageBlock(x, y, z, tPollution > GT_Mod.gregtechproxy.mPollutionSourRainLimit);
}}}}
}
@ -151,7 +191,7 @@ public class GT_Pollution {
public static void addPollution(ChunkPosition aPos, int aPollution){
if(!GT_Mod.gregtechproxy.mPollution)return;
try{
ChunkPosition tPos = new ChunkPosition(aPos.chunkPosX/16, 1, aPos.chunkPosZ/16);
ChunkPosition tPos = new ChunkPosition(aPos.chunkPosX>>4, 1, aPos.chunkPosZ>>4);
// System.out.println("add pollution x: "+ tPos.chunkPosX +" z: " + tPos.chunkPosZ +" poll: "+aPollution);
int[] tData = new int[2];
if(GT_Proxy.chunkData.containsKey(tPos)){

View file

@ -141,7 +141,7 @@ public class GT_MetaTileEntity_Boiler_Bronze
this.mTemperature += 1;
}
if(this.mProcessingEnergy>0 && (aTick % 20L == 0L)){
GT_Pollution.addPollution(new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 30);
GT_Pollution.addPollution(new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 20);
}
aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0);
}

View file

@ -120,7 +120,7 @@ public class GT_MetaTileEntity_Boiler_Lava
}
if(this.mProcessingEnergy>0 && (aTick % 20L == 0L)){
GT_Pollution.addPollution(new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 30);
GT_Pollution.addPollution(new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 20);
}
aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0);
}

View file

@ -146,7 +146,7 @@ public class GT_MetaTileEntity_Boiler_Steel
this.mTemperature += 1;
}
if(this.mProcessingEnergy>0 && (aTick % 20L == 0L)){
GT_Pollution.addPollution(new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 30);
GT_Pollution.addPollution(new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 20);
}
aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0);
}

View file

@ -209,7 +209,7 @@ public class GT_MetaTileEntity_BronzeBlastFurnace
}
}
if(this.mMaxProgresstime>0 && (aTimer % 20L == 0L)){
GT_Pollution.addPollution(new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 200);
GT_Pollution.addPollution(new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 50);
}
aBaseMetaTileEntity.setActive((this.mMaxProgresstime > 0) && (this.mMachine));

View file

@ -9,6 +9,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Recipe;
import gregtech.common.GT_Pollution;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
@ -85,6 +86,7 @@ public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_MultiBlock
this.mEfficiency = 10000;
this.mEfficiencyIncrease = 10000;
this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
GT_Pollution.addPollution(new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), mMaxProgresstime*5);
return true;
} else {
this.mEfficiency = 0;

View file

@ -215,7 +215,7 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock
@Override
public int getPollutionPerTick(ItemStack aStack) {
return 0;
return 15;
}
@Override

View file

@ -218,7 +218,7 @@ public class GT_MetaTileEntity_ElectricBlastFurnace
}
public int getPollutionPerTick(ItemStack aStack) {
return 10;
return 5;
}
public int getDamageToComponent(ItemStack aStack) {

View file

@ -139,7 +139,7 @@ public class GT_MetaTileEntity_ImplosionCompressor
}
public int getPollutionPerTick(ItemStack aStack) {
return 1000;
return 100;
}
public int getDamageToComponent(ItemStack aStack) {

View file

@ -222,7 +222,7 @@ public abstract class GT_MetaTileEntity_LargeBoiler
}
public int getPollutionPerTick(ItemStack aStack) {
return 10;
return 12;
}
public int getDamageToComponent(ItemStack aStack) {

View file

@ -77,7 +77,7 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT
@Override
public int getPollutionPerTick(ItemStack aStack) {
return 10;
return 8;
}
@Override

View file

@ -181,7 +181,7 @@ public class GT_MetaTileEntity_MultiFurnace
}
public int getPollutionPerTick(ItemStack aStack) {
return 20;
return 5;
}
public int getDamageToComponent(ItemStack aStack) {