Launcher
The launcher is the smallest complete Minekube game, and the one every other example follows. A sign stands next to spawn. A player who right-clicks it flies into the air, hears a firework and sees Launch #<count>.
Source: examples/launcher.
What it shows
Section titled “What it shows”- Rules without a server.
src/Launcher.tsimports no Java. It defines theLaunchercomponent: a model with the launches per player, two messages (Joined,ClickedSign) and three Commands (PlaceSign,Greet,Launch). - The server half.
src/game.tsturns Paper’s join and interact events into messages withPaper.event, and implements each Command with Paper calls, typed from the server jar. - Tests in Bun.
src/Launcher.test.tstests the rules withStory, explores every order of messages withStory.explore, and replaysrecordings/through today’s rules.join-and-launch-twice.ndjson - A bot player.
client/LauncherBot.tsis a component for a real Minecraft client: find the sign, walk to it, right-click it, and note how high the launch went.client/bot.tsbinds it to the client. - End to end.
launcher.e2e.tsstarts a client in the Minekube daemon, joins the dev server, and reads both sides from their recordings.
Run it
Section titled “Run it”From the repository:
mk servermk dev examples/launcherJoin localhost in Minecraft and right-click the sign. bun test examples/ runs the rules, the replay and the bot’s Story. bun run test:e2e runs the end-to-end test, which needs the dev server and Java 25 for the client.
Read next
Section titled “Read next”- Build your first game builds a game of the same shape step by step.
- Test with bot clients explains the bot.
Was this helpful?
Thanks for the feedback.