diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java index 6ea03045..9a0adf26 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java @@ -1,18 +1,22 @@ package gregtech.api.metatileentity.implementations; +import gregtech.GT_Mod; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.objects.XSTR; import gregtech.common.GT_Pollution; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.ChunkPosition; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; 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 (Might cause acidic rains and poisoning)"); + super(aID, aName, aNameRegional, aTier, 0, "Outputs the Pollution (Might cause ... things)"); } public GT_MetaTileEntity_Hatch_Muffler(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -85,4 +89,19 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { return 6*(mTier-1); } + public void pollutionParticles(){ + IGregTechTileEntity aMuffler=this.getBaseMetaTileEntity(); + World aWorld=aMuffler.getWorld(); + ForgeDirection aDir=ForgeDirection.getOrientation(aMuffler.getFrontFacing()); + int xPos=aDir.offsetX+aMuffler.getXCoord(); + int yPos=aDir.offsetX+aMuffler.getYCoord(); + int zPos=aDir.offsetX+aMuffler.getZCoord(); + + aWorld.spawnParticle("largesmoke", xPos + (new XSTR()).nextFloat(), yPos + (new XSTR()).nextFloat(), zPos + (new XSTR()).nextFloat(), 0.0D, 0.3D, 0.0D); + if(GT_Pollution.getPollutionAtCoords(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getZCoord())>= GT_Mod.gregtechproxy.mPollutionSmogLimit) { + aWorld.spawnParticle("largesmoke", xPos + (new XSTR()).nextFloat(), yPos + (new XSTR()).nextFloat(), zPos + (new XSTR()).nextFloat(), 0.0D, 0.3D + (new XSTR()).nextFloat(), 0.0D); + aWorld.spawnParticle("largesmoke", xPos + (new XSTR()).nextFloat(), yPos + (new XSTR()).nextFloat(), zPos + (new XSTR()).nextFloat(), 0.0D, 0.3D + (new XSTR()).nextFloat(), 0.0D); + } + } + } 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 d206e1a1..64364b1f 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 @@ -196,7 +196,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { //TODO FIX //if (aBaseMetaTileEntity.isClientSide() && aBaseMetaTileEntity.isActive()) { - // pollutionParticles(aBaseMetaTileEntity); + pollutionParticles(aBaseMetaTileEntity); //} if (aBaseMetaTileEntity.isServerSide()) { if (mEfficiency < 0) mEfficiency = 0; @@ -314,33 +314,11 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { //MAKE THE POLLUTION ROLL!!! TODO Fix? public void pollutionParticles(IGregTechTileEntity aBaseMetaTileEntity){ - World aWorld =DimensionManager.getWorld(aBaseMetaTileEntity.getWorld().provider.dimensionId); - //World aWorld=aBaseMetaTileEntity.getWorld(); + //World aWorld =DimensionManager.getWorld(aBaseMetaTileEntity.getWorld().provider.dimensionId); + World aWorld=aBaseMetaTileEntity.getWorld(); if(!aWorld.isRemote)return; - int xPos; - int yPos; - int zPos; - IGregTechTileEntity muffler; - for (MetaTileEntity tTileEntity : mMufflerHatches) { - muffler = tTileEntity.getBaseMetaTileEntity(); - xPos = ForgeDirection.getOrientation(muffler.getFrontFacing()).offsetX+muffler.getXCoord();//TODO optimize? - yPos = ForgeDirection.getOrientation(muffler.getFrontFacing()).offsetY+muffler.getYCoord(); - zPos = ForgeDirection.getOrientation(muffler.getFrontFacing()).offsetZ+muffler.getZCoord(); - System.out.print("x:"+xPos); - System.out.print("y:"+yPos); - System.out.print("z:"+zPos); - aWorld.spawnParticle("largesmoke", xPos + (new XSTR()).nextFloat(), yPos + (new XSTR()).nextFloat(), zPos + (new XSTR()).nextFloat(), 0.0D, 0.3D, 0.0D); - } - if(!GT_Mod.gregtechproxy.mPollution)return; - if(GT_Pollution.getPollutionAtCoords(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getZCoord())>GT_Mod.gregtechproxy.mPollutionSmogLimit){ - for (MetaTileEntity tTileEntity : mMufflerHatches) { - muffler = tTileEntity.getBaseMetaTileEntity(); - xPos = ForgeDirection.getOrientation(muffler.getFrontFacing()).offsetX+muffler.getXCoord(); - yPos = ForgeDirection.getOrientation(muffler.getFrontFacing()).offsetY+muffler.getYCoord(); - zPos = ForgeDirection.getOrientation(muffler.getFrontFacing()).offsetZ+muffler.getZCoord(); - aWorld.spawnParticle("largesmoke", xPos + (new XSTR()).nextFloat(), yPos + (new XSTR()).nextFloat(), zPos + (new XSTR()).nextFloat(), 0.0D, 0.3D + (new XSTR()).nextFloat(), 0.0D); - aWorld.spawnParticle("largesmoke", xPos + (new XSTR()).nextFloat(), yPos + (new XSTR()).nextFloat(), zPos + (new XSTR()).nextFloat(), 0.0D, 0.3D + (new XSTR()).nextFloat(), 0.0D); - } + for (GT_MetaTileEntity_Hatch_Muffler tTileEntity : mMufflerHatches) { + tTileEntity.pollutionParticles(); } }