World template
WorldTemplate is a sealed interface describing what kind of world an instance slot should contain. Three variants: Void (void biome, empty), Flat (bedrock + dirt + grass, plains), Overworld (full terrain generation with a seed). All use the overworld dimension type — same sky, lighting, and biome layout — but differ in what the chunk generator produces.
When to use it
Section titled “When to use it”- You’re calling
InstanceManager.acquire(server, template)and need to pick what kind of world to create. - You want a void world to populate from a prefab.
- You want a real overworld with a deterministic seed for a “race-to-find-X” mode.
package me.zlex.conduit.instance;
public sealed interface WorldTemplate permits WorldTemplate.Void, WorldTemplate.Flat, WorldTemplate.Overworld {
record Void() implements WorldTemplate {} record Flat() implements WorldTemplate {} record Overworld(long seed) implements WorldTemplate {}
WorldTemplate VOID = new Void(); WorldTemplate FLAT = new Flat();
static WorldTemplate overworld(); // random seed static WorldTemplate overworld(long seed); // explicit seed
String typeKey(); // "void" | "flat" | "overworld" — used by InstanceManager when persisting slot state long seed(); // only meaningful for Overworld
static WorldTemplate fromKey(String key, long seed);}Example
Section titled “Example”import me.zlex.conduit.instance.InstanceManager;import me.zlex.conduit.instance.WorldTemplate;
public final class TemplatePicker {
public static WorldTemplate forGame(String gameId) { return switch (gameId) { case "arena-game" -> WorldTemplate.VOID; case "sprint-race" -> WorldTemplate.FLAT; case "random-overworld" -> WorldTemplate.overworld(); // surprise me case "seeded-overworld" -> WorldTemplate.overworld(42L); // deterministic default -> throw new IllegalArgumentException("unknown: " + gameId); }; }
public static var acquire(net.minecraft.server.MinecraftServer server) { return InstanceManager.acquire(server, WorldTemplate.VOID); }}- The
typeKeystrings are stable and used when persisting slot state to disk — don’t rename them. WorldTemplate.VOIDandWorldTemplate.FLATare singletons.Overworldis parameterised by seed.- For void worlds, populate from a prefab via
Scene.instantiateright afteracquire.