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