コード例 #1
0
ファイル: TychaiaLevel.cs プロジェクト: duaneking/Tychaia
        public int[] ProvideRegion(long x, long y, long z, long width, long height, long depth)
        {
            // FIXME: Don't rely on this.
            if (width != ChunkSize.Width || height != ChunkSize.Height || depth != ChunkSize.Depth)
            {
                return(null);
            }

            // See if terrain.oct exists.
            if (!File.Exists(Path.Combine(this.m_Path, "terrain.oct")))
            {
                return(null);
            }

            // Open the terrain octree.
            if (this.m_Terrain == null)
            {
                this.m_Terrain = new TerrainOctree(Path.Combine(this.m_Path, "terrain.oct"));
            }

            // Open NBT.
            //NbtFile file = this.m_Terrain.GetChunk(x / ChunkSize.Width, y / ChunkSize.Height, z / ChunkSize.Depth);
            //if (file == null)
            return(null);

            // Get the integer array for this chunk.
            //return file.RootTag["RawData"].IntArrayValue;
        }
コード例 #2
0
ファイル: TychaiaLevel.cs プロジェクト: duaneking/Tychaia
        public bool HasRegion(long x, long y, long z, long width, long height, long depth)
        {
            // FIXME: Don't rely on this.
            if (width != ChunkSize.Width || height != ChunkSize.Height || depth != ChunkSize.Depth)
            {
                return(false);
            }

            // See if terrain.oct exists.
            if (!File.Exists(Path.Combine(this.m_Path, "terrain.oct")))
            {
                return(false);
            }

            // Open the terrain octree.
            if (this.m_Terrain == null)
            {
                this.m_Terrain = new TerrainOctree(Path.Combine(this.m_Path, "terrain.oct"));
            }

            return(this.m_Terrain.GetChunk(x / ChunkSize.Width, y / ChunkSize.Height, z / ChunkSize.Depth) != null);
        }