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