    001    package net.minecraft.src;
    002
    003    import cpw.mods.fml.client.FMLTextureFX;
    004    import cpw.mods.fml.common.Side;
    005    import cpw.mods.fml.common.asm.SideOnly;
    006
    007    @SideOnly(Side.CLIENT)
    008    public class TextureLavaFX extends FMLTextureFX
    009    {
    010        protected float[] field_76876_g = new float[256];
    011        protected float[] field_76878_h = new float[256];
    012        protected float[] field_76879_i = new float[256];
    013        protected float[] field_76877_j = new float[256];
    014
    015        public TextureLavaFX()
    016        {
    017            super(Block.lavaMoving.blockIndexInTexture);
    018            setup();
    019        }
    020
    021        @Override
    022        public void setup()
    023        {
    024            super.setup();
    025            field_76876_g = new float[tileSizeSquare];
    026            field_76878_h = new float[tileSizeSquare];
    027            field_76879_i = new float[tileSizeSquare];
    028            field_76877_j = new float[tileSizeSquare];
    029        }
    030
    031        public void onTick()
    032        {
    033            int var2;
    034            float var3;
    035            int var5;
    036            int var6;
    037            int var7;
    038            int var8;
    039            int var9;
    040
    041            for (int var1 = 0; var1 < tileSizeBase; ++var1)
    042            {
    043                for (var2 = 0; var2 < tileSizeBase; ++var2)
    044                {
    045                    var3 = 0.0F;
    046                    int var4 = (int)(MathHelper.sin((float)var2 * (float)Math.PI * 2.0F / 16.0F) * 1.2F);
    047                    var5 = (int)(MathHelper.sin((float)var1 * (float)Math.PI * 2.0F / 16.0F) * 1.2F);
    048
    049                    for (var6 = var1 - 1; var6 <= var1 + 1; ++var6)
    050                    {
    051                        for (var7 = var2 - 1; var7 <= var2 + 1; ++var7)
    052                        {
    053                            var8 = var6 + var4 & tileSizeMask;
    054                            var9 = var7 + var5 & tileSizeMask;
    055                            var3 += this.field_76876_g[var8 + var9 * tileSizeBase];
    056                        }
    057                    }
    058
    059                    this.field_76878_h[var1 + var2 * tileSizeBase] = var3 / 10.0F + (this.field_76879_i[(var1 + 0 & tileSizeMask) + (var2 + 0 & tileSizeMask) * tileSizeBase] + this.field_76879_i[(var1 + 1 & tileSizeMask) + (var2 + 0 & tileSizeMask) * tileSizeBase] + this.field_76879_i[(var1 + 1 & tileSizeMask) + (var2 + 1 & tileSizeMask) * tileSizeBase] + this.field_76879_i[(var1 + 0 & tileSizeMask) + (var2 + 1 & tileSizeMask) * tileSizeBase]) / 4.0F * 0.8F;
    060                    this.field_76879_i[var1 + var2 * tileSizeBase] += this.field_76877_j[var1 + var2 * tileSizeBase] * 0.01F;
    061
    062                    if (this.field_76879_i[var1 + var2 * tileSizeBase] < 0.0F)
    063                    {
    064                        this.field_76879_i[var1 + var2 * tileSizeBase] = 0.0F;
    065                    }
    066
    067                    this.field_76877_j[var1 + var2 * tileSizeBase] -= 0.06F;
    068
    069                    if (Math.random() < 0.005D)
    070                    {
    071                        this.field_76877_j[var1 + var2 * tileSizeBase] = 1.5F;
    072                    }
    073                }
    074            }
    075
    076            float[] var11 = this.field_76878_h;
    077            this.field_76878_h = this.field_76876_g;
    078            this.field_76876_g = var11;
    079
    080            for (var2 = 0; var2 < tileSizeSquare; ++var2)
    081            {
    082                var3 = this.field_76876_g[var2] * 2.0F;
    083
    084                if (var3 > 1.0F)
    085                {
    086                    var3 = 1.0F;
    087                }
    088
    089                if (var3 < 0.0F)
    090                {
    091                    var3 = 0.0F;
    092                }
    093
    094                var5 = (int)(var3 * 100.0F + 155.0F);
    095                var6 = (int)(var3 * var3 * 255.0F);
    096                var7 = (int)(var3 * var3 * var3 * var3 * 128.0F);
    097
    098                if (this.anaglyphEnabled)
    099                {
    100                    var8 = (var5 * 30 + var6 * 59 + var7 * 11) / 100;
    101                    var9 = (var5 * 30 + var6 * 70) / 100;
    102                    int var10 = (var5 * 30 + var7 * 70) / 100;
    103                    var5 = var8;
    104                    var6 = var9;
    105                    var7 = var10;
    106                }
    107
    108                this.imageData[var2 * 4 + 0] = (byte)var5;
    109                this.imageData[var2 * 4 + 1] = (byte)var6;
    110                this.imageData[var2 * 4 + 2] = (byte)var7;
    111                this.imageData[var2 * 4 + 3] = -1;
    112            }
    113        }
    114    }