Uses SteelMC as a library to implement vanilla Minecraft world generation in a Minestom world generator.
* The Java libraries in this repo are Apache-2.0, but SteelMC itself is licensed under the AGPLv3 license. See LICENSE.md for more details.
steel-provider/src/lib.rs contains some functions that interact with SteelMC to bring chunks through the full generation process outside of a normal server environment. Those functions are compiled into a standalone executable (steel-provider/src/main.rs), which acts as a "dumb" server that exclusively handles chunk generation.
The Java side is split into two modules in java-client: the bridge module is a standalone client library that connects to the steel-provider server, and the minestom module adapts it into a Minestom world generator. Each Generator#generate() call sends a small packet with the seed and chunk coordinates and then reads a response containing the generated chunk's sections in Minecraft's own network format.
The server can be used standalone. Currently, only a Java client exists, but other clients could easily be made as long as they understand how to decode the data structures in Minecraft's chunk data packet. For more details on the protocol, see steel-provider/PROTOCOL.md.
repositories {
maven(url = "https://reposilite.bluedragonmc.com/releases")
}
dependencies {
implementation("com.bluedragonmc:steelworldgen-minestom:$VERSION")
}If you only need to talk to a steel-provider server without Minestom, depend on com.bluedragonmc:steelworldgen-bridge instead.
long seed = 42L;
Instance overworld = MinecraftServer.getInstanceManager().createInstanceContainer();
overworld.setGenerator(SteelWorldGenProvider.getGenerator(42L));
overworld.setChunkSupplier(LightingChunk::new);
Instance nether = MinecraftServer.getInstanceManager().createInstanceContainer(DimensionType.THE_NETHER);
nether.setGenerator(SteelWorldGenProvider.getGenerator(seed, Dimension.NETHER));
nether.setChunkSupplier(LightingChunk::new);
Instance theEnd = MinecraftServer.getInstanceManager().createInstanceContainer(DimensionType.THE_END);
theEnd.setGenerator(SteelWorldGenProvider.getGenerator(seed, Dimension.THE_END));
theEnd.setChunkSupplier(LightingChunk::new);For a full example, see the java-client/demo directory. You can run the demo locally with mise run demo.
You'll probably want to use the --release flag (mise run demo --release).
Chunk generation gets MUCH faster at the expense of a longer compilation time.
-
Install
miseWe use
miseto manage tools (like Java and Gradle) and to define tasks like you would in a Makefile. It's configured inmise.toml. -
Run
mise run buildFor a release (optimized) build, use
mise run build --release.By default the Rust binary is built natively with
cargo build. To instead cross-compile a fully static binary usingcargo-zigbuild, pass--static(mise run build --release --static).The Java library will be built to
java-client/minestom/build/libs/minestom-dev.jar. If you want to publish it to a Maven repository, modify the hostname in java-client/minestom/build.gradle.kts and runmise run publish(ormise run publishToMavenLocalto rungradle publishToMavenLocal).
This project generates chunks much faster than vanilla Minecraft, but much slower than SteelMC. steel-provider itself (the Rust side of this project) is slower than standalone Steel because it needs to account for a different access pattern (Steel knows the entire set of chunks that need to be generated at once, while Minestom world generators only receive requests one chunk at a time). Then, when using it from Minestom, the networking and conversion add an additional performance penalty.
On my machine, I can generate:
- Steel: 877 chunks/second
- Fabric: 76 chunks/second
- steel-provider (my Steel wrapper): 465 chunks/second
- steel-provider + Minestom world generator wrapper: 215 chunks/second
Most of this difference seems to be that Steel is better than steel-provider at spreading work across more available CPU cores.
Reproduce the benchmarks yourself using mise run bench. It takes me about 12 minutes to run all 3 trials.
The Rust portion of this project was written with a lot of AI assistance.