mirror of
https://github.com/thepigeongenerator/mcaselector-lite.git
synced 2025-12-17 06:05:44 +01:00
cleanup markdown
This commit is contained in:
@@ -1,17 +1,20 @@
|
|||||||
# Minecraft data specification
|
# Minecraft data specification
|
||||||
|
## NBT
|
||||||
|
|
||||||
|
## world data
|
||||||
There is a difference between \*.mca and \*.mcr files.
|
There is a difference between \*.mca and \*.mcr files.
|
||||||
Where \*.mca files are the newer variant.
|
Where \*.mca files are the newer variant.
|
||||||
- mcr = MinecraftRegion
|
- mcr = MinecraftRegion
|
||||||
- mca = Anvil
|
- mca = Anvil
|
||||||
|
|
||||||
## file locations
|
### file locations
|
||||||
| dim | file path |
|
| dim | file path |
|
||||||
|:----------|:---------------------|
|
|:----------|:---------------------|
|
||||||
| overworld | `world/region` |
|
| overworld | `world/region` |
|
||||||
| nether | `world/DIM-1/region` |
|
| nether | `world/DIM-1/region` |
|
||||||
| the end | `world/DIM1/region` |
|
| the end | `world/DIM1/region` |
|
||||||
|
|
||||||
## coordinate conversions
|
### coordinate conversions
|
||||||
```c
|
```c
|
||||||
// block->chunk:
|
// block->chunk:
|
||||||
return (x / 16) - sgn(x);
|
return (x / 16) - sgn(x);
|
||||||
@@ -22,44 +25,50 @@ return (x / 32) - sgn(x);
|
|||||||
return (x >> 5) - (x & 0x80000000);
|
return (x >> 5) - (x & 0x80000000);
|
||||||
```
|
```
|
||||||
|
|
||||||
## MCR format specification
|
|
||||||
## structure
|
### chunk format specification
|
||||||
### header
|
|
||||||
|
|
||||||
|
### MCR format specification
|
||||||
|
#### header
|
||||||
Region files have an 8KiB header, split in two 4KiB tables.
|
Region files have an 8KiB header, split in two 4KiB tables.
|
||||||
The first containing the offsets of chunks in the region file itself, the second providing timestamps for the last updates of those chunks.
|
The first containing the offsets of chunks in the region file itself, the second providing timestamps for the last updates of those chunks.
|
||||||
The offset of a chunk (x,z) (in chunk coordinates) in the first table can be found by using this formula:
|
The offset of a chunk (x,z) (in chunk coordinates) in the first table can be found by using this formula:
|
||||||
`4 * ((x & 32) + (z & 31) * 32)`. The timestamp can be found 4096 bytes later in the file.
|
`4 * ((x & 31) + (z & 31) * 32)`. The timestamp can be found 4096 bytes later in the file.
|
||||||
| range | 0x00—0x0FFF | 0x1000—0x1FFF | 0x2000— |
|
| range | `0x00`—`0x0FFF` | `0x1000`—`0x1FFF` | `0x2000`— |
|
||||||
|:------|:---------------|:----------------|:------------------------|
|
|:------|:-------------------|:--------------------|:------------------------|
|
||||||
| data | locations (4b) | timestamps (4b) | chunks and unused space |
|
| data | locations (4B) | timestamps (4B) | chunks and unused space |
|
||||||
|
|
||||||
#### chunk location
|
##### chunk location
|
||||||
Location info for a chunk is stored as a 32 bit big-endian integer, where the first three bytes are an offset in 4KiB sectors from the start of the file.
|
Location info for a chunk is stored as a 32 bit big-endian integer, where the first three bytes are an offset in 4KiB sectors from the start of the file.
|
||||||
The last byte gives the length of the chunk in 4KiB sectors. (rounded up, of course). Where chunks are always less than 1MiB in size.
|
The last byte gives the length of the chunk in 4KiB sectors. (rounded up, of course). Where chunks are always less than 1MiB in size.
|
||||||
If a chunk isn't present in the region file (e.g. because it hasn't been generated or migrated yet), both fields are zero.
|
If a chunk isn't present in the region file (e.g. because it hasn't been generated or migrated yet), both fields are zero.
|
||||||
|
|
||||||
#### timestamps
|
##### timestamps
|
||||||
Timestamp data are 32 bit big-endian integers, representing the last modification time of an individual chunk in epoch seconds.
|
Timestamp data are 32 bit big-endian integers, representing the last modification time of an individual chunk in epoch seconds.
|
||||||
|
|
||||||
### payload
|
#### payload
|
||||||
Chunk data starts with a big-endian 32 bit signed integer which contains the exact length of the data in bytes.
|
Chunk data starts with a big-endian 32 bit signed integer which contains the exact length of the data in bytes.
|
||||||
The first byte of this data indicates the compression scheme used for the data. The rest of the data is the actual compression data. (len-1 remaining now)
|
The first byte of this data indicates the compression scheme used for the data. The rest of the data is the actual compression data. (len-1 remaining now)
|
||||||
The data has an alignment requirement of 4KiB.
|
The data has an alignment requirement of 4KiB.
|
||||||
|
|
||||||
#### compression
|
##### compression
|
||||||
| value | type |
|
| value | type |
|
||||||
|------:|:------------------------------------|
|
|------:|:------------------------------------|
|
||||||
| 1 | GZip (RFC1952) (unused in practice) |
|
| `1` | GZip (RFC1952) (unused in practice) |
|
||||||
| 2 | Zlib (RFC1950) |
|
| `2` | Zlib (RFC1950) |
|
||||||
| 3 | uncompressed (<1.15.1) |
|
| `3` | uncompressed (<`1.15.1`) |
|
||||||
| 4 | LZ4 (≥24w04a) |
|
| `4` | LZ4 (≥`24w04a`) |
|
||||||
| 127 | custom algorithm[^1] (≥24w04a) |
|
| `127` | custom algorithm\* (≥`24w04a`) |
|
||||||
[^1]: A namespaced string must follow representing the algorithm used. The string is preceded by its length, encoded as an unsigned 16-bit integer.
|
|
||||||
The uncompressed data is in NBT format and follows the chunk format.
|
\*: A namespaced string must follow representing the algorithm used. The string is preceded by its length, encoded as an unsigned 16-bit integer.
|
||||||
|
The uncompressed data is in NBT format and follows the chunk format.
|
||||||
|
If the value of compression scheme increases by 128, the compressed data is saved in a file called `c.x.z.mcc`, where x and z are the chunk's coordinates, instead of the usual position.
|
||||||
|
|
||||||
|
### MCA format specification
|
||||||
|
|
||||||
<!-- TODO: perform further research by reading the articles and writing the information down here. -->
|
|
||||||
|
|
||||||
## sources
|
## sources
|
||||||
- [https://minecraft.wiki/w/Region_file_format](https://minecraft.wiki/w/Region_file_format)
|
- https://minecraft.wiki/w/Region_file_format
|
||||||
- [https://minecraft.wiki/w/Anvil_file_format](https://minecraft.wiki/w/Anvil_file_format)
|
- https://minecraft.wiki/w/Anvil_file_format
|
||||||
- [https://minecraft.wiki/w/Chunk_format](https://minecraft.wiki/w/Chunk_format)
|
- https://minecraft.wiki/w/Chunk_format
|
||||||
|
|||||||
Reference in New Issue
Block a user