Game registry
GameRegistry is the static registry mods call from onInitialize to wire their game into the engine. On register, the registry constructs a HubZone from the game’s LobbyConfig and hands it to HubManager so the existing arc-layout code builds the pad automatically; the /conduit join <id> subcommand picks up the new id; and engine events flow into the game’s GameHooks as instances are acquired.
When to use it
Section titled “When to use it”- You’re registering a new game from your
ModInitializer. - You’re looking up a registered game by id (e.g. from a command handler).
- You’re iterating over every registered game for a UI list.
package me.zlex.conduit.game;
public final class GameRegistry { public static void register(Game game);
public static Game get(String id); public static boolean has(String id); public static Map<String, Game> all();
public static void markHubBuilt(); // called by the engine on SERVER_STARTED}Registration must happen before SERVER_STARTED. Late calls log a warning via ConduitLog.HUB_MANAGER and are still recorded, but the pad won’t appear until the next restart. Duplicate ids throw IllegalStateException.
Example
Section titled “Example”import me.zlex.conduit.game.Game;import me.zlex.conduit.game.GameKind;import me.zlex.conduit.game.GameRegistry;import me.zlex.conduit.game.LobbyConfig;import net.fabricmc.api.ModInitializer;import net.minecraft.world.item.Items;
public final class MyMod implements ModInitializer {
@Override public void onInitialize() { GameRegistry.register(Game.builder("my-game", "My Game") .accent(0xFF55FF55) .kind(GameKind.MULTI_LOBBY) .lobby(LobbyConfig.defaults("MY GAME") .withMaxPlayers(8) .withPad(Items.GRASS_BLOCK) .withType("Party")) .build()); }}To enumerate every registered game:
for (var entry : GameRegistry.all().entrySet()) { System.out.println(entry.getKey() + " — " + entry.getValue().displayName().getString());}registeris the single entry point. Don’t reach into the underlying map directly.markHubBuiltis engine-internal — it flips the “warn on late registration” flag. Don’t call it from your mod.- The map returned by
all()is unmodifiable. Treat it as read-only.