Exemplo n.º 1
0
        /// <inherits />
        public Stream GetChunkOutStream(int lcx, int lcz)
        {
            if (!LocalBoundsCheck(lcx, lcz))
            {
                IRegion alt = GetForeignRegion(lcx, lcz);
                return((alt == null) ? null : alt.GetChunkOutStream(ForeignX(lcx), ForeignZ(lcz)));
            }

            RegionFile rf = GetRegionFile();

            return(rf.GetChunkDataOutputStream(lcx, lcz));
        }
Exemplo n.º 2
0
        private bool SaveChunkTree(int lcx, int lcz, NbtTree tree, int?timestamp)
        {
            if (!LocalBoundsCheck(lcx, lcz))
            {
                IRegion alt = GetForeignRegion(lcx, lcz);
                return((alt == null) ? false : alt.SaveChunkTree(ForeignX(lcx), ForeignZ(lcz), tree));
            }

            RegionFile rf     = GetRegionFile();
            Stream     zipstr = (timestamp == null)
                ? rf.GetChunkDataOutputStream(lcx, lcz)
                : rf.GetChunkDataOutputStream(lcx, lcz, (int)timestamp);

            if (zipstr == null)
            {
                return(false);
            }

            tree.WriteTo(zipstr);
            zipstr.Close();

            return(true);
        }