NBT File System
240
Minecraft Mods
Note: this site has forced me to select a "compatible" game version, but this external program is compatible with any Minecraft version that using the original NBT format and Minecraft Region format (including a later variant the Anvil format).
The primary part of this project is a FUSE-based file system implementation which allowing NBT file or Minecraft Region file be mounted as a file system, and then modified using normal file operations.
NBT parser and writer are originally written by Lukas Niederbremer as cNBT project which this project is based on.
To install built programs and manual pages, type 'make install'; some attitional environment variables may be used here:
The <fs-options> accepts both generic and FS-specific mount options; some of them are useful to specify here; see man page mount.nbt(8) (available below) for a detailed description of each FS-specific option.
Read the following man page for a detailed description of the file system.
The primary part of this project is a FUSE-based file system implementation which allowing NBT file or Minecraft Region file be mounted as a file system, and then modified using normal file operations.
NBT parser and writer are originally written by Lukas Niederbremer as cNBT project which this project is based on.
Download
Please get the source code directly from the git repository at sourceforge.net, by either cloning the repository using git(1) command, or clicking the Download Snapshot button on the source code browser web page.Install
To build it from source, make sure you have GCC or a compatible C compiler, GNU Make or BSD make, FUSE development library, as well as zlib development library installed, then type 'make'; some environment variables are useful to configure the build:CC |
C compiler |
AR | archive tool for creating static library |
CFLAGS |
prepend flags to C compiler |
LDFLAGS |
prepend flags to linker (e.g. -L <path>) |
Example
$ CC=gcc CFLAGS=-Os make
To install built programs and manual pages, type 'make install'; some attitional environment variables may be used here:
PREFIX | installing prefix, default /usr/local |
BINDIR | default ${PREFIX}/bin |
SBINDIR | default ${PREFIX}/sbin |
DATADIR | default ${PREFIX}/share |
MANDIR | default ${DATADIR}/man |
Use
Use program mount.nbt(8) to mount the file system from a NBT file or a Region file. The synopsis of the command line is:mount.nbt [-o <fs-options>] [<other-options>] <mount-from-file> <mount-point>
The <fs-options> accepts both generic and FS-specific mount options; some of them are useful to specify here; see man page mount.nbt(8) (available below) for a detailed description of each FS-specific option.
Example
# mount.nbt -o ro,region,umask=0022 /usr/home/minecraft/aether-realm/world/AETHER/region/r.1.1.mca /mnt/region/
# ls -al /mnt/region/80/Level/
total 0
-rw-r--r-- 1 root wheel 256 Jan 1 1970 Biomes
drwxr-xr-x 1 root wheel 1 Jan 1 1970 Entities
drwxr-xr-x 1 root wheel 1024 Jan 1 1970 HeightMap
-rw-r--r-- 1 root wheel 7 Jan 1 1970 InhabitedTime
-rw-r--r-- 1 root wheel 10 Jan 1 1970 LastUpdate
-rw-r--r-- 1 root wheel 2 Jan 1 1970 LightPopulated
drwxr-xr-x 1 root wheel 25 Jan 1 1970 Sections
-rw-r--r-- 1 root wheel 2 Jan 1 1970 TerrainPopulated
drwxr-xr-x 1 root wheel 1 Jan 1 1970 TileEntities
-rw-r--r-- 1 root wheel 2 Jan 1 1970 V
-rw-r--r-- 1 root wheel 3 Jan 1 1970 xPos
-rw-r--r-- 1 root wheel 3 Jan 1 1970 zPos
# ls -al /mnt/region/80/Level/Sections/
total 0
-rw-r--r-- 1 root wheel 9 Jan 1 1970 .type
drwxr-xr-x 1 root wheel 6 Jan 1 1970 0
drwxr-xr-x 1 root wheel 6 Jan 1 1970 1
drwxr-xr-x 1 root wheel 6 Jan 1 1970 2
drwxr-xr-x 1 root wheel 6 Jan 1 1970 3
# cat /mnt/region/80/Level/?Pos
48
34
Read the following man page for a detailed description of the file system.
mount.nbt(8) Manual Page
mount.nbt(8) FreeBSD System Manager's Manual mount.nbt(8)
NAME
mount.nbt - Mount a Named Binary Tag File System
SYNOPSIS
mount.nbt [-o <fs-option>[,...]] [-fnrvwh] <nbt-file> <mount-point>
DESCRIPTION
This tool is a FUSE-based file system implementation for accessing NBT
formatted data, which is used by Minecraft to store various data about
the game. Running this tool mounts a file system from the file
specified by <nbt-file>; both standalone NBT file (usually have suffix
.dat) and Minecraft Region file (usually have suffix .mcr or .mca) are
supported.
OPTIONS
-f Operate in foreground. Useful for debugging.
-h Print a brief usage message.
-n Ignored.
-o <fs-option>[,...]
Pass gereric mount options, FUSE-specific options, and/or NBT-
specific options, in a comma-separated list. See mount(8) and
fuse(8) for gereric mount options and FUSE-specific options.
NBT-specific options are:
ro Mount the file system read-only, useful to mount from a
file that can't be written to, or to prevent accidentally
changing it; but see writefile option below.
rw Revert any ro option that may be specified early.
region Specify the <nbt-file> is a Minecraft Region file instead
of a standalone NBT file.
typeprefix
Use node type prefix for node names when listing compound
nodes as a directory. This option affects directory
listing only, existing nodes can always be accessed
either with or without the type prefix.
umask=<mask>
Set file mode mask using an octal number for NBT nodes,
default 0.
writefile=<path>
Set an alternative path for writing NBT data; the
original <nbt-file> won't be written to if this is
specified. Will have no effect when file system is
mounted read-only.
compression={gzip|zlib}
Set compression format for writing NBT data; default gzip
for standalone NBT file, zlib for Minecraft Region file.
Will have no effect when file system is mounted read-
only.
-r Mount the file system read-only. Same as specifying -o ro.
-v Be Verbose during mounting.
-w Mount the file system read-write. Same as specifying -o rw.
NODE TYPES
NBT specification defined several types for a tag, they are mapped into
file types as followings:
┌────────────────────────────────────────────────────┐
│NBT Tag Type File Type Type Prefix Name │
│TAG_Byte Regular int8, byte │
│TAG_Short Regular int16 │
│TAG_Int Regular int32 │
│TAG_Long Regular int64 │
│TAG_Float Regular float32, float, single │
│TAG_Double Regular float64, double │
│TAG_Byte_Array Regular int8array, bytearray │
│TAG_String Regular string │
│TAG_List Directory list │
│TAG_Compound Directory compound │
│TAG_Int_Array Directory int32array │
│TAG_Long_Array Directory int64array │
└────────────────────────────────────────────────────┘
ACCESSING NODES
Referencing Nodes Under Compound
For nodes directly under a compound, they can be accessed using their
name; a type prefix can also be prepended to an name to reference a
node, as typeprefix:name. For example an int64 node named RandomSeed
under a compound named Data, the following 2 pathes would referencing
the exactly same node:
Data/int64:RandomSeed
compound:Data/RandomSeed
Turning on mount option typeprefix will having this type prefix be
automatically prepended to node names, when listing a compound using
readdir(3); this could be useful to preserve the type information when
copying a compound node recursively (such as using tar(1)), so it is
possible for the copied nodes be restored into another NBT later.
Referencing Nodes Under List
Nodes under a list are accessed using index numbers starting with 0;
they will also have same type, a pseudo file .type is available under
any list to indicate node type the list contains.
Accessing Individual Node
Any node which the file type is regular file can be read and written
directly using read(2) and write(2); they can also be truncate(2)ed to
empty, but number typed ( int8 , int16 , int32 , int64 , float32 and
float64 ) nodes will turn its value into 0 after that. Nodes with type
int8array or string support lseek(2) and unlimited truncate(2)
operations. Reading from a string node will have an additional line
feed character (\n) appended to the end automatically; similarly,
writing to a string node will have the ending line feed character
stripped if exist.
list and compound nodes can contain other nodes, accessing them
according to above rules.
int32array and int64array nodes are represented as directories, the
array elements are accessed using an index number starting with 0, as
regular files under the directory. Creating a new regular file with
appreciate index number under the directory extends the array, and any
element between the old tail index and new index will appear
automatically as well; newly added elements will initialized to 0. An
array can also be shrunk by removing (unlink(2)) the tail element, one
element at a time; as a design limitation, only the tail element can be
removed. On supported platforms, the array nodes may also be read
directly (using read(2)); in this case seeking is supported only when
aligned to element size, which is 4 or 8 for int32array or int64array
respectively. The data stream read directly from an array will be the
binary representation of the array elements in host byte order.
ADDING AND REMOVING NODES
Under Compound
Nodes under a compound can be removed by using unlink(2) or rmdir(2),
according to their represented file type; usual file system
restrictions on directory apply, meaning they can not be removed unless
empty.
Unlike referencing an existing node, creating a new node under a
compound must use a type prefixed name.
Under List
Like compound, nodes under a list may be removed by using either
unlink(2) or rmdir(2); if a non-tail node was removed, the index number
of later nodes will be shifted backward by 1, which could be surprising
when trying to remove multiple nodes.
New node may be added only to the tail of a list, there is currently
not possible to insert a node in middle of a list. Newly created node
will have the type specified by the list type, indicated by the .type
pseude file.
The list type may also be changed by writing a type prefix name into
.type, but only when the list is empty.
Special Requirement For Creating List Node
A list node may be created under either compound or list using mkdir(2)
according to rules above, but please note newly created list will have
an invalid list type; no node can be created under such list, and if a
file system is unmounted with it, writing NBT data will fail, causing
all modifications to be lost! Any newly created list must be
initiailized with a supported list type, by writing the type prefix
name to its .type pseude file.
CAVEATS
Data is commited to underlying <nbt-file> only upon unmounting; if
anything went wrong during this process, the error message will be sent
to syslog(3), and the file system will be unmounted without saving some
or all data.
When modifying a Minecraft Region file, it is currently not possible to
extend a modified chunk beyond the space available for the chunk in
that Region file; although this rarely happen unless a considerable
amount of additional data was copied into a chunk. If this happens,
such chunk will not be saved.
EXAMPLES
The following examples took place in an Unix shell (sh(1)).
Mount a standalone NBT file /tmp/level.dat at /mnt/nbt, prepare to
write a new NBT file at /tmp/new-level.dat:
mount -o writefile=/tmp/new-level.dat /tmp/level.dat /mnt/nbt
Mount a Minecraft Region file /tmp/r.0.-1.mcr at /mnt/region, with type
prefix turned on for node name listing:
mount -o region,typeprefix /tmp/r.0.-1.mcr /mnt/region
Working in a compound, create and write a new string node named id:
echo Villager > string:id
Working in a compound, create a new list node Pos with list type set to
float64, then create and write first node in the list:
mkdir list:Pos
echo float64 > Pos/.type
echo 31.5 > Pos/0
SEE ALSO
fuse(8), fusermount(8), mount(8)
Named Binary Tag specification by Mojang
mount.nbt(8)
License
The file system implementation mount.nbt(8) is distributed under Mozilla Public License 2.0. Other parts have different licenses, please see individual source files for the exact license terms.Disclaimer of Warranty
This program is provided here "as is", in hope that it could be useful for some users, but without warranty of any kind. The user must take full risk and responsibility by using this program. The author is not responsible for any damage including but not limited to loss of profit, service interruption, data corruption, and hardware failure, that may be caused by using this program.NBT File System Screenshots
Dear youtuber!
Have you a channel youtube and want to bring your Video to quality visitors?
Do you want your video to appear on our website?
Do you want to become partner with us?
Just 3 steps to become our partner:
Step 1: Make video review for mods, addons, plugins, ... which you like
Step 2: Upload this video to youtube and our link to your video description
Step 3: Send the youtube video link via message to http://fb.com/9lifehack or leave a comment in the post. We will add your video in the our post, it will help you have more view.
JOIN to get more youtube view with us!!!!
Have you a channel youtube and want to bring your Video to quality visitors?
Do you want your video to appear on our website?
Do you want to become partner with us?
Just 3 steps to become our partner:
Step 1: Make video review for mods, addons, plugins, ... which you like
Step 2: Upload this video to youtube and our link to your video description
Step 3: Send the youtube video link via message to http://fb.com/9lifehack or leave a comment in the post. We will add your video in the our post, it will help you have more view.
JOIN to get more youtube view with us!!!!