public bool TryChunk(Vector3i cworldPos, int posMult, Chunk chi = null) // TODO: Efficiency? { if (pkick) { return(false); } if (!ChunksAwareOf.ContainsKey(cworldPos) || ChunksAwareOf[cworldPos].LOD > posMult) // TODO: Efficiency - TryGetValue? { double dist = (cworldPos.ToLocation() * Chunk.CHUNK_SIZE - LoadRelPos).LengthSquared(); bool async = chi == null && dist > (Chunk.CHUNK_SIZE * Chunk.CHUNK_SIZE * 2 * 2); if (async) { TheRegion.LoadChunk_Background(cworldPos, (chn) => { if (!pkick && chn != null) { ChunkNetwork.SendPacket(new ChunkInfoPacketOut(chn, posMult)); } }); } else { Chunk chk = chi != null ? chi : TheRegion.LoadChunk(cworldPos); ChunkNetwork.SendPacket(new ChunkInfoPacketOut(chk, posMult)); } ChunksAwareOf.Remove(cworldPos); ChunksAwareOf.Add(cworldPos, new ChunkAwarenessInfo() { ChunkPos = cworldPos, LOD = posMult }); return(true); } return(false); }