From 552ee574506a14f654709ec1236c324af5c8ad64 Mon Sep 17 00:00:00 2001 From: Technus Date: Thu, 20 Oct 2016 14:41:45 +0200 Subject: [PATCH] HOLY SHIT I DID IT (the ez way not like namikon told me to do...) Mullfers now generate pollution particles when the controller is active and there is pollution in the machine --- .../GT_MetaTileEntity_Hatch_Muffler.java | 15 ++++++++++----- .../GT_MetaTileEntity_MultiBlockBase.java | 17 +++-------------- .../GT_MetaTileEntity_BronzeBlastFurnace.java | 4 ++-- 3 files changed, 15 insertions(+), 21 deletions(-) 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 9a0adf26..ff82d3d7 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 @@ -89,9 +89,15 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { return 6*(mTier-1); } - public void pollutionParticles(){ + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + if(this.getBaseMetaTileEntity().isActive()) + pollutionParticles(this.getBaseMetaTileEntity().getWorld()); + } + + public void pollutionParticles(World aWorld){ 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(); @@ -99,9 +105,8 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { 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); + aWorld.spawnParticle("largesmoke", xPos + (new XSTR()).nextFloat(), yPos + (new XSTR()).nextFloat(), zPos + (new XSTR()).nextFloat(), 0.0D, 0.45D, 0.0D); + aWorld.spawnParticle("largesmoke", xPos + (new XSTR()).nextFloat(), yPos + (new XSTR()).nextFloat(), zPos + (new XSTR()).nextFloat(), 0.0D, 0.6D, 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 21e88573..05d60e72 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 @@ -194,10 +194,6 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - //TODO FIX - //if (aBaseMetaTileEntity.isClientSide() && aBaseMetaTileEntity.isActive()) { - // pollutionParticles(aBaseMetaTileEntity); - //} if (aBaseMetaTileEntity.isServerSide()) { if (mEfficiency < 0) mEfficiency = 0; if (--mUpdate == 0 || --mStartUpCheck == 0) { @@ -293,6 +289,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { } aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64)); aBaseMetaTileEntity.setActive(mMaxProgresstime > 0); + boolean active=aBaseMetaTileEntity.isActive(); + for(GT_MetaTileEntity_Hatch_Muffler aMuffler:mMufflerHatches) + aMuffler.getBaseMetaTileEntity().setActive(active && mPollution>0); } } @@ -312,16 +311,6 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { return mPollution < 10000; } - //MAKE THE POLLUTION ROLL!!! TODO Fix? - public void pollutionParticles(IGregTechTileEntity aBaseMetaTileEntity){ - //World aWorld =DimensionManager.getWorld(aBaseMetaTileEntity.getWorld().provider.dimensionId); - World aWorld=aBaseMetaTileEntity.getWorld(); - if(!aWorld.isRemote)return; - for (GT_MetaTileEntity_Hatch_Muffler tTileEntity : mMufflerHatches) { - tTileEntity.pollutionParticles(); - } - } - /** * Called every tick the Machine runs */ diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java index 796aa7f9..fe105b60 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java @@ -192,8 +192,8 @@ public class GT_MetaTileEntity_BronzeBlastFurnace aWorld.spawnParticle("largesmoke", aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), 0.0D, 0.3D, 0.0D); //Pollution particles intensify if(GT_Pollution.getPollutionAtCoords(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getZCoord())>GT_Mod.gregtechproxy.mPollutionSmogLimit){ - aWorld.spawnParticle("largesmoke", aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), 0.0D, 0.3D+(new XSTR()).nextFloat(), 0.0D); - aWorld.spawnParticle("largesmoke", aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), 0.0D, 0.3D+(new XSTR()).nextFloat(), 0.0D); + aWorld.spawnParticle("largesmoke", aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), 0.0D, 0.45D, 0.0D); + aWorld.spawnParticle("largesmoke", aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), 0.0D, 0.6D, 0.0D); } } if (aBaseMetaTileEntity.isServerSide()) {