Skip to content
Get started

Launcher

View as Markdown

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.

  • Rules without a server. src/Launcher.ts imports no Java. It defines the Launcher component: a model with the launches per player, two messages (Joined, ClickedSign) and three Commands (PlaceSign, Greet, Launch).
  • The server half. src/game.ts turns Paper’s join and interact events into messages with Game.event, and implements each Command with Paper calls, typed from the server jar.
  • Tests in Bun. src/Launcher.test.ts tests the rules with Story, explores every order of messages with Story.explore, and replays recordings/join-and-launch-twice.ndjson through today’s rules.
  • A bot player. client/LauncherBot.ts is 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.ts binds it to the client.
  • End to end. launcher.e2e.ts starts a client in the Minekube daemon, joins the dev server, and reads both sides from their recordings.

From the repository:

Terminal window
mk server
mk dev examples/launcher

Join localhost in Minecraft and right-click the sign. bun test examples/launcher 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.

Was this helpful?