Core concepts
Versions
ghast speaks 1.8.9, 1.12.2, 1.16.5, 26.1, 26.2 and 26.3 behind one bot API. This page shows how a version is chosen, what the shared API covers, where versions genuinely differ and how the API tells you, and which cargo feature builds each version.
The versions
| Game versions | Protocol | GameVersion | Cargo feature |
|---|---|---|---|
| 1.8 – 1.8.9 | 47 | V1_8_9 | v1_8 |
| 1.12.1 | 338 | V1_12_1 | v1_12_2 |
| 1.12.2 | 340 | V1_12_2 | v1_12_2 |
| 1.16.2 | 751 | V1_16_2 | v1_16_5 |
| 1.16.3 | 753 | V1_16_3 | v1_16_5 |
| 1.16.4 – 1.16.5 | 754 | V1_16_5 | v1_16_5 |
| 26.1, 26.1.1, 26.1.2 | 775 | V26_1 | v26_1 |
| 26.2 | 776 | V26_2 | v26_2 |
| 26.3 | 777 | V26_3 | v26_3 |
Versions that share a protocol number are served by the same code: 26.1, 26.1.1 and 26.1.2 are one protocol (775) and give identical oracle records, so they are one row. 1.12.1, 1.16.2 and 1.16.3 are sub-versions: they run the code of 1.12.2 or 1.16.5 with their own protocol number (and, for 1.12.1, its VarInt keep-alive ids), and they come with that row's feature.
Every version feature is on by default. To build fewer, see Installation.
Choosing a version at connect time
You name the version when you build the Client. ghast does not ask the server which version it
runs, so the value must match the server. GameVersion parses from a game version or a protocol
number: "1.8" through "1.8.9" and "47", "1.12.1", "1.12.2", "1.16.2" through
"1.16.5", "26.1", "26.1.1", "26.1.2", "26.2", "26.3", and "338", "340", "751",
"753", "754", "775", "776", "777".
use ;
;
async
GameVersion::ALL lists every supported version, oldest first. enabled() says whether this
build includes a version. A version whose feature is off still exists, and running it returns
ClientError::VersionNotEnabled.
GameVersion is #[non_exhaustive], and new Minecraft versions arrive as new variants in patch
releases. Give every match on it a _ arm.
What one API covers
When run starts, it matches the version once and runs a session compiled for that version.
The engine and your behaviour are version-free: behaviours never see packets or versions unless
they ask. One Behavior therefore runs on every version without changes, including:
- the tick loop,
Controls,set_aimand the movement physics of each version; - chat, respawn, slot selection, digging, placing, using items and attacking, with each version's rules (1.8 and 1.9+ combat, for example) applied for you;
- inventory windows and clicks with each version's click prediction;
- entity tracking, the HUD, signs, books and fishing, where the version has them.
The ext helpers go one step further: item and block names and ids follow the connection's
version, 26.x included.
Where versions differ
Some differences are real game differences, and the API exposes them instead of hiding them.
The capability row. GameVersion::caps() (or ctx.version().caps()) returns the
version's Capabilities: protocol number, eye heights, the chat limit, whether 1.9 combat
applies, whether a configuration state exists, and more. The client core reads this row instead
of comparing version numbers, and so can you.
Values that change meaning. A few readers return version-specific values:
world().raw_blockreturns the version's raw block state id (the 1.8id << 4 | meta, or the global palette id on later versions); decode it withghast::data.world().build_height()isNonefor the fixed 0 to 256 worlds of 1.8.9 to 1.16.5 and gives the dimension's height on 26.x.dimension()is a number as text ("0","-1","1") on 1.8.9 and 1.12.2, and the world name on 1.16.5 and 26.x.chattruncates to the version's limit (100 UTF-16 units on 1.8, 256 on 1.16).
Features a version does not have. Some groups only exist on some versions:
| Feature | Versions |
|---|---|
boss bars (Interests::HUD) | 1.9+ (not 1.8.9) |
| item cooldowns | 1.12.2, 1.16.5, 26.x |
server dialogs (Interests::DIALOGS) | 26.1+ |
server recipes and tags (Interests::RECIPES) | 1.16.5 only; other versions need none |
| configuration state, server transfers | 26.x |
shared chunk store (Client::shared_chunks) | 26.x; older versions ignore it |
bot screen (ghast-viewer) | 1.8.9 and 26.x |
On 26.3, which has no serverbound swing packet, swing sends punch instead.
Raw packets. Behavior::raw_packets takes the GameVersion, because packet ids differ by
version. Decode the copies with the version's module under ghast::protocol (for example
ghast::protocol::v1_8).
The full table of what is verified on which version is in the root README, and how each version is checked against vanilla is in Accuracy.