public static SpriteUpdateMessage.NetMessage Deserialize(this NetworkReader reader)
        {
            var message = new SpriteUpdateMessage.NetMessage();

            SpriteUpdateMessage.SpriteUpdateEntry UnprocessedData = null;
            while (true)
            {
                UnprocessedData = null;
                bool ProcessSection = true;
                uint NetID          = reader.ReadUInt32();
                if (NetID == 0)
                {
                    break;
                }

                if (NetworkIdentity.spawned.ContainsKey(NetID) == false || NetworkIdentity.spawned[NetID] == null)
                {
                    ProcessSection = false;
                }

                string Name = reader.ReadString();
                if (ProcessSection == false ||
                    NetworkIdentity.spawned.ContainsKey(NetID) == false ||
                    SpriteHandlerManager.PresentSprites.ContainsKey(NetworkIdentity.spawned[NetID]) == false ||
                    SpriteHandlerManager.PresentSprites[NetworkIdentity.spawned[NetID]].ContainsKey(Name) == false)
                {
                    ProcessSection = false;
                }

                if (ProcessSection == false)
                {
                    UnprocessedData      = new SpriteUpdateMessage.SpriteUpdateEntry();
                    UnprocessedData.name = Name;
                    UnprocessedData.id   = NetID;
                }

                SpriteHandler SP = null;
                if (ProcessSection)
                {
                    SP = SpriteHandlerManager.PresentSprites[NetworkIdentity.spawned[NetID]][Name];
                }

                while (true)
                {
                    byte Operation = reader.ReadByte();

                    if (Operation == 255)
                    {
                        if (ProcessSection == false)
                        {
                            SpriteUpdateMessage.UnprocessedData.Add(UnprocessedData);
                        }

                        break;
                    }

                    if (Operation == 1)
                    {
                        int SpriteID = reader.ReadInt32();
                        if (ProcessSection)
                        {
                            try
                            {
                                SP.SetSpriteSO(SpriteCatalogue.Instance.Catalogue[SpriteID], networked: false);
                            }
                            catch (Exception e)
                            {
                                Logger.Log("ddD");
                            }
                        }
                        else
                        {
                            UnprocessedData.call.Add(SpriteUpdateMessage.SpriteOperation.PresentSpriteSet);
                            UnprocessedData.arg.Add(SpriteID);
                        }
                    }


                    if (Operation == 2)
                    {
                        int Variant = reader.ReadInt32();
                        if (ProcessSection)
                        {
                            SP.ChangeSpriteVariant(Variant, networked: false);
                        }
                        else
                        {
                            UnprocessedData.call.Add(SpriteUpdateMessage.SpriteOperation.VariantIndex);
                            UnprocessedData.arg.Add(Variant);
                        }
                    }

                    if (Operation == 3)
                    {
                        int Sprite = reader.ReadInt32();
                        if (ProcessSection)
                        {
                            SP.ChangeSprite(Sprite, false);
                        }
                        else
                        {
                            UnprocessedData.call.Add(SpriteUpdateMessage.SpriteOperation.CataloguePage);
                            UnprocessedData.arg.Add(Sprite);
                        }
                    }

                    if (Operation == 4)
                    {
                        int SpriteAnimate = reader.ReadInt32();
                        if (ProcessSection)
                        {
                            SP.AnimateOnce(SpriteAnimate, false);
                        }
                        else
                        {
                            UnprocessedData.call.Add(SpriteUpdateMessage.SpriteOperation.AnimateOnce);
                            UnprocessedData.arg.Add(SpriteAnimate);
                        }
                    }

                    if (Operation == 5)
                    {
                        if (ProcessSection)
                        {
                            SP.PushTexture(false);
                        }
                        else
                        {
                            UnprocessedData.call.Add(SpriteUpdateMessage.SpriteOperation.PushTexture);
                        }
                    }

                    if (Operation == 6)
                    {
                        if (ProcessSection)
                        {
                            SP.Empty(false);
                        }
                        else
                        {
                            UnprocessedData.call.Add(SpriteUpdateMessage.SpriteOperation.Empty);
                        }
                    }


                    if (Operation == 7)
                    {
                        if (ProcessSection)
                        {
                            SP.PushClear(false);
                        }
                        else
                        {
                            UnprocessedData.call.Add(SpriteUpdateMessage.SpriteOperation.PushClear);
                        }
                    }

                    if (Operation == 8)
                    {
                        if (ProcessSection)
                        {
                            SP.ClearPalette(false);
                        }
                        else
                        {
                            UnprocessedData.call.Add(SpriteUpdateMessage.SpriteOperation.ClearPallet);
                        }
                    }


                    if (Operation == 9)
                    {
                        Color TheColour = reader.ReadColor();
                        if (ProcessSection)
                        {
                            if (SP)
                            {
                                //TODO: remove this check - registering arrives after the sprite update, all clients will disconnect after a runtime
                                //removing and readding a bodypart through surgery would cause it, since the network identity already exists unlike the creation of a new human
                                SP.SetColor(TheColour, false);
                            }
                        }
                        else
                        {
                            UnprocessedData.call.Add(SpriteUpdateMessage.SpriteOperation.SetColour);
                            UnprocessedData.arg.Add(Convert.ToChar(Mathf.RoundToInt(TheColour.r * 255)));
                            UnprocessedData.arg.Add(Convert.ToChar(Mathf.RoundToInt(TheColour.g * 255)));
                            UnprocessedData.arg.Add(Convert.ToChar(Mathf.RoundToInt(TheColour.b * 255)));
                            UnprocessedData.arg.Add(Convert.ToChar(Mathf.RoundToInt(TheColour.a * 255)));
                        }
                    }

                    if (Operation == 10)
                    {
                        int          paletteCount = reader.ReadByte();
                        List <Color> Colours      = new List <Color>();
                        for (int i = 0; i < paletteCount; i++)
                        {
                            Colours.Add(reader.ReadColor());
                        }

                        if (ProcessSection)
                        {
                            SP.SetPaletteOfCurrentSprite(Colours, false);
                        }
                        else
                        {
                            UnprocessedData.call.Add(SpriteUpdateMessage.SpriteOperation.Pallet);
                            UnprocessedData.arg.Add(Convert.ToChar(paletteCount));
                            foreach (var color in Colours)
                            {
                                UnprocessedData.arg.Add(Convert.ToChar(Mathf.RoundToInt(color.r * 255)));
                                UnprocessedData.arg.Add(Convert.ToChar(Mathf.RoundToInt(color.g * 255)));
                                UnprocessedData.arg.Add(Convert.ToChar(Mathf.RoundToInt(color.b * 255)));
                                UnprocessedData.arg.Add(Convert.ToChar(Mathf.RoundToInt(color.a * 255)));
                            }
                        }
                    }
                }
            }

            return(message);
        }