Exemple #1
0
        public override void AddMaps(Dictionary <long, Map> maps)
        {
            var batch = new WriteBatch();

            foreach (var map in maps)
            {
                NbtCompound mapfile = new NbtCompound("map")
                {
                    new NbtLong("mapId", map.Key),
                    new NbtLong("parentMapId", -1),
                    new NbtList("decorations", NbtTagType.Compound),
                    new NbtByte("fullyExplored", 1),
                    new NbtByte("scale", 4),
                    new NbtByte("dimension", 0),
                    new NbtShort("height", Map.MAP_HEIGHT),
                    new NbtShort("width", Map.MAP_WIDTH),
                    new NbtByte("unlimitedTracking", 0),
                    new NbtInt("xCenter", Int32.MaxValue),
                    new NbtInt("zCenter", Int32.MaxValue),
                    new NbtByte("mapLocked", 1),
                    new NbtByteArray("colors", map.Value.Colors)
                };
                NbtFile file = new NbtFile(mapfile);
                file.BigEndian = false;
                byte[] bytes = file.SaveToBuffer(NbtCompression.None);
                batch.Put($"map_{map.Key}", bytes);
            }
            OpenDB();
            BedrockDB.Write(batch);
            CloseDB();
        }
Exemple #2
0
        public override void AddMaps(IReadOnlyDictionary <long, Map> maps)
        {
            var batch = new WriteBatch();

            foreach (var map in maps)
            {
                var mapfile = Version.CreateMapCompound(map.Key, map.Value.Colors);
                mapfile.Name = "image map";
                var bytes = WriteNbtToBytes(mapfile);
                batch.Put(Util.MapName(map.Key), bytes);
                Maps[map.Key] = map.Value;
            }
            OpenDB();
            BedrockDB.Write(batch);
            CloseDB();
            SignalMapsChanged();
        }