public void RegisterChunk(ChunkCoords chunkCoords, PlayerConnection player)
        {
            // Ensure chunk loaded or generated
            var chunk = WorldData.WorldMap.Chunk(chunkCoords.X, chunkCoords.Z);

            if (!registrations.ContainsKey(chunkCoords))
            {
                registrations [chunkCoords] = new List <PlayerConnection> ();
            }
            registrations[chunkCoords].Add(player);
        }
        private Chunk GetOrCreate(ChunkCoords chunkCoords)
        {
            long  chunkHash = ((long)chunkCoords.X << 32) + (long)chunkCoords.Z;
            Chunk chunk     = _chunks [chunkHash];

            if (chunk == null)
            {
                chunk = new Chunk(chunkCoords);
                _chunks[chunkHash] = chunk;
            }
            return(chunk);
        }
        public void UnRegisterChunk(ChunkCoords chunkCoords, PlayerConnection player)
        {
            var reg = registrations [chunkCoords];

            if (reg != null)
            {
                reg.Remove(player);
                if (reg.Count == 0)
                {
                    registrations.Remove(chunkCoords);
                }
            }
        }
 public void ChunkEvent(ChunkCoords chunkCoords, ChunkEventTarget target, ChunkEvent chunkEvent)
 {
 }
 public Chunk GetChunk(ChunkCoords chunkCoords)
 {
     return(WorldData.WorldMap.Chunk(chunkCoords));
 }