Minecraft-Console-Client/MinecraftClient/Mapping/ChunkColumn.cs
ORelio cb00c28b6e Add world handling (and fall to ground)
- World is now properly parsed and stored from chunk data
- Block changes are also handled and world updated accordingly
- Added ground checking, the player will move down to reach the ground
- Performance tweaking in Protocol18, using lists instead of arrays
- Fix player look not properly skipped causing invalid location after
teleport
2015-11-30 15:30:49 +01:00

48 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MinecraftClient.Mapping
{
/// <summary>
/// Represent a column of chunks of terrain in a Minecraft world
/// </summary>
public class ChunkColumn
{
public const int ColumnSize = 16;
/// <summary>
/// Blocks contained into the chunk
/// </summary>
private readonly Chunk[] chunks = new Chunk[ColumnSize];
/// <summary>
/// Get or set the specified chunk column
/// </summary>
/// <param name="chunkX">ChunkColumn X</param>
/// <param name="chunkY">ChunkColumn Y</param>
/// <returns>chunk at the given location</returns>
public Chunk this[int chunkY]
{
get
{
return chunks[chunkY];
}
set
{
chunks[chunkY] = value;
}
}
/// <summary>
/// Get chunk at the specified location
/// </summary>
/// <param name="location">Location, a modulo will be applied</param>
/// <returns>The chunk, or null if not loaded</returns>
public Chunk GetChunk(Location location)
{
return this[location.ChunkY];
}
}
}