public Block GetBlock(Pos.BlockPos pos) //retrieves a block from anywhere in the world { Pos.ChunkPos p = pos.ToChunk(); Pos.ChunkPos regionPos = new Pos.BlockPos(p.X, p.Y, p.Z).ToChunk(); string region = regionPos.X.ToString() + "." + regionPos.Y.ToString() + "." + regionPos.Z.ToString(); if (Regions.ContainsKey(region)) { Chunk c = Regions[region].GetChunk(p.Normalize()); if (c != null) { return(c.GetBlock(pos.Normalize())); } } return(null); }
public void SetChunk(Pos.ChunkPos pos, Chunk c) { pos = pos.Normalize(); Chunks[pos.X, pos.Y, pos.Z] = c; }
public Chunk GetChunk(Pos.ChunkPos pos) { pos = pos.Normalize(); return(Chunks[pos.X, pos.Y, pos.Z]); }