internal CustomEntityManager()
        {
            this.InitializeUpdate();
            this.InitializeEntityTypes();
            this.InitializeComponentTypes();
            this.InitializeDrawingLayer();

            // Reset any data from previous games
            Promises.AddPostWorldUnloadEachPromise(() => {
                lock (CustomEntityManager.MyLock) {
                    this.WorldEntitiesByIndexes.Clear();
                    this.WorldEntitiesByComponentType.Clear();
                }
            });

            // Bind 'data dump' hotkey
            DataDumper.SetDumpSource("CustomEntityList", () => {
                lock (CustomEntityManager.MyLock) {
                    return(string.Join("\n  ", this.WorldEntitiesByIndexes.OrderBy(kv => kv.Key)
                                       .SafeSelect(kv => kv.Key + ": " + kv.Value?.ToString() ?? "null")));
                }
            });

            // Refresh entity owners on player connect and sync entities to player
            if (Main.netMode == 2)
            {
                Promises.AddValidatedPromise <PlayerLogicPromiseArguments>(PlayerLogic.ServerConnectValidator, (args) => {
                    if (this.WorldEntitiesByIndexes.Count == 0)
                    {
                        return(true);
                    }

                    foreach (var ent in this.WorldEntitiesByIndexes.Values)
                    {
                        ent.RefreshOwnerWho();
                    }

                    PacketProtocolSendToClient.QuickSend <CustomEntityAllProtocol>(args.Who, -1);

                    return(true);
                });
            }
        }
 public static void QuickSend()
 {
     PacketProtocolSendToClient.QuickSend <EventsSyncProtocol>(-1, -1);
 }