From ef5a72fa51fd8d192b06cc410f6c8f21343369e7 Mon Sep 17 00:00:00 2001 From: Technus Date: Mon, 24 Oct 2016 11:18:56 +0200 Subject: [PATCH] Explosive pollution --- .../gregtech/api/interfaces/tileentity/IEnergyConnected.java | 5 +++++ .../java/gregtech/api/metatileentity/MetaPipeEntity.java | 5 +++++ .../java/gregtech/api/metatileentity/MetaTileEntity.java | 5 +++++ .../implementations/GT_MetaTileEntity_MultiBlockBase.java | 3 +++ 4 files changed, 18 insertions(+) diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java index 7c4ef1af..ee7502a0 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java @@ -1,11 +1,14 @@ package gregtech.api.interfaces.tileentity; import cofh.api.energy.IEnergyReceiver; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.util.GT_Utility; +import gregtech.common.GT_Pollution; import ic2.api.energy.tile.IEnergySink; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.ChunkPosition; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -104,6 +107,8 @@ public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAnd GT_Utility.sendSoundToPlayers(tWorld, GregTech_API.sSoundList.get(209), 1.0F, -1, tX, tY, tZ); tWorld.setBlock(tX, tY, tZ, Blocks.air); if (GregTech_API.sMachineExplosions) + if(GT_Mod.gregtechproxy.mPollution) + GT_Pollution.addPollution(new ChunkPosition(tX, tY, tZ), 50000); tWorld.createExplosion(null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true); } } diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java index ef4f4f13..63b0bc99 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java @@ -2,6 +2,7 @@ package gregtech.api.metatileentity; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -9,6 +10,7 @@ import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.GT_Config; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Utility; +import gregtech.common.GT_Pollution; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.texture.IIconRegister; @@ -20,6 +22,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.ChunkPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -664,6 +667,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity { World tWorld = getBaseMetaTileEntity().getWorld(); tWorld.setBlock(tX, tY, tZ, Blocks.air); if (GregTech_API.sMachineExplosions) + if(GT_Mod.gregtechproxy.mPollution) + GT_Pollution.addPollution(new ChunkPosition(tX, tY, tZ), 50000); tWorld.createExplosion(null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true); } diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index d8349d0d..061144a7 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -2,6 +2,7 @@ package gregtech.api.metatileentity; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -10,6 +11,7 @@ import gregtech.api.util.GT_Config; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; +import gregtech.common.GT_Pollution; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.texture.IIconRegister; @@ -20,6 +22,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.ChunkPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -854,6 +857,8 @@ public abstract class MetaTileEntity implements IMetaTileEntity { GT_Utility.sendSoundToPlayers(tWorld, GregTech_API.sSoundList.get(209), 1.0F, -1, tX, tY, tZ); tWorld.setBlock(tX, tY, tZ, Blocks.air); if (GregTech_API.sMachineExplosions) + if(GT_Mod.gregtechproxy.mPollution) + GT_Pollution.addPollution(new ChunkPosition(tX, tY, tZ), 50000); tWorld.createExplosion(null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true); } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index 87442bb7..5b8a8232 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -16,12 +16,14 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; +import gregtech.common.GT_Pollution; import gregtech.common.items.GT_MetaGenerated_Tool_01; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.ChunkPosition; import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; @@ -480,6 +482,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { } public void explodeMultiblock() { + GT_Pollution.addPollution(new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 300000); mInventory[1] = null; for (MetaTileEntity tTileEntity : mInputBusses) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); for (MetaTileEntity tTileEntity : mOutputBusses) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]);