chunkgen
A Rust library for generating Minecraft worlds. It reads vanilla and custom datapacks, JIT-compiles their density functions, and generates chunks that match vanilla's output.

Status
This project is in a very experimental state. The API is not stable and is subject to change.
Generation runs through ChunkStatus::Features. InitializeLight, Light, Spawn, and Full are not implemented and return Error::Unsupported.
Features
- Loads worldgen from a datapack directory or
.zip, layered over vanilla data - Density functions JIT-compiled to native code with Cranelift
- Biomes, noise, surface rules, carvers, features, and structures
- Overworld, nether, and end, plus datapack-defined dimensions
- Parallel chunk generation on a Rayon pool
- World presets (e.g. amplified, large biomes)
Installation
This crate requires a nightly toolchain, since it uses portable_simd and several const trait features. The pinned version is in rust-toolchain.toml.
[]
= "0.2.0"
Usage
use ;
let worldgen = new
.with_seed
.build
.expect;
let top = worldgen
.generate
.expect;
generate takes a closure rather than returning the chunk, so the chunk data is read under the store's lock and never copied out wholesale. ChunkView exposes block and biome lookups, the dimension's min_y and height, and iterators over both.
To use a custom datapack, layer it over the built-in one:
use ;
let datapack = zip
.expect
.layered_over;
let worldgen = new
.with_seed
.with_datapack
.build
.expect;
Examples
The examples use shulkr to start a real server you can join.
|
There are also examples for every world preset:
Roadmap
- Structure starts and references
- Biomes
- Noise
- Surface rules
- Carvers
- Features
- Datapack loading (directory and
.zip, layered) - JIT-compiled density functions
- Structures, including jigsaw assembly
- Overworld, nether, and end, plus datapack-defined dimensions
- Parallel chunk generation
- Lighting
- Loot tables
- Entity spawning
- Performance improvements
License
This project is licensed under Apache-2.0.