Minecraft nbt
To understand Minecraft NBT (Named Binary Tag) format. Use when: (1) user references NBT, SNBT, or Named Binary Tag, (2) user works with Minecraft commands using data tags (curly-brace syntax), (3) user mentions .dat, .nbt, level.dat, or Minecraft save files, (4) user needs to parse, generate, or validate NBT/SNBT data, (5) user asks about NBT tag types like TAG_Byte, TAG_Compound, etc., (6) code or context contains NBT-format binary data or SNBT stringsFrom its SKILL.md
npx -y skills add woyxiang/skills --skill minecraft-nbtAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
5.3 KB, ~1.4k tokens by cl100k_base, as published. Nobody here has run it
Minecraft NBT Format
Named Binary Tag (NBT) is the tree-structured data format used by Minecraft to store game data in save files and to pass structured data in commands.
Detection
File patterns: *.dat, *.nbt, level.dat, *.snbt
Keywords: NBT, SNBT, Named Binary Tag, TAG_Byte, TAG_Compound, TAG_List, TAG_End
SNBT patterns: Curly-brace data in Minecraft commands (e.g., {Health:20f,Inventory:[...]})
Binary patterns: GZip-compressed files containing tag ID bytes (0x00-0x0C)
Contexts: Minecraft commands (/data, /execute, /summon, /give), save file parsing
Routing
| When you need to... | Read |
|---|---|
| Understand what NBT is and how it's used | basics.md |
| Work with SNBT (the string/text format used in commands) | snbt.md |
| Parse or write binary NBT data | binary-format.md |
| See real-world NBT examples from Minecraft commands | examples.md |
Two Faces of NBT
NBT exists in two forms:
- Binary NBT — The on-disk format used in save files (
.dat,.nbt, chunk data). A tree of typed tags with numeric IDs, usually GZip-compressed. - SNBT (Stringified NBT) — The text format used in Minecraft commands and data generators (
.snbtfiles). Human-readable JSON-like syntax.
Quick Reference
Tag Types (Binary IDs)
| ID | Tag | Payload |
|---|---|---|
| 0 | TAG_End | None (marks end of compound) |
| 1 | TAG_Byte | 1 byte, signed |
| 2 | TAG_Short | 2 bytes, signed, big-endian |
| 3 | TAG_Int | 4 bytes, signed, big-endian |
| 4 | TAG_Long | 8 bytes, signed, big-endian |
| 5 | TAG_Float | 4 bytes, IEEE 754 binary32 |
| 6 | TAG_Double | 8 bytes, IEEE 754 binary64 |
| 7 | TAG_Byte_Array | Int size + bytes |
| 8 | TAG_String | Unsigned short size + UTF-8 bytes |
| 9 | TAG_List | Byte tag ID + int size + payloads |
| 10 | TAG_Compound | Fully formed tags until TAG_End |
| 11 | TAG_Int_Array | Int size + int payloads |
| 12 | TAG_Long_Array | Int size + long payloads |
SNBT Type Suffixes
| Type | Suffix | Example |
|---|---|---|
| Byte | b/B | 34B, -20b |
| Short | s/S | 31415s |
| Int | (none) or i/I | 31415926 |
| Long | l/L | 31415926l |
| Float | f/F | 3.14f |
| Double | (none) or d/D | 3.1415926 |
Key SNBT Rules
- Compound keys can be unquoted if they match
[a-zA-Z0-9_\-.+]+and don't start with a digit/-/./+ - String values can be unquoted with same rules; otherwise use
"..."or'...' - Arrays vs Lists:
[B;1b,2b,3b]is a byte array;[1b,2b,3b]is a list — they are different types - Heterogeneous lists: SNBT allows
[1, "abc"]; when saved to binary NBT, non-compound entries become compounds with empty-key{"":value} - Numbers: Support hex (
0x), binary (0b), E notation, underscore separators, signedness suffixes (u/s) - Boolean: NBT has no boolean —
true/falsein SNBT become1b/0b
Key Binary Rules
- Java Edition: All multi-byte numbers are big-endian
- Bedrock Edition: All multi-byte numbers are little-endian
- TAG_End has no name (just a single
0x00byte) - Root tag is always a compound (Java) or compound/list (Bedrock), usually with empty string name
- Nesting limit: 512 levels deep for List and Compound
- Files: Usually GZip-compressed; some are uncompressed or zlib-compressed
Partial Matching (Testing)
When testing NBT with commands like /execute if data or target selector nbt=:
- Compounds: Extra tags in target still match (subset match).
{}matches anything. - Lists: Order and count ignored — as long as every requested element is present, it matches. Empty list only matches empty list.
- Arrays (byte/int/long): Order and count ARE checked.
- Types must match exactly:
1(int) ≠1d(double) - Namespaces required:
"stone"≠"minecraft:stone"
Java vs Bedrock
| Feature | Java | Bedrock |
|---|---|---|
| Endianness | Big-endian | Little-endian |
| level.dat | GZip-compressed | Uncompressed + 8-byte header |
| Heterogeneous lists | Supported in SNBT | N/A |
Dependencies
No external tools required. For working with NBT files, common tools include:
- NBTExplorer / NBT Studio — GUI NBT file viewer/editor
- webNBT — Online NBT viewer
- Vanilla data generator — Converts
.snbt↔.nbt
Validation Patterns
When validating SNBT:
- Check that all tags have a valid type suffix
- Verify compound keys are properly quoted if they contain special characters
- Ensure arrays use the correct prefix (
B;,I;,L;) - Confirm numbers are within their type's range
- Check for balanced brackets and braces
- Verify escape sequences in strings are valid
- Ensure namespaces are present in resource location strings when testing matches
What ships with it: 4 files
23.7 KB alongside SKILL.md
- basics.md4.9 KB
- binary-format.md6.6 KB
- examples.md5.7 KB
- snbt.md6.5 KB