Terraria.Player.StickyMovement C# (CSharp) Method

StickyMovement() public method

public StickyMovement ( ) : void
return void
        public void StickyMovement()
        {
            bool flag = false;
            if (this.mount.Type == 6 && (double)Math.Abs(this.velocity.X) > 5.0)
                flag = true;
            if (this.mount.Type == 13 && (double)Math.Abs(this.velocity.X) > 5.0)
                flag = true;
            if (this.mount.Type == 11 && (double)Math.Abs(this.velocity.X) > 5.0)
                flag = true;
            Vector2 vector2_1 = new Vector2(this.position.X + (float)(this.width / 2) - (float)(this.width / 2 / 2), this.position.Y + (float)(this.height / 2) - (float)(this.height / 2 / 2));
            Vector2 vector2_2 = Collision.StickyTiles(this.position, this.velocity, this.width, this.height);
            if ((double)vector2_2.Y != -1.0 && (double)vector2_2.X != -1.0)
            {
                int i = (int)vector2_2.X;
                int j = (int)vector2_2.Y;
                int num = (int)Main.tile[i, j].type;
                if (this.whoAmI == Main.myPlayer && num == 51 && ((double)this.velocity.X != 0.0 || (double)this.velocity.Y != 0.0))
                {
                    ++this.stickyBreak;
                    if (this.stickyBreak > Main.rand.Next(20, 100) || flag)
                    {
                        this.stickyBreak = 0;
                        WorldGen.KillTile(i, j, false, false, false);
                        if (Main.netMode == 1 && !Main.tile[i, j].active() && Main.netMode == 1)
                            NetMessage.SendData(17, -1, -1, "", 0, (float)i, (float)j, 0.0f, 0, 0, 0);
                    }
                }
                if (flag)
                    return;
                this.fallStart = (int)((double)this.position.Y / 16.0);
                if (num != 229)
                    this.jump = 0;
                if ((double)this.velocity.X > 1.0)
                    this.velocity.X = 1f;
                if ((double)this.velocity.X < -1.0)
                    this.velocity.X = -1f;
                if ((double)this.velocity.Y > 1.0)
                    this.velocity.Y = 1f;
                if ((double)this.velocity.Y < -5.0)
                    this.velocity.Y = -5f;
                if ((double)this.velocity.X > 0.75 || (double)this.velocity.X < -0.75)
                    this.velocity.X *= 0.85f;
                else
                    this.velocity.X *= 0.6f;
                if ((double)this.velocity.Y < 0.0)
                    this.velocity.Y *= 0.96f;
                else
                    this.velocity.Y *= 0.3f;
                if (num != 229 || Main.rand.Next(5) != 0 || (double)this.velocity.Y <= 0.15 && (double)this.velocity.Y >= 0.0)
                    return;
                if ((double)(i * 16) < (double)this.position.X + (double)(this.width / 2))
                {
                    int index = Dust.NewDust(new Vector2(this.position.X - 4f, (float)(j * 16)), 4, 16, 153, 0.0f, 0.0f, 50, new Color(), 1f);
                    Main.dust[index].scale += (float)Main.rand.Next(0, 6) * 0.1f;
                    Main.dust[index].velocity *= 0.1f;
                    Main.dust[index].noGravity = true;
                }
                else
                {
                    int index = Dust.NewDust(new Vector2((float)((double)this.position.X + (double)this.width - 2.0), (float)(j * 16)), 4, 16, 153, 0.0f, 0.0f, 50, new Color(), 1f);
                    Main.dust[index].scale += (float)Main.rand.Next(0, 6) * 0.1f;
                    Main.dust[index].velocity *= 0.1f;
                    Main.dust[index].noGravity = true;
                }
                if (Main.tile[i, j + 1] != null && (int)Main.tile[i, j + 1].type == 229 && (double)this.position.Y + (double)this.height > (double)((j + 1) * 16))
                {
                    if ((double)(i * 16) < (double)this.position.X + (double)(this.width / 2))
                    {
                        int index = Dust.NewDust(new Vector2(this.position.X - 4f, (float)(j * 16 + 16)), 4, 16, 153, 0.0f, 0.0f, 50, new Color(), 1f);
                        Main.dust[index].scale += (float)Main.rand.Next(0, 6) * 0.1f;
                        Main.dust[index].velocity *= 0.1f;
                        Main.dust[index].noGravity = true;
                    }
                    else
                    {
                        int index = Dust.NewDust(new Vector2((float)((double)this.position.X + (double)this.width - 2.0), (float)(j * 16 + 16)), 4, 16, 153, 0.0f, 0.0f, 50, new Color(), 1f);
                        Main.dust[index].scale += (float)Main.rand.Next(0, 6) * 0.1f;
                        Main.dust[index].velocity *= 0.1f;
                        Main.dust[index].noGravity = true;
                    }
                }
                if (Main.tile[i, j + 2] == null || (int)Main.tile[i, j + 2].type != 229 || (double)this.position.Y + (double)this.height <= (double)((j + 2) * 16))
                    return;
                if ((double)(i * 16) < (double)this.position.X + (double)(this.width / 2))
                {
                    int index = Dust.NewDust(new Vector2(this.position.X - 4f, (float)(j * 16 + 32)), 4, 16, 153, 0.0f, 0.0f, 50, new Color(), 1f);
                    Main.dust[index].scale += (float)Main.rand.Next(0, 6) * 0.1f;
                    Main.dust[index].velocity *= 0.1f;
                    Main.dust[index].noGravity = true;
                }
                else
                {
                    int index = Dust.NewDust(new Vector2((float)((double)this.position.X + (double)this.width - 2.0), (float)(j * 16 + 32)), 4, 16, 153, 0.0f, 0.0f, 50, new Color(), 1f);
                    Main.dust[index].scale += (float)Main.rand.Next(0, 6) * 0.1f;
                    Main.dust[index].velocity *= 0.1f;
                    Main.dust[index].noGravity = true;
                }
            }
            else
                this.stickyBreak = 0;
        }
Player