Pollution remove
This commit is contained in:
parent
933806ebbd
commit
b8aa41e9df
17 changed files with 10 additions and 157 deletions
|
@ -5,12 +5,10 @@ import gregtech.api.interfaces.ITexture;
|
|||
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
|
||||
import gregtech.api.util.GT_Recipe;
|
||||
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
|
||||
import gregtech.common.GT_Pollution;
|
||||
import gregtech.api.util.GT_Utility;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -179,7 +177,6 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity
|
|||
@Override
|
||||
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
|
||||
if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && aTick % 10 == 0) {
|
||||
long tProducedEU = 0;
|
||||
if (mFluid == null) {
|
||||
if (aBaseMetaTileEntity.getUniversalEnergyStored() < maxEUOutput() + getMinimumStoredEU()) {
|
||||
mInventory[getStackDisplaySlot()] = null;
|
||||
|
@ -193,7 +190,6 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity
|
|||
if (tFuelValue > 0 && tConsumed > 0 && mFluid.amount > tConsumed) {
|
||||
long tFluidAmountToUse = Math.min(mFluid.amount / tConsumed, (maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue);
|
||||
if (tFluidAmountToUse > 0 && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true))
|
||||
tProducedEU = tFluidAmountToUse * tFuelValue;
|
||||
mFluid.amount -= tFluidAmountToUse * tConsumed;
|
||||
}
|
||||
}
|
||||
|
@ -204,22 +200,15 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity
|
|||
if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tEmptyContainer)) {
|
||||
aBaseMetaTileEntity.increaseStoredEnergyUnits(tFuelValue, true);
|
||||
aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1);
|
||||
tProducedEU = tFuelValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(tProducedEU>0&&getPollution()>0){
|
||||
GT_Pollution.addPollution(new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()),
|
||||
(int) ((tProducedEU * getPollution()/500)+1));
|
||||
}
|
||||
}
|
||||
|
||||
if (aBaseMetaTileEntity.isServerSide())
|
||||
aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU());
|
||||
}
|
||||
|
||||
public abstract int getPollution();
|
||||
|
||||
public abstract GT_Recipe_Map getRecipes();
|
||||
|
||||
public abstract int getEfficiency();
|
||||
|
|
|
@ -5,10 +5,8 @@ import gregtech.api.interfaces.ITexture;
|
|||
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
|
||||
import gregtech.api.metatileentity.MetaTileEntity;
|
||||
import gregtech.api.objects.GT_RenderedTexture;
|
||||
import gregtech.common.GT_Pollution;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
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) {
|
||||
|
@ -60,7 +58,6 @@ 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));
|
||||
return (mTier > 1 && getBaseMetaTileEntity().getRandomNumber(mTier) != 0) || getBaseMetaTileEntity().getAirAtSide(getBaseMetaTileEntity().getFrontFacing());
|
||||
}
|
||||
|
||||
|
|
|
@ -1552,17 +1552,15 @@ public class GT_Utility {
|
|||
}
|
||||
int tAmount = (int) (Math.pow(amount, 5) / 100);
|
||||
ChunkPosition tPos = new ChunkPosition(aX/16, 1, aZ/16);
|
||||
int[] tInts = new int[2];
|
||||
if(GT_Proxy.chunkData.containsKey(tPos)){
|
||||
tInts = GT_Proxy.chunkData.get(tPos);
|
||||
int[] tInts = GT_Proxy.chunkData.get(tPos);
|
||||
if(tInts.length>0){
|
||||
if(tInts[0]>=0){tAmount = tInts[0];}
|
||||
}
|
||||
GT_Proxy.chunkData.remove(tPos);
|
||||
}
|
||||
tAmount = tAmount - 5;
|
||||
tInts[0] = tAmount;
|
||||
GT_Proxy.chunkData.put(tPos, tInts);
|
||||
GT_Proxy.chunkData.put(tPos, new int[]{tAmount});
|
||||
|
||||
return new FluidStack(tFluid, tAmount);
|
||||
}
|
||||
|
@ -1758,17 +1756,6 @@ public class GT_Utility {
|
|||
FluidStack tFluid = getUndergroundOil(aWorld, aX, aZ);
|
||||
tList.add("Oil in Chunk: " + tFluid.amount + " " + tFluid.getLocalizedName());
|
||||
}
|
||||
if(aPlayer.capabilities.isCreativeMode){
|
||||
ChunkPosition tPos = new ChunkPosition(aX, aY, aZ);
|
||||
if(GT_Proxy.chunkData.containsKey(tPos)){
|
||||
int[] tPollution = GT_Proxy.chunkData.get(tPos);
|
||||
if(tPollution.length>1){
|
||||
tList.add("Pollution in Chunk: "+tPollution[1]);
|
||||
}else{
|
||||
tList.add("No Pollution in Chunk");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (tBlock instanceof IDebugableBlock) {
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
package gregtech.common;
|
||||
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
|
||||
public class GT_Pollution {
|
||||
|
||||
|
||||
// List<ChunkPosition> list = new ArrayList<ChunkPosition>(chunkData.keySet());
|
||||
|
||||
public static void onWorldTick(int aTick){
|
||||
|
||||
}
|
||||
|
||||
public static void addPollution(ChunkPosition aPos, int aPollution){
|
||||
int[] tData = new int[2];
|
||||
if(GT_Proxy.chunkData.containsKey(aPos)){
|
||||
tData = GT_Proxy.chunkData.get(aPos);
|
||||
if(tData.length>1){
|
||||
tData[1] += aPollution;
|
||||
}
|
||||
GT_Proxy.chunkData.replace(aPos, tData);
|
||||
}else{
|
||||
tData[1] += aPollution;
|
||||
GT_Proxy.chunkData.put(aPos, tData);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1446,7 +1446,6 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
|
|||
}
|
||||
}
|
||||
}
|
||||
GT_Pollution.onWorldTick((int) (aEvent.world.getTotalWorldTime() % 1200));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1929,48 +1928,19 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
|
|||
ChunkPosition tPos = new ChunkPosition(event.getChunk().xPosition,1,event.getChunk().zPosition);
|
||||
if(chunkData.containsKey(tPos)){
|
||||
int[] tInts = chunkData.get(tPos);
|
||||
if(tInts.length>0){event.getData().setInteger("GTOIL", tInts[0]);}
|
||||
if(tInts.length>1){event.getData().setInteger("GTPOLLUTION", tInts[1]);}}
|
||||
if(tInts.length>0){event.getData().setInteger("GTOIL", tInts[0]);}}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void handleChunkLoadEvent(ChunkDataEvent.Load event)
|
||||
{
|
||||
int tOil = 0;
|
||||
int tPollution = 0;
|
||||
|
||||
ChunkPosition tPos = new ChunkPosition(event.getChunk().xPosition,1,event.getChunk().zPosition);
|
||||
int[] tData = new int[2];
|
||||
if(chunkData.containsKey(tPos)){
|
||||
tData = chunkData.get(tPos);
|
||||
chunkData.remove(tPos);
|
||||
}
|
||||
|
||||
int tOil = -1;
|
||||
if(event.getData().hasKey("GTOIL")){
|
||||
if(tData.length>2){
|
||||
tOil = tData[0];
|
||||
}else{
|
||||
tOil += event.getData().getInteger("GTOIL");
|
||||
}
|
||||
}else{
|
||||
if(tData[0]!=0){
|
||||
tOil = tData[0];
|
||||
}
|
||||
}
|
||||
|
||||
if(event.getData().hasKey("GTPOLLUTION")){
|
||||
if(tData.length>2){
|
||||
tPollution = tData[1];
|
||||
}else{
|
||||
tPollution += event.getData().getInteger("GTPOLLUTION");
|
||||
}
|
||||
}else{
|
||||
if(tData[1]!=0){
|
||||
tPollution = tData[1];
|
||||
}
|
||||
}
|
||||
|
||||
chunkData.put(tPos, new int[]{ tOil,tPollution,-1});
|
||||
tOil = event.getData().getInteger("GTOIL");}
|
||||
ChunkPosition tPos = new ChunkPosition(event.getChunk().xPosition,1,event.getChunk().zPosition);
|
||||
if(chunkData.containsKey(tPos)){
|
||||
chunkData.remove(tPos);}
|
||||
chunkData.put(tPos, new int[]{ tOil});
|
||||
}
|
||||
|
||||
public static class OreDictEventContainer {
|
||||
|
|
|
@ -10,11 +10,9 @@ import gregtech.api.metatileentity.MetaTileEntity;
|
|||
import gregtech.api.objects.GT_RenderedTexture;
|
||||
import gregtech.api.util.GT_ModHandler;
|
||||
import gregtech.api.util.GT_OreDictUnificator;
|
||||
import gregtech.common.GT_Pollution;
|
||||
import gregtech.common.gui.GT_Container_Boiler;
|
||||
import gregtech.common.gui.GT_GUIContainer_Boiler;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
@ -140,9 +138,6 @@ public class GT_MetaTileEntity_Boiler_Bronze
|
|||
this.mProcessingEnergy -= 1;
|
||||
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);
|
||||
}
|
||||
aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,11 +10,9 @@ import gregtech.api.metatileentity.MetaTileEntity;
|
|||
import gregtech.api.objects.GT_RenderedTexture;
|
||||
import gregtech.api.util.GT_ModHandler;
|
||||
import gregtech.api.util.GT_OreDictUnificator;
|
||||
import gregtech.common.GT_Pollution;
|
||||
import gregtech.common.gui.GT_Container_Boiler;
|
||||
import gregtech.common.gui.GT_GUIContainer_Boiler;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
@ -118,10 +116,6 @@ public class GT_MetaTileEntity_Boiler_Lava
|
|||
this.mProcessingEnergy -= 3;
|
||||
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);
|
||||
}
|
||||
aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,11 +10,9 @@ import gregtech.api.metatileentity.MetaTileEntity;
|
|||
import gregtech.api.objects.GT_RenderedTexture;
|
||||
import gregtech.api.util.GT_ModHandler;
|
||||
import gregtech.api.util.GT_OreDictUnificator;
|
||||
import gregtech.common.GT_Pollution;
|
||||
import gregtech.common.gui.GT_Container_Boiler;
|
||||
import gregtech.common.gui.GT_GUIContainer_Boiler;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
@ -145,9 +143,6 @@ public class GT_MetaTileEntity_Boiler_Steel
|
|||
this.mProcessingEnergy -= 2;
|
||||
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);
|
||||
}
|
||||
aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,9 +100,4 @@ public class GT_MetaTileEntity_DieselGenerator
|
|||
public ITexture[] getSidesActive(byte aColor) {
|
||||
return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE_ACTIVE)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPollution() {
|
||||
return 10;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,9 +87,4 @@ public class GT_MetaTileEntity_FluidNaquadahReactor
|
|||
public ITexture[] getSidesActive(byte aColor) {
|
||||
return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_FLUID_SIDE_ACTIVE)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPollution() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,9 +89,4 @@ public class GT_MetaTileEntity_GasTurbine
|
|||
public ITexture[] getSidesActive(byte aColor) {
|
||||
return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.GAS_TURBINE_SIDE_ACTIVE)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPollution() {
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,9 +89,4 @@ public class GT_MetaTileEntity_MagicEnergyConverter
|
|||
public ITexture[] getSidesActive(byte aColor) {
|
||||
return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPollution() {
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -283,9 +283,4 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B
|
|||
public ITexture[] getSidesActive(byte aColor) {
|
||||
return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPollution() {
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -89,9 +89,4 @@ public class GT_MetaTileEntity_PlasmaGenerator
|
|||
public ITexture[] getSidesActive(byte aColor) {
|
||||
return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPollution() {
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -87,9 +87,4 @@ public class GT_MetaTileEntity_SolidNaquadahReactor
|
|||
public ITexture[] getSidesActive(byte aColor) {
|
||||
return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_SIDE_ACTIVE)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPollution() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,9 +104,4 @@ public class GT_MetaTileEntity_SteamTurbine extends GT_MetaTileEntity_BasicGener
|
|||
public ITexture[] getSidesActive(byte aColor) {
|
||||
return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.STEAM_TURBINE_SIDE_ACTIVE)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPollution() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import gregtech.api.objects.GT_ItemStack;
|
|||
import gregtech.api.objects.GT_RenderedTexture;
|
||||
import gregtech.api.util.GT_OreDictUnificator;
|
||||
import gregtech.api.util.GT_Utility;
|
||||
import gregtech.common.GT_Pollution;
|
||||
import gregtech.common.gui.GT_Container_BronzeBlastFurnace;
|
||||
import gregtech.common.gui.GT_GUIContainer_BronzeBlastFurnace;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -21,7 +20,6 @@ import net.minecraft.init.Blocks;
|
|||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class GT_MetaTileEntity_BronzeBlastFurnace
|
||||
|
@ -210,10 +208,6 @@ public class GT_MetaTileEntity_BronzeBlastFurnace
|
|||
checkRecipe();
|
||||
}
|
||||
}
|
||||
if(this.mMaxProgresstime>0 && (aTimer % 20L == 0L)){
|
||||
GT_Pollution.addPollution(new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 200);
|
||||
}
|
||||
|
||||
aBaseMetaTileEntity.setActive((this.mMaxProgresstime > 0) && (this.mMachine));
|
||||
if (aBaseMetaTileEntity.isActive()) {
|
||||
if (aBaseMetaTileEntity.getAir(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1))) {
|
||||
|
|
Loading…
Reference in a new issue