public Chunk(World world, ChunkPosition position, IEnvironmentGenerator environmentGenerator, IChunkRenderer renderer, BlockPrototypeMap prototypeMap) { Position = position; this.world = world; this.environmentGenerator = environmentGenerator; this.renderer = renderer; blockArray = new BlockArray(prototypeMap, XDimension, YDimension, ZDimension); lightArray = new Array3<byte>(XDimension, YDimension, ZDimension); OriginInWorld = new BlockPosition(Position, new RelativeBlockPosition(0, 0, 0)); neighborhoodPositions = new[] { Position, Position.Left, Position.Right, Position.Front, Position.Back }; }
public bool Between(ChunkPosition minimum, ChunkPosition maximum) { return X >= minimum.X && X <= maximum.X && Z >= minimum.Z && Z <= maximum.Z; }
public Chunk Create(World world, ChunkPosition chunkPosition) { return new Chunk(world, chunkPosition, environmentGenerator, chunkRendererFactory(), prototypeMap); }
public BlockPosition(ChunkPosition chunkPosition, RelativeBlockPosition relativeBlockPosition) { X = chunkPosition.X * Chunk.XDimension + relativeBlockPosition.X; Y = relativeBlockPosition.Y; Z = chunkPosition.Z * Chunk.XDimension + relativeBlockPosition.Z; }