Skip to content

Instantly share code, notes, and snippets.

@ByteZ1337
Last active February 26, 2023 10:40
Show Gist options
  • Save ByteZ1337/31f10b0052f44acfc177f40a0f0fe9cd to your computer and use it in GitHub Desktop.
Save ByteZ1337/31f10b0052f44acfc177f40a0f0fe9cd to your computer and use it in GitHub Desktop.
Minecraft Heightmap Types

Heightmaps

Since I've recently been working on some Minecraft world gen stuff I came across Minecraft's internal height maps. I mainly needed them for a few placement modifiers like the surface_relative_threshold_filter. I couldn't find any documentation on the different heightmap types, so I decided to dig into Minecraft's code and write a small program that can render them. Here's a small overview:

Heightmap Types

Minecraft has 6 different heightmap types:

  • WORLD_SURFACE_WG
  • WORLD_SURFACE
  • OCEAN_FLOOR_WG
  • OCEAN_FLOOR
  • MOTION_BLOCKING
  • MOTION_BLOCKING_NO_LEAVES

The heightmaps with the _WG suffix are used for world generation and aren't present after a chunk has been generated. They're pretty much the same as the ones without the suffix. Of course, some data might still be missing in the _WG heightmaps since they're still being generated.

WORLD_SURFACE

The WORLD_SURFACE heightmap stores the height of the highest non-air block in each block-column.

OCEAN_FLOOR

Same as WORLD_SURFACE but all non motion-blocking blocks (water, lava, flowers, etc.) are ignored.

MOTION_BLOCKING

Same as OCEAN_FLOOR but fluid blocks aren't ignored.

MOTION_BLOCKING_NO_LEAVES

Same as MOTION_BLOCKING but leaves are also ignored.

Examples

Here are some examples of the different heightmaps (click the arrows):

Forest

Screenshot

Forest

World surface

WORLD_SURFACE

Ocean floor

OCEAN_FLOOR

Motion blocking

MOTION_BLOCKING

Motion blocking, no leaves

MOTION_BLOCKING_NO_LEAVES

Lake

Screenshot

Lake

World surface

WORLD_SURFACE

Ocean floor

OCEAN_FLOOR

Motion blocking

MOTION_BLOCKING

Motion blocking, no leaves

MOTION_BLOCKING_NO_LEAVES

Beach

Screenshots

Beach Cave

World surface

WORLD_SURFACE

Ocean floor

OCEAN_FLOOR

Motion blocking

MOTION_BLOCKING

Motion blocking, no leaves

MOTION_BLOCKING_NO_LEAVES

Mountains

Screenshot

Mountain

World surface

WORLD_SURFACE

Ocean floor

OCEAN_FLOOR

Motion blocking

MOTION_BLOCKING

Motion blocking, no leaves

MOTION_BLOCKING_NO_LEAVES

Island

Since all non ocean floor heightmaps are the same for this example, I only included the ocean floor and world surface heightmaps.

Screenshot

Island

World surface

WORLD_SURFACE

Ocean floor

OCEAN_FLOOR

Ice Spikes

Screenshot

Ice Spikes

World surface

WORLD_SURFACE

Ocean floor

OCEAN_FLOOR

Motion blocking

MOTION_BLOCKING

Motion blocking, no leaves

MOTION_BLOCKING_NO_LEAVES

Seeing the difference between WORLD_SURFACE and MOTION_BLOCKING might be hard on some monitors since only a few pixels have a 1 gray level difference. You can open them in full screen and switch between them to see the difference better.

@Slender04
Copy link

Hi, is the program linked on this document?

@ByteZ1337
Copy link
Author

Hi, is the program linked on this document?

No, it contains a bit of internal Minecraft code so I can't really share it. But it's really not that hard to implement. Just associate the height to a gray value between 100-255 and start at a height around 50.

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