Skip to content

Instantly share code, notes, and snippets.

@tryashtar
Created September 4, 2024 21:59
Show Gist options
  • Save tryashtar/4e62280c1611d744b6aa5d752ab69c15 to your computer and use it in GitHub Desktop.
Save tryashtar/4e62280c1611d744b6aa5d752ab69c15 to your computer and use it in GitHub Desktop.
Bedrock brarchive file format

Bedrock .brarchive files

.brarchive is a simple uncompressed text archive format Bedrock decided to invent for some reason. It stores the contents of a single directory.

The binary format of the file is as follows:

Header

The file begins with a 16-byte header containing metadata.

  • 8 bytes: Magic number. Always equals 7d2725b1a0527026.
  • 4 bytes: Little-endian integer. Number of entries in the archive.
  • 4 bytes: Little-endian integer. Unknown, presumably a version number. Always equals 1.

Entries

The second field of the header describes how many entries there are. Each entry is 256 bytes.

  • 1 byte: Length of the entry's name in bytes.
  • 247 bytes: Entry's name, padded with 0 bytes. All vanilla usage is ASCII, the encoding may be that or UTF-8.
  • 4 bytes: Little-endian integer. File contents offset. This is the byte offset into the data block where this entry's contents begins.
  • 4 bytes: Little-endian integer. File contents length, in bytes.

Data Block

Following the entries is the data block, an uninterrupted stream of text. Each entry stores an offset into this stream, and a length. Vanilla contents are encoded in UTF-8.

@SuperLlama88888
Copy link

Where are these .brarchive files used?

@tryashtar
Copy link
Author

The 1.21.40.20 changelog says:

Built-in packs now include archive files for improved load performance on some platforms

@SuperLlama88888
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment