public void SendReplicationMessage(ReplicationMessage msg) { using (PooledBitStream stream = PooledBitStream.Get()) { using (PooledBitWriter writer = PooledBitWriter.Get(stream)) { writer.WriteInt32(msg.messageID); writer.WriteInt32(msg.timeCreated); writer.WriteUInt32(msg.entityId); writer.WriteInt16((byte)msg.shape); writer.WriteVector2(msg.pos); writer.WriteVector2(msg.speed); writer.WriteDouble(msg.size); CustomMessagingManager.SendNamedMessage("Replication", null, stream, "customChannel"); } } }