using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; namespace MinecraftClient.Mapping { /// /// Represent a column of chunks of terrain in a Minecraft world /// public class ChunkColumn { public int ColumnSize; public bool FullyLoaded = false; /// /// Blocks contained into the chunk /// private readonly Chunk?[] chunks; /// /// Create a new ChunkColumn /// public ChunkColumn(int size = 16) { ColumnSize = size; chunks = new Chunk?[size]; } /// /// Get or set the specified chunk column /// /// ChunkColumn X /// ChunkColumn Y /// chunk at the given location public Chunk? this[int chunkY] { get { return chunks[chunkY]; } set { chunks[chunkY] = value; } } /// /// Get chunk at the specified location /// /// Location, a modulo will be applied /// The chunk, or null if not loaded public Chunk? GetChunk(Location location) { try { return this[location.ChunkY]; } catch (IndexOutOfRangeException) { return null; } } } }