public ChunkColumn(ChunkSection[] sections, Vector3 ChunkPos) { if (sections == null) { sections = new ChunkSection[0]; } if (sections.Length > Constants.SECTION_PER_COLUMN) { throw new Exception("Too many sections"); } else if (sections.Length < Constants.SECTION_PER_COLUMN) { var v = sections.ToList(); while (v.Count != Constants.SECTION_PER_COLUMN) { var newSec = ChunkSection.Empty; newSec.ChunkX = ChunkPos.X; newSec.ChunkY = v.Count; newSec.ChunkZ = ChunkPos.Z; v.Add(newSec); } sections = v.ToArray(); } for (int z = 0; z < Constants.SECTION_DEPTH; z++) { for (int x = 0; x < Constants.SECTION_WIDTH; x++) { Biomes[x, z] = Biome.Void; } } this.chunkSections = sections; }
public static Vector3 ChunkToWorldPosition(Vector3 ChunkSpace, ChunkSection chunk) { return(new Vector3(ChunkSpace.X + (long)Math.Floor((double)(chunk.ChunkX * Constants.CHUNK_NUM)), ChunkSpace.Y + (long)Math.Floor((double)(chunk.ChunkY * Constants.CHUNK_NUM)), ChunkSpace.Z + (long)Math.Floor((double)(chunk.ChunkZ * Constants.CHUNK_NUM)))); }