public void ProcessReplicationCreate(MyPacket packet)
        {
            m_receiveStream.ResetRead(packet);

            TypeId typeId = m_receiveStream.ReadTypeId();
            NetworkId networkID = m_receiveStream.ReadNetworkId();
            byte groupCount = m_receiveStream.ReadByte();

            var pendingReplicable = new MyPendingReplicable();
            for (int i = 0; i < groupCount; i++)
            {
                var id = m_receiveStream.ReadNetworkId();
                pendingReplicable.StateGroupIds.Add(id);
            }

            Type type = GetTypeByTypeId(typeId);
            IMyReplicable replicable = (IMyReplicable)Activator.CreateInstance(type);
            pendingReplicable.DebugObject = replicable;
            m_pendingReplicables.Add(networkID, pendingReplicable);

            replicable.OnLoad(m_receiveStream, () => SetReplicableReady(networkID, replicable));
        }
        public void ProcessReplicationCreateBegin(MyPacket packet)
        {
            m_receiveStream.ResetRead(packet);

            TypeId typeId = m_receiveStream.ReadTypeId();
            NetworkId networkID = m_receiveStream.ReadNetworkId();
            byte groupCount = m_receiveStream.ReadByte();

            var pendingReplicable = new MyPendingReplicable();
            for (int i = 0; i < groupCount; i++)
            {
                var id = m_receiveStream.ReadNetworkId();
                pendingReplicable.StateGroupIds.Add(id);
            }

            Type type = GetTypeByTypeId(typeId);
            IMyReplicable replicable = (IMyReplicable)Activator.CreateInstance(type);
            pendingReplicable.DebugObject = replicable;

            m_pendingReplicables.Add(networkID, pendingReplicable);

            var ids = pendingReplicable.StateGroupIds;

            using (m_tmpGroups)
            {
                IMyStreamableReplicable streamable = replicable as IMyStreamableReplicable;
                if (streamable != null)
                {
                    pendingReplicable.IsStreaming = true;
                    var group = streamable.GetStreamingStateGroup();
                    m_tmpGroups.Add(group);
                }

                for (int i = 0; i < m_tmpGroups.Count; i++)
                {
                    if (m_tmpGroups[i] != replicable)
                    {
                        AddNetworkObjectClient(ids[i], m_tmpGroups[i]);
                        pendingReplicable.StreamingGroupId = ids[i];
                    }
                }
            }

            replicable.OnLoadBegin(m_receiveStream, (loaded) => SetReplicableReady(networkID, replicable, loaded));
        }