# Launcher

> The reference game - a sign next to spawn that launches every player who right-clicks it into the air - with its rules in a component, Stories, a replayed recording and a bot client that plays it end to end.

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`](https://github.com/minekube/minekube/tree/main/examples/launcher).

## What it shows

- **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.

## Run it

From the repository:

```sh
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.

## Read next

- [Build your first game](https://minekube.com/games/get-started/first-game) builds a game of the same shape step by step.
- [Test with bot clients](https://minekube.com/games/testing/bots) explains the bot.
