Class NbtFlavor
- Namespace
- fNbt
- Assembly
- fNbt.dll
Identifies one of the NBT wire encodings ("flavors"). Immutable; use the static instances.
public sealed class NbtFlavor
- Inheritance
-
NbtFlavor
- Inherited Members
Remarks
A flavor describes an encoding, not a product or a file extension: Bedrock installs contain big-endian Java-flavor files, and network-flavor blobs occur embedded inside files.
Properties
AllowsNonCompoundRoot
Whether a document's root may be a tag of any type. When false, the root must be a
TAG_Compound. When true, a lone TAG_End byte is also valid and means an absent
document. True only for JavaNetwork.
public bool AllowsNonCompoundRoot { get; }
Property Value
Bedrock
Bedrock Edition disk format: level.dat, .mcstructure, and LevelDB values.
Little-endian, named TAG_Compound root, no TAG_Long_Array. Strings are capped at
32,767 bytes: the length prefix is a signed 16-bit value.
public static NbtFlavor Bedrock { get; }
Property Value
BedrockNetwork
Bedrock Edition network encoding, 0.16 and later. Little-endian, with
TAG_Int/TAG_Long values and container lengths as zigzag varints, and string
lengths as unsigned varints. Not a file format, though blobs of it may be embedded
inside files.
public static NbtFlavor BedrockNetwork { get; }
Property Value
BigEndian
Whether multi-byte values are big-endian. True for the Java flavors and ClassiCube, false for the Bedrock flavors.
public bool BigEndian { get; }
Property Value
ClassiCube
The profile of ClassicWorld (.cw) maps that the ClassiCube client can load:
big-endian with a named TAG_Compound root, GZip-compressed, tag types 0-10, strings up
to 256 bytes. Spec-compliant ClassicWorld files that use TAG_Int_Array match
JavaAnvil instead.
public static NbtFlavor ClassiCube { get; }
Property Value
HasRootName
Whether a document's root tag carries a name. False only for JavaNetwork.
public bool HasRootName { get; }
Property Value
Java
Java Edition 1.12 and later. Big-endian, named TAG_Compound root, all 13 tag types.
Reads every older Java-flavor file. This is the default flavor.
public static NbtFlavor Java { get; }
Property Value
JavaAnvil
Java Edition 1.2.1 through 1.11. Same as Java, but predates
TAG_Long_Array.
public static NbtFlavor JavaAnvil { get; }
Property Value
JavaLegacy
The original NBT format: Indev through Java Edition 1.1. Same as Java,
but predates TAG_Int_Array and TAG_Long_Array.
public static NbtFlavor JavaLegacy { get; }
Property Value
JavaNetwork
Java Edition network encoding, protocol 764 (1.20.2) and later. Big-endian like
Java, but the root tag is unnamed and may be any tag type (e.g. TAG_String
for text components), and a lone TAG_End byte means an absent document.
Not a file format, though blobs of it may be embedded inside files.
public static NbtFlavor JavaNetwork { get; }
Property Value
MaxStringBytes
The longest string, in encoded bytes, this flavor can carry: 65,535 for the Java flavors (unsigned 16-bit prefix), 32,767 for Bedrock (signed prefix), 256 for ClassiCube (client limit), unbounded for BedrockNetwork (varint prefix). Ceilings below 65,535 are enforced only when validation is enabled.
public int MaxStringBytes { get; }
Property Value
MaxTagType
The highest tag type this flavor's reference reader accepts. Enforced when validation is enabled (see NbtOptions); plain reads stay generous and accept every tag type.
public NbtTagType MaxTagType { get; }
Property Value
Name
Short display name of this flavor, e.g. "Java" or "BedrockNetwork".
public string Name { get; }
Property Value
UsesModifiedUtf8
Whether strings are written as Java's modified UTF-8 (CESU-8 pairs for
astral characters, the overlong C0 80 form for NUL, lone surrogates preserved).
True for the Java flavors and ClassiCube; the Bedrock flavors write standard UTF-8.
Reads accept both encodings on every flavor.
public bool UsesModifiedUtf8 { get; }
Property Value
UsesVarInts
Whether TAG_Int/TAG_Long values and length prefixes use variable-length
encoding. True only for BedrockNetwork.
public bool UsesVarInts { get; }
Property Value
Methods
ToString()
Returns this flavor's Name.
public override string ToString()