Skip to content

Instantly share code, notes, and snippets.

@Pokechu22
Last active January 22, 2020 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pokechu22/0b89f928b381dede0387fe5f88faf8c0 to your computer and use it in GitHub Desktop.
Save Pokechu22/0b89f928b381dede0387fe5f88faf8c0 to your computer and use it in GitHub Desktop.
Sample chunk packets

Some sample chunk data packets.

Format

The *.bin files are complete chunk data packet payloads (however, they do not have a packet length or ID specified, and are neither compressed nor encrypted).

The *.data.bin files are the data arrays within the packets, matching the data structure.

Most of these chunks have data only located in the bottom section, with a few exceptions. All of them have only the void biome set, and no block entities. The dimension is the overworld (skylight is present). All data is based on the format in 1.13.2.

Code

All chunks are generated with specific blocks according to simple functions. When these functions return null, that means no block should be set at that position; this is meaningful for creating an empty section in the case of servers (but for clients should be treated as equivilent to air).

Empty

A chunk that consists only of the void (no sections).

return null;

Flat

A normal superflat chunk.

switch (y) {
case 0: return 25; // Bedrock
case 1: return 9; // Dirt
case 2: return 9; // Dirt
case 3: return 8; // Grass block
default: return null;
}

Stone

A chunk that contains only stone, from y=0 to y=255.

return 1; // Stone

Slope

A chunk that contains a sloping pattern increasing in both the x and z directions. Contains data in 2 sections, from y=0 to y=31.

if (y == x + z) {
    return 1;
} else {
    return null;
}

TopOnly

A chunk that contains stone at y=255.

if (y == 255) {
    return 1;
} else {
    return null;
}

4BPB

A chunk that contains a grid of 16 different blocks in a diagonal pattern, for 4 bits per block. Note that the actual IDs are mostly meaningless in terms of real blocks.

if (y == 0) {
    return (x - z) & 15;
} else {
    return null;
}

5BPB

A chunk that contains 32 different block states linearly, for 5 bits per block.

if (y == 0 && z < 2) {
    return x + 16*z;
} else {
    return null;
}

6BPB

A chunk that contains 64 different block states linearly, for 6 bits per block.

if (y == 0 && z < 4) {
    return x + 16*z;
} else {
    return null;
}
������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment