private static void DrawCompleteLayer(Player player, PlayerHeadLayer draw_layer, ref Vector2 position, ref Rectangle body_frame, ref Vector2 draw_origin, ref PlayerHeadDrawInfo draw_info, ref Color color, ref Color color2, ref Color color3, ref Color color4, ref Color color5, bool draw_hair, bool draw_alt_hair, int shader_id, int skin_variant, short hair_dye, float scale, SpriteEffects sprite_effects)
 {
     if (draw_layer == PlayerHeadLayer.Head)
     {
         PlayerHeadDisplayHelpers.DrawHeadLayer(player, skin_variant, ref draw_origin, ref color4, ref color, ref color2, scale, sprite_effects);
     }
     else if (draw_layer == PlayerHeadLayer.Hair)
     {
         if (draw_hair)
         {
             PlayerHeadDisplayHelpers.DrawHairLayer(player, shader_id, hair_dye, ref color5, ref color3, ref draw_origin, scale, sprite_effects);
         }
     }
     else if (draw_layer == PlayerHeadLayer.AltHair)
     {
         if (draw_alt_hair)
         {
             PlayerHeadDisplayHelpers.DrawAltHairLayer(player, hair_dye, ref color3, ref draw_origin, scale, sprite_effects);
         }
     }
     else if (draw_layer == PlayerHeadLayer.Armor)
     {
         PlayerHeadDisplayHelpers.DrawArmorLayer(player, shader_id, hair_dye, ref color3, ref color5, ref draw_origin, scale, sprite_effects);
     }
     else if (draw_layer == PlayerHeadLayer.FaceAcc)
     {
         if (player.face > 0)
         {
             PlayerHeadDisplayHelpers.DrawFaceLayer(player, shader_id, ref color5, ref draw_origin, scale, sprite_effects);
         }
     }
     else
     {
         draw_layer.Draw(ref draw_info);
     }
 }
 public static void DrawPlayerHead(SpriteBatch sb, Player player, float x, float y, float alpha = 1f, float scale = 1f)
 {
     PlayerHeadDisplayHelpers.DrawPlayerHead(sb, player, x, y, alpha, scale);
 }
 public static Color quickAlpha(Color old_color, float alpha)
 {
     return(PlayerHeadDisplayHelpers.QuickAlpha(old_color, alpha));
 }
        public static void DrawPlayerHead(SpriteBatch sb, Player player, float x, float y, float alpha = 1f, float scale = 1f)
        {
            PlayerHeadDrawInfo draw_info = new PlayerHeadDrawInfo {
                spriteBatch = sb,
                drawPlayer  = player,
                alpha       = alpha,
                scale       = scale
            };

            int   shader_id    = 0;
            int   skin_variant = player.skinVariant;
            short hair_dye     = player.hairDye;

            if (player.head == 0 && hair_dye == 0)
            {
                hair_dye = 1;
            }
            draw_info.hairShader = hair_dye;

            if (player.face > 0 && player.face < 9)
            {
                PlayerHeadDisplayHelpers.LoadAccFace((int)player.face);
            }
            if (player.dye[0] != null)
            {
                shader_id = player.dye[0].dye;
            }
            draw_info.armorShader = shader_id;

            PlayerHeadDisplayHelpers.LoadHair(player.hair);

            Color color = PlayerHeadDisplayHelpers.QuickAlpha(Color.White, alpha);

            draw_info.eyeWhiteColor = color;
            Color color2 = PlayerHeadDisplayHelpers.QuickAlpha(player.eyeColor, alpha);

            draw_info.eyeColor = color2;
            Color color3 = PlayerHeadDisplayHelpers.QuickAlpha(player.GetHairColor(false), alpha);

            draw_info.hairColor = color3;
            Color color4 = PlayerHeadDisplayHelpers.QuickAlpha(player.skinColor, alpha);

            draw_info.skinColor = color4;
            Color color5 = PlayerHeadDisplayHelpers.QuickAlpha(Color.White, alpha);

            draw_info.armorColor = color5;

            SpriteEffects sprite_effects = SpriteEffects.None;

            if (player.direction < 0)
            {
                sprite_effects = SpriteEffects.FlipHorizontally;
            }
            draw_info.spriteEffects = sprite_effects;

            Vector2 draw_origin = new Vector2(player.legFrame.Width * 0.5f, player.legFrame.Height * 0.4f);

            draw_info.drawOrigin = draw_origin;

            Vector2   position   = player.position;
            Rectangle body_frame = player.bodyFrame;

            player.bodyFrame.Y = 0;
            player.position    = Main.screenPosition;
            player.position.X  = player.position.X + x;
            player.position.Y  = player.position.Y + y;
            player.position.X  = player.position.X - 6f;
            player.position.Y  = player.position.Y - 4f;

            float head_offset = player.mount.PlayerHeadOffset;

            player.position.Y = player.position.Y - head_offset;

            if (player.head > 0 && player.head < 214)
            {
                PlayerHeadDisplayHelpers.LoadArmorHead(player.head);
            }
            if (player.face > 0 && player.face < 9)
            {
                PlayerHeadDisplayHelpers.LoadAccFace(player.face);
            }

            bool draw_hair = false;

            if (player.head == 10 || player.head == 12 || player.head == 28 || player.head == 62 || player.head == 97 || player.head == 106 || player.head == 113 || player.head == 116 || player.head == 119 || player.head == 133 || player.head == 138 || player.head == 139 || player.head == 163 || player.head == 178 || player.head == 181 || player.head == 191 || player.head == 198)
            {
                draw_hair = true;
            }
            bool draw_alt_hair = false;

            if (player.head == 161 || player.head == 14 || player.head == 15 || player.head == 16 || player.head == 18 || player.head == 21 || player.head == 24 || player.head == 25 || player.head == 26 || player.head == 40 || player.head == 44 || player.head == 51 || player.head == 56 || player.head == 59 || player.head == 60 || player.head == 67 || player.head == 68 || player.head == 69 || player.head == 114 || player.head == 121 || player.head == 126 || player.head == 130 || player.head == 136 || player.head == 140 || player.head == 145 || player.head == 158 || player.head == 159 || player.head == 184 || player.head == 190 || (double)player.head == 92.0 || player.head == 195)
            {
                draw_alt_hair = true;
            }
            ItemLoader.DrawHair(player, ref draw_hair, ref draw_alt_hair);
            draw_info.drawHair    = draw_hair;
            draw_info.drawAltHair = draw_alt_hair;
            List <PlayerHeadLayer> draw_layers = PlayerHooks.GetDrawHeadLayers(player);

            for (int i = 0; i < draw_layers.Count; i++)
            {
                if (draw_layers[i].ShouldDraw(draw_layers))
                {
                    PlayerHeadDisplayHelpers.DrawCompleteLayer(player, draw_layers[i], ref position, ref body_frame, ref draw_origin, ref draw_info,
                                                               ref color, ref color2, ref color3, ref color4, ref color5, draw_hair, draw_alt_hair,
                                                               shader_id, skin_variant, hair_dye, scale, sprite_effects);
                }
            }
            PlayerHeadDisplayHelpers.PostDrawLayer(player, ref position, ref body_frame);
        }