public void WriteMixedCodec(MixedCodec value) { var dimensions = new NbtCompound(value.Dimensions.Name) { new NbtString("type", value.Dimensions.Name) }; var list = new NbtList("value", NbtTagType.Compound); foreach (var(_, codec) in value.Dimensions) { codec.Write(list); } dimensions.Add(list); #region biomes var biomeCompound = new NbtCompound(value.Biomes.Name) { new NbtString("type", value.Biomes.Name) }; var biomes = new NbtList("value", NbtTagType.Compound); foreach (var(_, biome) in value.Biomes) { biome.Write(biomes); } biomeCompound.Add(biomes); #endregion var compound = new NbtCompound(string.Empty) { dimensions, biomeCompound }; var nbt = new NbtFile(compound); nbt.SaveToStream(this, NbtCompression.None); }
public void WriteMixedCodec(MixedCodec value) { var writer = new NbtWriter(this, ""); var list = new NbtList(NbtTagType.Compound, "value"); foreach (var(_, codec) in value.Dimensions) { codec.Write(list); } var dimensions = new NbtCompound(value.Dimensions.Name) { new NbtTag <string>("type", value.Dimensions.Name), list }; #region biomes var biomes = new NbtList(NbtTagType.Compound, "value"); foreach (var(_, biome) in value.Biomes) { biome.Write(biomes); } var biomeCompound = new NbtCompound(value.Biomes.Name) { new NbtTag <string>("type", value.Biomes.Name), biomes }; #endregion writer.WriteTag(dimensions); writer.WriteTag(biomeCompound); writer.EndCompound(); writer.TryFinish(); }