Skip to main content

DreamNBT

一个Minecraft基岩版NBT解析工具

安装

pip install DreamNBT

使用

1.读取NBT文件

from DreamNBT import parse_binary
with open("test.dat", "rb") as f:
    nbt = parse_binary(f)

2.格式化输出NBT

print(nbt)

示例输出:

TAG_Compound(): 3 entries {
  TAG_Int(t1): 23455
  TAG_List(t2): 3 entries [
    TAG_Int(): 1
    TAG_Int(): 2
    TAG_Int(): 3
  ]
  TAG_Compound(t3): 2 entries {
    TAG_Byte(aa): 1
    TAG_Compound(t4): 2 entries {
      TAG_Int(t1): 23455
      TAG_List(t2): 3 entries [
        TAG_Int(): 1
        TAG_Int(): 2
        TAG_Int(): 3
      ]
    }
  }
}

3.构建和修改NBT

示例:构建上面输出的NBT

from DreamNBT import *

a = TAG_Compound()

a["t1"] = TAG_Int(23455)

a["t2"] = TAG_List([TAG_Int(1), TAG_Int(2), TAG_Int(3)])

a["t3"] = TAG_Compound()
a["t3"]["aa"] = TAG_Byte(1)

b = TAG_Compound()
b["t1"] = TAG_Int(23455)
b["t2"] = TAG_List([TAG_Int(1), TAG_Int(2), TAG_Int(3)])
a["t3"]["t4"] = b

4.NBT转为二进制

with open("test.dat", "wb") as f:
    f.write(a.to_binary())

5.SNBT解析

from DreamNBT import parse_snbt
nbt = parse_snbt("{t1:23455,t2:[1,2,3],t3:{aa:1,t4:{t1:23455,t2:[1,2,3]}}}")

6.NBT转为SNBT

print(nbt.to_snbt())

示例输出:

{t1:23455,t2:[1,2,3],t3:{aa:1,t4:{t1:23455,t2:[1,2,3]}}}

Metadata

Release files for DreamNBT 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for DreamNBT 0.1.5
File Size Uploaded
dreamnbt-0.1.5.tar.gz 14.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for DreamNBT 0.1.5
File Interpreter ABI Platform
dreamnbt-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 30.7 kB

Release files / dreamnbt-0.1.5.tar.gz

Download URL dreamnbt-0.1.5.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e412faeccbf35e73db2cbb73607c1f2dc9e492412d32357deec118a9d756a0ee
BLAKE2b-256 checksum
How to use checksums
fbb9719edf4b0a812e5053b145642aa4b29665a21dfbdb527c970fa5b1edda3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 31, 2026.

Transparency log

Release files / dreamnbt-0.1.5-py3-none-any.whl

Download URL dreamnbt-0.1.5-py3-none-any.whl
Size 16.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
889b1c5cfef24f9e30978b5473f24ae7dbc1f064edc626c73b76940db3950236
BLAKE2b-256 checksum
How to use checksums
b4819006c4223d4174f85d34df0de3b1c2724d1d3f870cfbd659681b307d8d68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 31, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page