Orthrus Research
Guide 7 minute read

Cubes and columns

Cubature cuts a Minecraft 1.12.2 world into 16-block cubes and loads only the ones near players. This is what that changes for a mod that reads, writes or generates blocks.

Verified 2026-11-15Minecraft 1.12.2Cleanroom 0.7.14-alphaJava 26Cubature 1.12.2-0.1.4.0

orthrus.cc/texts/cubes-and-columns

Vanilla Minecraft 1.12.2 loads, saves and lights the world one chunk at a time, and a chunk is a whole column: 16 blocks square and 256 blocks tall. Cubature, our fork of CubicChunks, swaps that unit for a 16-block cube. A world can then run far above and below the vanilla limits and still load only the parts near players.1

This guide is for mod developers. It covers what the swap changes for code that checks heights, reads nearby blocks or generates terrain. The reasons we build worlds this way are in Same seed, any order.

Cubature's public API is the CubicChunksAPI/ module, and its packages still begin io.github.opencubicchunks.cubicchunks.api. We kept those names, the mod IDs and the save format, so addons built for CubicChunks find what they expect.1

Two units of storage

A cube (ICube) is 16 × 16 × 16 blocks, and the API names its edge ICube.SIZE. A column (IColumn) is the stack of cubes that share an X and a Z. A column is still a vanilla Chunk: ICube.getColumn() returns an object that is both.2 Code that asks the world for a chunk still gets one.

What changes is what the chunk holds. A column holds only the cubes that are loaded right now, and it keeps what belongs to the whole stack, such as the height map.3 Which cubes those are depends on where the players are. Cubature adds a view distance for the vertical axis, verticalCubeLoadDistance, which is 8 cubes by default.4

A block of world cut into cubes with one cube lifted out. Each cube is 16 blocks wide, long and tall. A Riven world is 2,048 blocks tall.16 × 16 × 162,048 blocks
Figure IA block of world cut into cubes, with one lifted out of its slot. The lifted cube is the unit Cubature loads, and the stack it came from is its column.

How tall the world is

A cubic world has no fixed range of 0 to 256. ICubicWorld extends IMinMaxHeight, whose getMinHeight() gives the world's bottom block and whose getMaxHeight() gives the block above its top one. ICubicWorld.isCubicWorld() tells you which kind of world you're in.5

A cubic world has two ranges, and they answer different questions:

Range Read it with
Where blocks can exist getMinHeight(), getMaxHeight()
Where the generator makes terrain getMinGenerationHeight(), getMaxGenerationHeight()

The first is set from defaultMinHeight and defaultMaxHeight in config/cubicchunks.cfg when the world is created. The second is whatever the world type's calculateGenerationHeightRange returns.6

The two can disagree. Riven generates terrain from Y-1664 to Y383. Our test profile used to set defaultMinHeight to -128, and a test player teleported to Y-500 took out-of-world damage and died. Cubature fixes a new world's range, including where that damage starts, from the config values and not from the generator's range. A Riven server sets them to -1664 and 384 before the world is created.7

Coordinates

A block coordinate splits into a cube coordinate and a position inside the cube. Coords holds the conversions, and they're bit operations: blockToCube(b) is b >> 4, and blockToLocal(b) is b & 0xf.8

The shift rounds toward negative infinity, not toward zero. Block −1 is in cube −1 at local position 15, not in cube 0. Integer division gets this wrong, because -1 / 16 is 0 in Java.

Block Y blockToCube blockToLocal
−1664 −104 0
−17 −2 15
−1 −1 15
0 0 0
15 0 15
16 1 0
383 23 15

The first and last rows are the bottom and top blocks of a Riven world, which makes it 128 cubes tall.9

Going the other way, cubeToMinBlock(c) is c << 4, cubeToMaxBlock(c) adds 15 to that, and localToBlock(c, l) adds a local offset. CubePos addresses a cube by its three cube coordinates and carries the same conversions as methods, such as getMinBlockY() and CubePos.fromBlockCoords(x, y, z).8

Biomes are stored in three dimensions. Each cube holds one biome for every 4 × 4 × 4 block section, 64 in all.10 Coords.blockToLocalBiome3d(b) gives a section's index along one axis: (b & 15) >> 2.8

Reading and writing blocks

The world's own getBlockState and setBlockState keep working, because Cubature changes the vanilla Chunk code underneath them to use cubes. Vanilla's own height check keeps working too: in a cubic world, World.isOutsideBuildHeight compares against the world's range.11 Two habits from vanilla code still break.

  1. Height checks written by hand. A test such as y < 0 || y >= 256 rejects valid positions above and below that range. Ask the world, through ICubicWorld's getMinHeight() and getMaxHeight() or through isOutsideBuildHeight.
  2. Loading by accident. On the server, IColumn.getCube(cubeY) and ICubeProvider.getCube(x, y, z) do whatever it takes to hand you the cube. If it isn't loaded, the server loads it. If it was never generated, the server generates it before it returns.12 Code that only looks at what's nearby should call getLoadedCube, which returns null for a cube that isn't loaded.13

An early version of Cubature's delivery got the second one wrong in the other direction. A getCube that needed generation while cubes were being delivered to players went to the workers and came back as an empty cube, whoever had called. A population step could read air where the cube would hold ground. In one 60-second test flight we counted thousands of those reads, nearly all from Riven's population. Delivery requests now say what they are. Every other caller gets the real cube, built on its own thread or by the worker that had already started it.14

For finer control, ICubeProviderServer.getCube(x, y, z, requirement) names how far the server may go, and returns null when that isn't far enough to produce the cube. Each level includes the ones above it in this table, and the plain getCube asks for GENERATE.13

Requirement The server may
GET_CACHED Return the cube only if it is already loaded
LOAD Load it from disk
GENERATE Generate it
POPULATE Populate it
LIGHT Light it

Generating cubes

A cubic world type implements ICubicWorldType, and its createCubeGenerator(World) returns the world's ICubeGenerator. Generation runs in three stages, each with its own method.15

Stage Method What it makes
1 generateColumn(Chunk) What belongs to the whole column, such as biome data
2 generateCube(x, y, z, primer) One cube's blocks and biomes
3 populate(ICube) Features that cross cube edges, such as trees and ore veins

generateCube fills a CubePrimer with block states at cube-local coordinates from 0 to 15, and with biomes at section coordinates from 0 to 3.10 The primer passed in is a hint that saves an allocation. A generator may fill it, or it may return a different primer and leave the one it was given untouched. The three-argument generateCube is deprecated but still abstract, so an implementation hands it on to the four-argument form.15

// An excerpt: ICubeGenerator's other methods are left out.
public final class StoneBelowZero implements ICubeGenerator {
    private static final CubePrimer STONE =
            CubePrimer.createFilled(Blocks.STONE.getDefaultState());

    @Override
    public CubePrimer generateCube(
            int cubeX, int cubeY, int cubeZ, CubePrimer primer) {
        // Cubes below Y 0 are solid stone, and the rest stay air.
        // When STONE is returned, the primer that was passed in
        // is left as it came.
        return cubeY < 0 ? STONE : primer;
    }

    @Override
    @Deprecated
    public CubePrimer generateCube(int cubeX, int cubeY, int cubeZ) {
        return generateCube(cubeX, cubeY, cubeZ, new CubePrimer());
    }
}

Sharing one primer this way is safe. The server copies a returned primer's blocks and biomes into the new cube, and it resets only the primer it passed in.12 The rule that follows is to never change a primer after returning it.

Features that cross cube edges belong in populate(ICube). Unlike vanilla population, it never causes recursive generation. Two methods tell Cubature how far a generator's population reaches. getPopulationPregenerationRequirements(cube) returns the box of cubes that populating this cube may read or change, and Cubature generates those first. getFullPopulationRequirements(cube) returns the box of cubes whose population can write into this one, and the cube is fully populated once all of them have been.15

The API's recommended value for the second box is RECOMMENDED_FULL_POPULATOR_REQUIREMENT: offsets −1 to 0 on each axis, which is eight cubes with the cube itself included.15 Riven needs less. Its population places a column's first animals and writes no block, so nothing reaches into another cube and the second box is NO_REQUIREMENT. For the first box it asks for the cube above and the cube below, because an animal's ground may lie in the cube below and its head in the cube above.16

A generator can also ask to run off the server thread. If its cubes are a pure function of the seed and their coordinates, and its code is thread-safe, it returns true from supportsConcurrentCubeGeneration(). Cubature then generates its cubes on worker threads, and the server thread installs them within a budget each tick.1 The concurrentGenerationThreads setting sizes the pool. By default that is a quarter of the processors, at least one and at most four, and 0 turns the workers off.4 The workers also call prepareColumn(columnX, columnZ), an optional hook for warming the generator's own caches. It must be thread-safe, must not touch the world, and must not change what generation produces.15

Riven returns true: its cubes are pure functions of the seed, the world's definitions and their coordinates.16 What we get from that, and what it cost, is the subject of Same seed, any order.

Sources

  1. 1 Cubature README: Changes from CubicChunks; For players and pack makers; For addon and mod developers; Upstream
  2. 2 Cubature API: ICube.java
  3. 3 Cubature API: IColumn.java
  4. 4 Cubature source: CubicChunksConfig.java
  5. 5 Cubature API: IMinMaxHeight.java; Cubature API: ICubicWorld.java
  6. 6 Cubature API: ICubicWorldType.java; Cubature source: CommonEventHandler.java, where a world's two ranges are set
  7. 7 Riven runtime: Profile; Riven README: For players and pack makers
  8. 8 Cubature API: Coords.java; Cubature API: CubePos.java
  9. 9 Riven README: What Riven generates
  10. 10 Cubature API: CubePrimer.java
  11. 11 Cubature source: MixinChunk_Cubes.java; Cubature source: MixinWorld_HeightLimits.java
  12. 12 Cubature source: CubeProviderServer.java; Cubature source: Cube.java
  13. 13 Cubature API: ICubeProvider.java; Cubature API: ICubeProviderServer.java
  14. 14 Cubature c8223c9 Make delivery generation requests explicit
  15. 15 Cubature API: ICubeGenerator.java; Cubature API: ICubicWorldType.java
  16. 16 Riven source: RivenWorldType.java