public byte[] ToBytes() { byte[] data; using (MinecraftMemoryStream ms = new MinecraftMemoryStream()) { ms.WriteByte(Discriminator); ms.WriteBoolean(HasMore); ms.WriteString(Name); ms.WriteVarInt(Ids.Count); foreach (var id in Ids) { ms.WriteString(id.Key); ms.WriteVarInt(id.Value); } ms.WriteStringArray(Substitutions); if (Dummies != null && Dummies.Count > 0) { ms.WriteStringArray(Dummies); } data = ms.ToArray(); } return(data); }
public byte[] ToBytes() { byte[] data; using (MinecraftMemoryStream buffer = new MinecraftMemoryStream()) { buffer.WriteByte(Discriminator); buffer.WriteVarInt(Mapping.Count); foreach (var item in Mapping) { buffer.WriteString(item.Key); buffer.WriteVarInt(item.Value); } buffer.WriteStringArray(BlockSubstitutions); buffer.WriteStringArray(ItemSubstitutions); data = buffer.ToArray(); } return(data); }