another fail

This commit is contained in:
Technus 2016-10-13 13:13:34 +02:00
parent 07f8b0d348
commit b44172b92f
2 changed files with 25 additions and 28 deletions

View file

@ -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);
}
}
}

View file

@ -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();
}
}