    001    package net.minecraft.client.renderer.texturefx;
    002
    003    import cpw.mods.fml.client.FMLTextureFX;
    004    import cpw.mods.fml.relauncher.Side;
    005    import cpw.mods.fml.relauncher.SideOnly;
    006    import net.minecraft.block.Block;
    007
    008    @SideOnly(Side.CLIENT)
    009    public class TextureWaterFlowFX extends FMLTextureFX
    010    {
    011        protected float[] field_76880_g = new float[256];
    012        protected float[] field_76883_h = new float[256];
    013        protected float[] field_76884_i = new float[256];
    014        protected float[] field_76881_j = new float[256];
    015        private int tickCounter = 0;
    016
    017        public TextureWaterFlowFX()
    018        {
    019            super(Block.waterMoving.blockIndexInTexture + 1);
    020            this.tileSize = 2;
    021            setup();
    022        }
    023
    024        @Override
    025        public void setup()
    026        {
    027            super.setup();
    028            field_76880_g = new float[tileSizeSquare];
    029            field_76883_h = new float[tileSizeSquare];
    030            field_76884_i = new float[tileSizeSquare];
    031            field_76881_j = new float[tileSizeSquare];
    032            tickCounter = 0;
    033        }
    034
    035        public void onTick()
    036        {
    037            ++this.tickCounter;
    038            int var1;
    039            int var2;
    040            float var3;
    041            int var5;
    042            int var6;
    043
    044            for (var1 = 0; var1 < tileSizeBase; ++var1)
    045            {
    046                for (var2 = 0; var2 < tileSizeBase; ++var2)
    047                {
    048                    var3 = 0.0F;
    049
    050                    for (int var4 = var2 - 2; var4 <= var2; ++var4)
    051                    {
    052                        var5 = var1 & tileSizeMask;
    053                        var6 = var4 & tileSizeMask;
    054                        var3 += this.field_76880_g[var5 + var6 * tileSizeBase];
    055                    }
    056
    057                    this.field_76883_h[var1 + var2 * tileSizeBase] = var3 / 3.2F + this.field_76884_i[var1 + var2 * tileSizeBase] * 0.8F;
    058                }
    059            }
    060
    061            for (var1 = 0; var1 < tileSizeBase; ++var1)
    062            {
    063                for (var2 = 0; var2 < tileSizeBase; ++var2)
    064                {
    065                    this.field_76884_i[var1 + var2 * tileSizeBase] += this.field_76881_j[var1 + var2 * tileSizeBase] * 0.05F;
    066
    067                    if (this.field_76884_i[var1 + var2 * tileSizeBase] < 0.0F)
    068                    {
    069                        this.field_76884_i[var1 + var2 * tileSizeBase] = 0.0F;
    070                    }
    071
    072                    this.field_76881_j[var1 + var2 * tileSizeBase] -= 0.3F;
    073
    074                    if (Math.random() < 0.2D)
    075                    {
    076                        this.field_76881_j[var1 + var2 * tileSizeBase] = 0.5F;
    077                    }
    078                }
    079            }
    080
    081            float[] var12 = this.field_76883_h;
    082            this.field_76883_h = this.field_76880_g;
    083            this.field_76880_g = var12;
    084
    085            for (var2 = 0; var2 < tileSizeSquare; ++var2)
    086            {
    087                var3 = this.field_76880_g[var2 - this.tickCounter * tileSizeBase & tileSizeSquareMask];
    088
    089                if (var3 > 1.0F)
    090                {
    091                    var3 = 1.0F;
    092                }
    093
    094                if (var3 < 0.0F)
    095                {
    096                    var3 = 0.0F;
    097                }
    098
    099                float var13 = var3 * var3;
    100                var5 = (int)(32.0F + var13 * 32.0F);
    101                var6 = (int)(50.0F + var13 * 64.0F);
    102                int var7 = 255;
    103                int var8 = (int)(146.0F + var13 * 50.0F);
    104
    105                if (this.anaglyphEnabled)
    106                {
    107                    int var9 = (var5 * 30 + var6 * 59 + var7 * 11) / 100;
    108                    int var10 = (var5 * 30 + var6 * 70) / 100;
    109                    int var11 = (var5 * 30 + var7 * 70) / 100;
    110                    var5 = var9;
    111                    var6 = var10;
    112                    var7 = var11;
    113                }
    114
    115                this.imageData[var2 * 4 + 0] = (byte)var5;
    116                this.imageData[var2 * 4 + 1] = (byte)var6;
    117                this.imageData[var2 * 4 + 2] = (byte)var7;
    118                this.imageData[var2 * 4 + 3] = (byte)var8;
    119            }
    120        }
    121    }