NoNBT 2.0.7

dotnet add package NoNBT --version 2.0.7
                    
NuGet\Install-Package NoNBT -Version 2.0.7
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NoNBT" Version="2.0.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NoNBT" Version="2.0.7" />
                    
Directory.Packages.props
<PackageReference Include="NoNBT" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NoNBT --version 2.0.7
                    
#r "nuget: NoNBT, 2.0.7"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NoNBT@2.0.7
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NoNBT&version=2.0.7
                    
Install as a Cake Addin
#tool nuget:?package=NoNBT&version=2.0.7
                    
Install as a Cake Tool

NoNBT

NuGet version License: MIT

NoNBT is a lightweight, straightforward .NET library for reading and writing Minecraft's Named Binary Tag (NBT) data format.

Features

  • Simple and Easy to Use: Created specifically for my Minecraft server implementation
  • Full Support for Modified UTF-8: Properly handles emojis and special characters (for some reason other libraries don't)
  • Java Edition Compatible: Currently supports the Big Endian format used in Minecraft Java Edition

While NoNBT isn't designed to be a comprehensive NBT library, it covers all the essentials you need for basic NBT operations with minimal overhead. I built it because I needed something reliable and focused for my own projects.

There is no SNBT (Stringified NBT) support in this library. If you need to parse SNBT, consider using a different library or implement it yourself.

Capabilities

  • Read & Write NBT Data: Supports reading from and writing to streams
  • Full Tag Support: Implements all standard NBT tags
  • Modified UTF-8: Correctly encodes and decodes strings using MUTF-8 used by Minecraft
  • Simple API: Easy-to-use NbtReader and NbtWriter classes
  • Asynchronous API: Supports async methods
  • Object Model: Represents NBT data using a clear hierarchy of NbtTag derived classes
  • JSON Conversion: Basic ToJson() method on tags for debugging/testing purposes

Installation

Install the package via NuGet Package Manager or the .NET CLI:

dotnet add package NoNBT

Usage

Reading NBT Data

using var reader = new NbtReader(stream);

NbtTag? tag = reader.ReadTag();

if (tag is CompoundTag rootTag)
{
    string? name = rootTag.Get<StringTag>("name")?.Value;
    int? score = rootTag.Get<IntTag>("score")?.Value;
    Console.WriteLine($"Player {name} has score {score}");
}

// or use the indexer
string? name = (rootTag["name"] as StringTag)?.Value;

NbtReader expects a raw, decompressed NBT stream. You need to handle GZip/ZLib decompression before passing the stream.

Writing NBT Data

using var writer = new NbtWriter(stream);

writer.WriteTag(new StringTag("message", "Hello, World!"));

var compound = new CompoundTag("root")
{
    new StringTag("name", "Player1"),
    new IntTag("score", 42)
};
writer.WriteTag(compound);

public void WriteTextComponent(TextComponent? component)
{
    if (component == null) return;
    using NbtWriter writer = new(this);

    CompoundTag tag = component.ToNbt();
    writer.WriteTag(tag, false); // text component root tag is unnamed
}

NbtWriter writes raw NBT data. Apply GZip/ZLib compression after writing if needed.

Supported NBT Tag Types

The library fully supports the standard NBT tag types via the NbtTagType enum and corresponding classes in the NoNBT.Tags namespace:

  • End = 0 (Implicitly handled by CompoundTag and NbtReader)
  • Byte = 1 (ByteTag)
  • Short = 2 (ShortTag)
  • Int = 3 (IntTag)
  • Long = 4 (LongTag)
  • Float = 5 (FloatTag)
  • Double = 6 (DoubleTag)
  • ByteArray = 7 (ByteArrayTag)
  • String = 8 (StringTag)
  • List = 9 (ListTag)
  • Compound = 10 (CompoundTag)
  • IntArray = 11 (IntArrayTag)
  • LongArray = 12 (LongArrayTag)
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.7 162 1/18/2026
2.0.6 571 4/25/2025
2.0.5 230 4/25/2025
2.0.4 240 4/22/2025
2.0.2 278 4/20/2025
2.0.1 288 4/20/2025
2.0.0 265 4/20/2025
1.0.4 272 4/20/2025
1.0.3 258 4/20/2025