Esempio n. 1
0
 public static void Init()
 {
     if (File.Exists(".luf"))
     {
         foreach (string f in File.ReadAllLines(".luf"))
         {
             if (File.Exists(f))
             {
                 LastUsedFiles.Push(f);
             }
         }
     }
     if (File.Exists(".settings"))
     {
         try
         {
             NbtFile f = new NbtFile(".settings");
             f.LoadFile();
             ShowGridLines  = f.RootTag.Get <NbtByte>("GridLines").Value == 0x01 ? true : false;
             ShowChunks     = f.RootTag.Get <NbtByte>("ShowChunks").Value == 0x01 ? true : false;
             ShowMapIcons   = f.RootTag.Get <NbtByte>("ShowMapIcons").Value == 0x01 ? true : false;
             ShowWaterDepth = f.RootTag.Get <NbtByte>("ShowWaterDepth").Value == 0x01 ? true : false;
             f.Dispose();
         }
         catch (Exception)
         { Save(); }
     }
 }
Esempio n. 2
0
        private void UpdatePosition()
        {
            NbtFile PlayerDat = new NbtFile(this.Server.ServerDirectory + "\\world\\players\\" + this.Username + ".dat");

            PlayerDat.LoadFile();
            this._position.x = PlayerDat.Query <LibNbt.Tags.NbtDouble>("//Pos/0").Value;
            this._position.y = PlayerDat.Query <LibNbt.Tags.NbtDouble>("//Pos/1").Value;
            this._position.z = PlayerDat.Query <LibNbt.Tags.NbtDouble>("//Pos/2").Value;
            PlayerDat.Dispose();
        }
Esempio n. 3
0
        private void button8_Click_1(object sender, EventArgs e)
        {
            NbtFile PlayerDat = new NbtFile(YAMS.Core.RootFolder + "\\servers\\1\\world\\players\\bigolslabomeat.dat");

            PlayerDat.LoadFile();
            Vector _position;

            _position.x = PlayerDat.Query <LibNbt.Tags.NbtDouble>("//Pos/0").Value;
            _position.y = PlayerDat.Query <LibNbt.Tags.NbtDouble>("//Pos/1").Value;
            _position.z = PlayerDat.Query <LibNbt.Tags.NbtDouble>("//Pos/2").Value;
            PlayerDat.Dispose();

            MessageBox.Show("x:" + _position.x.ToString() + " y:" + _position.y.ToString() + " z:" + _position.z.ToString());
        }
Esempio n. 4
0
        public static void Save()
        {
            File.WriteAllLines(".luf", LastUsedFiles.ToArray());


            NbtFile f = new NbtFile();

            f.RootTag.Add("GridLines", new NbtByte("GridLines", (byte)(ShowGridLines ? 0x01 : 0x00)));
            f.RootTag.Add("ShowChunks", new NbtByte("ShowChunks", (byte)(ShowChunks ? 0x01 : 0x00)));
            f.RootTag.Add("ShowMapIcons", new NbtByte("ShowMapIcons", (byte)(ShowMapIcons ? 0x01 : 0x00)));
            f.RootTag.Add("ShowWaterDepth", new NbtByte("ShowWaterDepth", (byte)(ShowWaterDepth ? 0x01 : 0x00)));
            f.SaveFile(".settings");
            f.Dispose();
        }
Esempio n. 5
0
        public static void test(Player player, Command cmd)
        {
            if (!File.Exists("C:/users/jb509/desktop/1.schematic"))
            {
                player.Message("Nop"); return;
            }
            NbtFile file = new NbtFile("C:/users/jb509/desktop/1.schematic");

            file.RootTag = new NbtCompound("Schematic");
            file.LoadFile();
            bool  notClassic = false;
            short width      = file.RootTag.Query <NbtShort>("/Schematic/Width").Value;
            short height     = file.RootTag.Query <NbtShort>("/Schematic/Height").Value;
            short length     = file.RootTag.Query <NbtShort>("/Schematic/Length").Value;

            Byte[] blocks = file.RootTag.Query <NbtByteArray>("/Schematic/Blocks").Value;

            Vector3I pos = player.Position.ToBlockCoords();
            int      i   = 0;

            player.Message("&SDrawing Schematic ({0}x{1}x{2})", length, width, height);
            for (int x = pos.X; x < width + pos.X; x++)
            {
                for (int y = pos.Y; y < length + pos.Y; y++)
                {
                    for (int z = pos.Z; z < height + pos.Z; z++)
                    {
                        if (Enum.Parse(typeof(Block), ((Block)blocks[i]).ToString(), true) != null)
                        {
                            if (!notClassic && blocks[i] > 49)
                            {
                                notClassic = true;
                                player.Message("&WSchematic used is not designed for Minecraft Classic;" +
                                               " Converting all unsupported blocks with air");
                            }
                            if (blocks[i] < 50)
                            {
                                player.WorldMap.QueueUpdate(new BlockUpdate(null, (short)x, (short)y, (short)z, (Block)blocks[i]));
                            }
                        }
                        i++;
                    }
                }
            }
            file.Dispose();
        }