Skip to main content

一个Minecraft基岩版NBT解析工具

Project description

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())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dreamnbt-0.0.2.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dreamnbt-0.0.2-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file dreamnbt-0.0.2.tar.gz.

File metadata

  • Download URL: dreamnbt-0.0.2.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for dreamnbt-0.0.2.tar.gz
Algorithm Hash digest
SHA256 787bee963576b73be3553d701a196388d19828e86f1e87b4bbfcbb1d891a8cfd
MD5 80d5d17cb493cbd2974b81539f88280c
BLAKE2b-256 233f7cf19d804e931e38343e467a85870675148424e0225676702b736c9cc388

See more details on using hashes here.

Provenance

The following attestation bundles were made for dreamnbt-0.0.2.tar.gz:

Publisher: python-publish.yml on old-dream321/DreamNBT

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dreamnbt-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: dreamnbt-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for dreamnbt-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c8f793d6039c421cab772140044a48ad5c6945be1c3cb908b7267a07df6aa735
MD5 0cafa07e4b12a00d73bff449cac28ba8
BLAKE2b-256 e73447b7f16a62fd9e2b9cd7c78308b4a2e79ddc7c9458086b5ad7051390a08d

See more details on using hashes here.

Provenance

The following attestation bundles were made for dreamnbt-0.0.2-py3-none-any.whl:

Publisher: python-publish.yml on old-dream321/DreamNBT

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page