static void OnMessageAfterGridCreated(ref AfterGridCreatedMsg msg, MyNetworkClient sender) { MyEntity builder; MyEntity gridEntity; MyCubeGrid grid; MyEntities.TryGetEntityById(msg.BuilderEntityId, out builder); MyEntities.TryGetEntityById(msg.GridEntityId, out gridEntity); grid = gridEntity as MyCubeGrid; Debug.Assert(grid != null, "Could not find the grid entity!"); if (grid == null) { return; } MyCubeBuilder.AfterGridBuild(builder, grid); }