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 three modules in java-client:
- the
nativemodule packages the AGPL-3.0steel-providerexecutable, - the
bridgemodule is a standalone Apache-2.0 client library that connects to the steel-provider server, and - the
minestommodule adapts it into a Minestom world generator.bridgedepends onnativeat runtime so the embedded server works out of the box.
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 slower than a regular SteelMC server. steel-provider itself (the Rust side of this project) reaches almost the same throughput as standalone SteelMC when it is given enough concurrent requests. However, when using it from Minestom, the networking and conversion come with a performance penalty.
On my ThinkPad P1 Gen 6 laptop with an Intel Core i7-13800H (20 logical CPU cores), I can generate:
- Steel: 908 chunks/second
- Fabric: 86 chunks/second
- steel-provider (my Steel wrapper): 854 chunks/second
- steel-provider + Minestom world generator wrapper: 494 chunks/second
Reproduce the benchmarks yourself using mise run bench. It takes me about 10 minutes to run all 3 trials.
The Rust portion of this project was written with a lot of AI assistance.