1.1.1-r • Published 4 years ago

nbt-read v1.1.1-r

Weekly downloads
3
License
CC-BY-SA-4.0
Repository
github
Last release
4 years ago

nbt-read

NPM npm

GitHub stars Twitter URL

Now with added comments!

Info

This is a simple CLI utility made in Node to parse Minecraft NBT data. It can decode various Minecraft data files to JSON.

Install

$ npm i -g nbt-read

Usage

$ nbt-read help
$ nbt-read parse [-raw] [-tabSize=<spacing>] <path> [jsonPath]
$ nbt-read print [-raw] [-tabSize=<spacing>] <path> [dataValue] [-save] [saveTo]

All commands are case insensitive.

dump is an alias for parse

Default tabSize is 4 for parse and 2 for print

Example usage

# Show help
$ nbt-read help

# Show help for parse
$ nbt-read help parse


# Parse level.dat to level.dat.json
$ nbt-read parse level.dat

# Parse level.dat to level.json
$ nbt-read parse level.dat level.json

# Parse level.dat to level.json with the ugly Java things in tact. (this is easy to revert back into NBT)
$ nbt-read parse -raw level.dat level.json

# Parse level.dat to level.json with raw (ugly Java things) and a tabSize of 2
$ nbt-read parse -raw -tabSize=2 level.dat level.json


# Read the value of Data.Difficulty to the console
$ nbt-read print level.dat Data.Difficulty

# Read the first value of Data.Player.recipeBook.recipes to the console
$ nbt-read print level.dat Data.Player.recipeBook.recipes[0]

# Read the value of Data.Player to the console and save it in the same format to levelDatPlayer.json
$ nbt-read print level.dat Data.Player -save levelDatPlayer.json

Example output

$ nbt-read print 959e4e47-[...].dat Inventory[5]

{
  "Slot": 8,
  "id": "minecraft:written_book",
  "Count": 1,
  "tag": {
    "pages": [
      "{\"text\":\"build §kbicycle build for two\"}"
    ],
    "title": "Orders",
    "author": "§kDeepest Lore"
  }
}
Done!

$ nbt-read print level.dat Data.Difficulty

3
Done!

Source

The code has been cleaned up and there is now now hard-coded logic! Woo!

Please use the code for whatever you want! (but please don't generalize commandHandler.js because I'm going to do that soon)

I'll happily accept merges or pull requests if you did a good!

There is a .vscode dir which contains 5 additions to cSpell.words, you can probably ignore this.

API

I'll upload the JSDOC as soon as I make my website.

Licence

This program and its direct source are licensed under CC-BY-SA-4.0 (Creative Commons Attribution-ShareAlike 4.0 International).

This means that you can use any code in this repo that is mine (not in node_modules) for any purpose as long as you attribute it to me (drheimdall) and share it under a licence that inherits CC-BY-SA-4.0.

1.1.1-r

4 years ago

1.1.0-r

4 years ago

1.0.4-r

4 years ago

1.0.3-r

4 years ago

1.0.2-r

4 years ago

1.0.1-r

4 years ago

1.0.0-r

4 years ago