Exemplo n.º 1
0
        public Item RemoveEnchantments()
        {
            CompoundTag tag = this.NamedTag;

            if (tag.Exist("ench"))
            {
                tag.Remove("ench");
            }
            return(this);
        }
Exemplo n.º 2
0
        public void Convert()
        {
            for (int i = 0; i < this.BlockEntitiesTag.Length; ++i)
            {
                CompoundTag tag = this.BlockEntitiesTag[i];
                switch (tag.GetString("id"))
                {
                case "minecraft:flower_pot":
                    tag.PutShort("item", (short)Util.GetItemIdFromString(tag.GetString("Item")).Item1);
                    tag.PutInt("mData", tag.GetInt("Data"));

                    tag.Remove("Item");
                    tag.Remove("Data");
                    break;

                case "minecraft:sign":
                    string text1 = tag.GetString("Text1").Remove(0, 9);
                    text1 = text1.Remove(text1.Length - 2, 2);
                    string text2 = tag.GetString("Text2").Remove(0, 9);
                    text2 = text2.Remove(text2.Length - 2, 2);
                    string text3 = tag.GetString("Text3").Remove(0, 9);
                    text3 = text3.Remove(text3.Length - 2, 2);
                    string text4 = tag.GetString("Text4").Remove(0, 9);
                    text4 = text4.Remove(text4.Length - 2, 2);
                    string text = $"{text1}\n{text2}\n{text3}\n{text4}";
                    tag.PutString("Text", text);
                    break;
                }
            }

            for (int i = 0; i < this.SubChunks.Length; ++i)
            {
                if (this.SubChunks[i] == null)
                {
                    continue;
                }
                this.SubChunks[i].Convert();
            }
        }
        private void ConvertChunkData(ChunkData data)
        {
            CompoundTag oldTag = data.Data.GetCompound("").GetCompound("Level");
            CompoundTag newTag = (CompoundTag)oldTag.Clone();

            ListTag sections    = oldTag.GetList("Sections");
            ListTag newSections = ConvertSections(sections);

            if (newSections != null)
            {
                newTag.Remove("Sections");
                newTag.PutList(newSections);

                List <byte> biomes = new List <byte>();
                foreach (int b in oldTag.GetIntArray("Biomes"))
                {
                    biomes.Add((byte)b);
                }
                newTag.Remove("Biomes");
                newTag.PutByteArray("Biomes", biomes.ToArray());
            }

            CheckCancel();

            if (newTag.Exist("Heightmaps"))
            {
                newTag.Remove("Heightmaps");
            }
            else
            {
                newTag.Remove("HeightMap");
            }

            int[] map = new int[256];
            for (int i = 0; i < 256; i++)
            {
                map[i] = 0xff;
            }
            newTag.PutIntArray("HeightMap", map);

            newTag.PutList(new ListTag("TileTicks", NBTTagType.COMPOUND));

            newTag.PutList(new ListTag("Entities", NBTTagType.COMPOUND));
            newTag.PutList(new ListTag("TileEntities", NBTTagType.COMPOUND));

            newTag.PutBool("TerrainPopulated", true);
            newTag.PutBool("TerrainGenerated", true);

            newTag.Remove("CarvingMasks");
            newTag.Remove("Structures");

            data.Data = new CompoundTag("").PutCompound("Level", newTag);
        }
Exemplo n.º 4
0
        public Item ClearLore()
        {
            CompoundTag tag = this.NamedTag;

            if (!tag.Exist("display"))
            {
                return(this);
            }

            CompoundTag display = tag.GetCompound("display");

            if (display.Exist("Lore"))
            {
                display.Remove("Lore");
            }
            this.NamedTag = tag;
            return(this);
        }
Exemplo n.º 5
0
        public Item ClearLore()
        {
            if (!this.HasTags)
            {
                return(this);
            }

            CompoundTag tag = this.GetNamedTag();

            if (!tag.Exist("display"))
            {
                return(this);
            }
            CompoundTag display = tag.GetCompound("display");

            if (display.Exist("Lore"))
            {
                display.Remove("Lore");
            }
            this.SetNamedTag(tag);
            return(this);
        }