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.1.tar.gz (10.2 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.1-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dreamnbt-0.0.1.tar.gz
  • Upload date:
  • Size: 10.2 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.1.tar.gz
Algorithm Hash digest
SHA256 94e6279ea017aa9b898d7aefd7875f7dd34a5f54b6633a5d3f60589c2a24589b
MD5 f954527294dec0d365128419aab3b037
BLAKE2b-256 dfa8a96eb2d82ed08e478868bd0daab7a77c65622cfd619d4b8f7ed8eaab11d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for dreamnbt-0.0.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: dreamnbt-0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 711f847cae6043bd48c99f0c3d20a60b4e1cfa33655578c9185efe5629cb905c
MD5 18449a9309eaf02969f1c8816e4bddca
BLAKE2b-256 ff2525d8301dc749a9757f1d4965382b6a866aa52eb413cdd6ccbfbb1bb582dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for dreamnbt-0.0.1-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