public static void DreamDashEnd()
        {
            Player           player = FrostModule.StateGetPlayer();
            DynData <Player> data   = new DynData <Player>(player);

            player.Depth = 0;
            if (!data.Get <bool>("dreamJump"))
            {
                player.AutoJump      = true;
                player.AutoJumpTimer = 0f;
            }
            bool flag2 = !player.Inventory.NoRefills;

            if (flag2)
            {
                player.RefillDash();
            }
            player.RefillStamina();
            player.TreatNaive = false;
            CustomDreamBlock dreamBlock = data.Get <CustomDreamBlock>("customDreamBlock");

            if (dreamBlock != null)
            {
                bool flag4 = player.DashDir.X != 0f;
                if (flag4)
                {
                    data.Set("jumpGraceTimer", 0.1f);
                    data.Set("dreamJump", true);
                }
                else
                {
                    data.Set("jumpGraceTimer", 0f);
                }
                dreamBlock.OnPlayerExit(player);
                data.Set <CustomDreamBlock>("customDreamBlock", null);
            }
            player.Stop(data.Get <SoundSource>("dreamSfxLoop"));
            player.Play("event:/char/madeline/dreamblock_exit", null, 0f);
            Input.Rumble(RumbleStrength.Medium, RumbleLength.Short);
        }
        public static bool DreamDashCheck(Player player, Vector2 dir)
        {
            DynData <Player> data = new DynData <Player>(player);
            bool             flag = player.Inventory.DreamDash && player.DashAttacking && (dir.X == Math.Sign(player.DashDir.X) || dir.Y == Math.Sign(player.DashDir.Y));

            if (flag)
            {
                CustomDreamBlock dreamBlock = player.CollideFirst <CustomDreamBlock>(player.Position + dir);
                bool             flag2      = dreamBlock != null;
                if (flag2)
                {
                    bool flag3 = player.CollideCheck <Solid, CustomDreamBlock>(player.Position + dir);
                    if (flag3)
                    {
                        Vector2 value = new Vector2(Math.Abs(dir.Y), Math.Abs(dir.X));
                        bool    flag4 = dir.X != 0f;
                        bool    flag5;
                        bool    flag6;
                        if (flag4)
                        {
                            flag5 = player.Speed.Y <= 0f;
                            flag6 = player.Speed.Y >= 0f;
                        }
                        else
                        {
                            flag5 = player.Speed.X <= 0f;
                            flag6 = player.Speed.X >= 0f;
                        }
                        if (flag5)
                        {
                            for (int i = -1; i >= -4; i--)
                            {
                                Vector2 at    = player.Position + dir + value * i;
                                bool    flag8 = !player.CollideCheck <Solid, CustomDreamBlock>(at);
                                if (flag8)
                                {
                                    player.Position += value * i;
                                    data.Set <CustomDreamBlock>("customDreamBlock", dreamBlock);
                                    return(true);
                                }
                            }
                        }
                        if (flag6)
                        {
                            for (int j = 1; j <= 4; j++)
                            {
                                Vector2 at2    = player.Position + dir + value * j;
                                bool    flag10 = !player.CollideCheck <Solid, CustomDreamBlock>(at2);
                                if (flag10)
                                {
                                    player.Position += value * j;
                                    data.Set <CustomDreamBlock>("customDreamBlock", dreamBlock);
                                    return(true);
                                }
                            }
                        }
                        return(false);
                    }
                    data.Set <CustomDreamBlock>("customDreamBlock", dreamBlock);
                    return(true);
                }
            }
            return(false);
        }
        // CUSTOM DREAM DASH STATE
        public static int DreamDashUpdate()
        {
            Player           player = FrostModule.StateGetPlayer();
            DynData <Player> data   = new DynData <Player>(player);

            Input.Rumble(RumbleStrength.Light, RumbleLength.Medium);
            Vector2 position = player.Position;

            player.Speed = player.DashDir * data.Get <CustomDreamBlock>("customDreamBlock").DashSpeed;
            player.NaiveMove(player.Speed * Engine.DeltaTime);
            float dreamDashCanEndTimer = data.Get <float>("dreamDashCanEndTimer");
            bool  flag = dreamDashCanEndTimer > 0f;

            if (flag)
            {
                data.Set <float>("dreamDashCanEndTimer", dreamDashCanEndTimer -= Engine.DeltaTime);
            }
            CustomDreamBlock dreamBlock = player.CollideFirst <CustomDreamBlock>();

            if (dreamBlock == null)
            {
                if (DreamDashedIntoSolid(player))
                {
                    bool invincible = SaveData.Instance.Assists.Invincible;
                    if (invincible)
                    {
                        player.Position = position;
                        player.Speed   *= -1f;
                        player.Play("event:/game/general/assist_dreamblockbounce", null, 0f);
                    }
                    else
                    {
                        player.Die(Vector2.Zero, false, true);
                    }
                }
                else
                {
                    if (dreamDashCanEndTimer <= 0f)
                    {
                        Celeste.Celeste.Freeze(0.05f);
                        bool flag5 = Input.Jump.Pressed && player.DashDir.X != 0f;
                        if (flag5)
                        {
                            data.Set("dreamJump", true);
                            player.Jump(true, true);
                        }
                        else
                        {
                            if (player.DashDir.Y >= 0f || player.DashDir.X != 0f)
                            {
                                bool flag7 = player.DashDir.X > 0f && player.CollideCheck <Solid>(player.Position - Vector2.UnitX * 5f);
                                if (flag7)
                                {
                                    player.MoveHExact(-5, null, null);
                                }
                                else
                                {
                                    bool flag8 = player.DashDir.X < 0f && player.CollideCheck <Solid>(player.Position + Vector2.UnitX * 5f);
                                    if (flag8)
                                    {
                                        player.MoveHExact(5, null, null);
                                    }
                                }
                                bool flag9  = player.ClimbCheck(-1, 0);
                                bool flag10 = player.ClimbCheck(1, 0);
                                int  moveX  = data.Get <int>("moveX");
                                bool flag11 = Input.Grab.Check && ((moveX == 1 && flag10) || (moveX == -1 && flag9));
                                if (flag11)
                                {
                                    player.Facing = (Facings)moveX;
                                    bool noGrabbing = SaveData.Instance.Assists.NoGrabbing;
                                    if (!noGrabbing)
                                    {
                                        return(1);
                                    }
                                    player.ClimbTrigger(moveX);
                                    player.Speed.X = 0f;
                                }
                            }
                        }
                        return(0);
                    }
                }
            }
            else
            {
                // new property
                data.Set("customDreamBlock", dreamBlock);
                if (player.Scene.OnInterval(0.1f))
                {
                    CreateTrail(player);
                }
                if (player.SceneAs <Level>().OnInterval(0.04f))
                {
                    DisplacementRenderer.Burst burst = player.SceneAs <Level>().Displacement.AddBurst(player.Center, 0.3f, 0f, 40f, 1f, null, null);
                    burst.WorldClipCollider = dreamBlock.Collider;
                    burst.WorldClipPadding  = 2;
                }
                if (dreamBlock.AllowRedirects && player.CanDash)
                {
                    bool sameDir = Input.GetAimVector(Facings.Right) == player.DashDir;
                    bool flag4   = !sameDir || dreamBlock.AllowRedirectsInSameDir;
                    if (flag4)
                    {
                        player.DashDir = Input.GetAimVector(Facings.Right);
                        player.Speed   = player.DashDir * player.Speed.Length();
                        player.Dashes  = Math.Max(0, player.Dashes - 1);
                        Audio.Play("event:/char/madeline/dreamblock_enter");
                        if (sameDir)
                        {
                            player.Speed   *= dreamBlock.SameDirectionSpeedMultiplier;
                            player.DashDir *= Math.Sign(dreamBlock.SameDirectionSpeedMultiplier);
                        }
                        Input.Dash.ConsumeBuffer();
                    }
                }
            }
            return(FrostModule.CustomDreamDashState);
        }