/// <summary> /// Read the actual data contents of the tag, implemented in NBT extension classes /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: void load(DataInput par1DataInput) throws IOException public override void Load(BinaryReader par1DataInput) { TagMap.Clear(); NBTBase nbtbase; if ((nbtbase = NBTBase.ReadNamedTag(par1DataInput)).GetId() != 0) { TagMap[nbtbase.GetName()] = nbtbase; } }
/// <summary> /// Reads from a CompressedStream. /// </summary> public static NBTTagCompound Read(BinaryReader par0DataInput) { NBTBase nbtbase = NBTBase.ReadNamedTag(par0DataInput); if (nbtbase is NBTTagCompound) { return((NBTTagCompound)nbtbase); } else { throw new IOException("Root tag must be a named compound tag"); } }
/// <summary> /// Read the actual data contents of the tag, implemented in NBT extension classes /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: void load(DataInput par1DataInput) throws IOException public override void Load(BinaryReader par1DataInput) { TagType = par1DataInput.ReadByte(); int i = par1DataInput.ReadInt32(); TagList = new List <NBTBase>(); for (int j = 0; j < i; j++) { NBTBase nbtbase = NBTBase.NewTag(TagType, null); nbtbase.Load(par1DataInput); TagList.Add(nbtbase); } }
/// <summary> /// Writes the specified tag to the given DataOutput, writing the type byte, the UTF string key and then calling the /// tag to write its data. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void writeNamedTag(NBTBase par0NBTBase, DataOutput par1DataOutput) throws IOException public static void WriteNamedTag(NBTBase par0NBTBase, BinaryWriter par1DataOutput) { par1DataOutput.Write(par0NBTBase.GetId()); if (par0NBTBase.GetId() == 0) { return; } else { par1DataOutput.Write(par0NBTBase.GetName()); par0NBTBase.Write(par1DataOutput); return; } }
/// <summary> /// Creates a clone of the tag. /// </summary> public override NBTBase Copy() { NBTTagList nbttaglist = new NBTTagList(GetName()); nbttaglist.TagType = TagType; NBTBase nbtbase1; for (IEnumerator <NBTBase> iterator = TagList.GetEnumerator(); iterator.MoveNext(); nbttaglist.TagList.Add(nbtbase1)) { NBTBase nbtbase = iterator.Current; nbtbase1 = nbtbase.Copy(); } return(nbttaglist); }
/// <summary> /// Reads and returns a tag from the given DataInput, or the End tag if no tag could be read. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static NBTBase readNamedTag(DataInput par0DataInput) throws IOException public static NBTBase ReadNamedTag(BinaryReader par0DataInput) { byte byte0 = par0DataInput.ReadByte(); if (byte0 == 0) { return(new NBTTagEnd()); } else { string s = par0DataInput.ReadString(); NBTBase nbtbase = NewTag(byte0, s); nbtbase.Load(par0DataInput); return(nbtbase); } }
/// <summary> /// Loads the idCounts Map from the 'idcounts' file. /// </summary> private void LoadIdCounts() { try { IdCounts.Clear(); if (SaveHandler == null) { return; } string file = SaveHandler.GetMapFileFromName("idcounts"); if (file != null && File.Exists(file)) { BinaryReader datainputstream = new BinaryReader(new FileStream(file, FileMode.Open)); NBTTagCompound nbttagcompound = CompressedStreamTools.Read(datainputstream); datainputstream.Close(); IEnumerator <NBTBase> iterator = nbttagcompound.GetTags().GetEnumerator(); do { if (!iterator.MoveNext()) { break; } NBTBase nbtbase = iterator.Current; if (nbtbase is NBTTagShort) { NBTTagShort nbttagshort = (NBTTagShort)nbtbase; string s = nbttagshort.GetName(); short word0 = nbttagshort.Data; IdCounts[s] = word0; } }while (true); } } catch (Exception exception) { Utilities.LogException(exception); } }
public virtual bool Equals(object par1Obj) { if (par1Obj == null || !(par1Obj is NBTBase)) { return(false); } NBTBase nbtbase = (NBTBase)par1Obj; if (GetId() != nbtbase.GetId()) { return(false); } if (Name == null && nbtbase.Name != null || Name != null && nbtbase.Name == null) { return(false); } return(Name == null || Name.Equals(nbtbase.Name)); }
/// <summary> /// Stores the given tag into the map with the given string key. This is mostly used to store tag lists. /// </summary> public virtual void SetTag(string par1Str, NBTBase par2NBTBase) { TagMap[par1Str] = par2NBTBase.SetName(par1Str); }
/// <summary> /// Write the actual data contents of the tag, implemented in NBT extension classes /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: void write(DataOutput par1DataOutput) throws IOException public override void Write(BinaryWriter par1DataOutput) { NBTBase nbtbase; for (IEnumerator <NBTBase> iterator = TagMap.Values.GetEnumerator(); iterator.MoveNext(); NBTBase.WriteNamedTag(nbtbase, par1DataOutput)) { nbtbase = iterator.Current; } par1DataOutput.Write(0); }
public static void Write(NBTTagCompound par0NBTTagCompound, BinaryWriter par1DataOutput) { NBTBase.WriteNamedTag(par0NBTTagCompound, par1DataOutput); }
/// <summary> /// Adds the provided tag to the end of the list. There is no check to veriy this tag is of the same type as any /// previous tag. /// </summary> public virtual void AppendTag(NBTBase par1NBTBase) { TagType = par1NBTBase.GetId(); TagList.Add(par1NBTBase); }
public virtual string ToString() { return((new StringBuilder()).Append("").Append(TagList.Count).Append(" entries of type ").Append(NBTBase.GetTagName(TagType)).ToString()); }