ghast-client 0.5.6

Headless Minecraft Java Edition client for the ghast library: connection, login, fixed 50 ms tick loop and a version-agnostic bot API (1.8.9, 1.12.2, 1.16.5, 26.1, 26.2 and 26.3)
Documentation

ghast-client

Headless Minecraft Java Edition client for the ghast library: connection, login, the fixed 50 ms tick loop and a version-agnostic bot API. Supports 1.8.9 (protocol 47), 1.12.2 (protocol 340), 1.16.5 (protocol 754), 26.1 – 26.1.2 (protocol 775), 26.2 (protocol 776) and 26.3 (protocol 777), plus the sub-versions 1.12.1 (338), 1.16.2 (751) and 1.16.3 (753), which run the 1.12.2 / 1.16.5 code with their own protocol number (and 1.12.1's VarInt keep-alive ids). Each version is a cargo feature (v1_8, v1_12_2, v1_16_5, v26_1, v26_2, v26_3; default: all; a sub-version comes with its row's feature) and builds alone; what a version can do is its version::Capabilities row (GameVersion::caps()), which the core reads instead of comparing version numbers.

use ghast_client::connect::{Connector, ProxyPolicy};
use ghast_client::{Account, Behavior, Client, GameVersion, Interests, TickContext};

struct Afk;
impl Behavior for Afk {
    fn interests(&self) -> Interests { Interests::CHAT }
    fn tick(&mut self, ctx: &mut TickContext<'_>) {
        for m in &ctx.events().chat { println!("{}", m.plain()); }
        if ctx.is_dead() { ctx.respawn(); }
    }
}

# async fn run() -> Result<(), Box<dyn std::error::Error>> {
let connector = Connector::new()
    .with_proxy("socks5h://user:pass@proxy:1080".parse()?)
    .with_policy(ProxyPolicy::RequireProxyExceptLocal);
let client = Client::new("mc.example.net:25565".parse()?, GameVersion::V1_8_9, Account::offline("Bot")?)
    .connector(connector);
let end = client.run(&mut Afk).await?; // Kicked / ServerClosed / Quit / Shutdown
# Ok(()) }

Examples (facade crate): cargo run -p ghast --release --example afk -- --host … --port … --username … --version 1.8.9|1.12.2|1.16.5 [--proxy socks5h://…] [--minutes N] [--reconnect], and --example chat (stdin lines → chat).

Layers

module what
client Client (config + run / run_until), connect → handshake → login → play loop
version ClientVersion (sealed) for V1_8 / V1_12_2 / V1_16_5: login and play packet mapping, packet filter, teleport rules, chat limit
common version-agnostic Inbound / Outbound packets and the API types (Pose, Controls, ChatMessage, …)
engine the deterministic core (no I/O, no clock): state, Behavior, TickContext, the tick
sim per version: the ghast-world chunk store + the mover (ghast-physics per version); WorldView for behaviours
movement vanilla movement-packet choice (MovementSender) and a stand-still mover (no longer used by the client; kept for tools)
hands dig / place / use / attack state machine for every version (1.8 and 1.9+ rules), crosshair input
dialog server dialogs (26.1+): decoded model, answers as the vanilla client sends them
hud the HUD (Interests::HUD): boss bars, title / subtitle / action bar with the vanilla countdown, tab list header and footer; tab-completion answers
sign the sign editor: open / close events, the lines as the vanilla screen filters and sends them
book book and quill edits (Done / Sign) as the vanilla book screen sends them, with its stack prediction
record movement recorder in the oracle's replay format (Client::record)
rotation whole-mouse-count rotation (sensitivity GCD, Java float maths)
interest Interests: optional packet groups a behaviour opts into

Dispatch is compile-time: Client::run matches the run-time GameVersion once and runs a session monomorphised for that version (a sub-version runs its row's instance with its own capability row); the engine and the behaviour are version-free.

Tick model (1.8.9 MinecraftClient.tick)

  1. Inbound packets are applied on arrival (like vanilla's per-frame task queue, which runs before each tick). Keep-alives, teleports (1.16: teleport_confirm + position_look; 1.8: position_look, on_ground = false) and window confirms (transaction for window 0 or the open window, when not accepted) are answered at once. Before a tick the loop also drains whatever the socket already holds.
  2. Behavior::tick(ctx) (start first on the first tick; not called again once Behavior::running() is false). Actions (chat, select_slot, place, dig, attack, clicks, swing, respawn) are written in call order before this tick's movement packet; set_aim / set_controls / set_buttons / set_flying only record intent.
  3. Rotation step (vanilla's frame-time turn; only on ticks the behaviour aimed; held back for one tick when it would take the crosshair off a block the behaviour dug or placed this tick, see below) → held-slot sync (ClientPlayerInteractionManager.tick) → key processing (hands: held buttons and queued presses, picking with the turned look) → set_flying's abilities → movement step → sprint entity_action → sneak entity_action → exactly one of flying / position / look / position_look (moved > 0.03, or the position refresh: 1.8 checks ticksSinceLastPositionPacketSent >= 20 before incrementing it — every 21st tick — while 1.9+ increments first — every 20th tick; Grim's BadPacketsE flags a 21-tick gap on 1.16.5). ctx.sent() is the pose the server has.

The behaviour only runs once the player has its first server position and its chunk column is loaded (1.16 vanilla does not tick the player outside a loaded column; on 1.8 we wait as well). Nothing is sent before the first position packet.

The tick schedule is a tokio interval with MissedTickBehavior::Skip: after a stall the missed ticks are skipped, never caught up (a burst of movement packets trips timer checks).

Silent-server guard: after silent_hold (1.5 s) without inbound bytes the behaviour is frozen (keys released, events kept) while the vanilla movement packet continues; it resumes when data arrives. After read_timeout (30 s, vanilla's) the session fails with ClientError::Timeout.

Robustness: decoding never panics (ghast-protocol); a packet the core needs that does not decode ends the session with ClientError::Decode (vanilla disconnects too); malformed chunk data (e.g. a section mask the data does not cover) only drops that column, is logged (rate-limited) and play goes on, as vanilla's task runner does — GHAST_DUMP_BAD_CHUNK=<dir> writes the first rejected bodies there for a bug report; a behaviour panic is caught, the behaviour is stopped and the player keeps standing; sessions share no state, the session future is Send for Send behaviours, so many bots can run on one multi-threaded runtime or one bot per process on a current_thread runtime (examples).

Modern versions: one implementation, one row per version

The modern client (26.1 and later) is written once: src/version/modern.rs (the wire layer: login, configuration, play packets, chat signing, command trees) and src/sim/modern/ (world, movement, vehicles, entities, digging) are mounted once per version by a small row module (version/v26_x.rs, sim/v26_x.rs) that names the version's protocol, data, world, entity, inventory and physics modules and its few true facts (entity data indices, effect ids, the team packet layout, the play login's online-mode flag). Each version gets its own monomorphised copy: no run-time version branches. Ids that versions renumber (entity types, attributes, items, command parsers) are resolved by name. The engine replays of the oracle goldens (src/engine/tests/modern.rs) run for every modern version. Adding a version: see CONTRIBUTING.md ("Adding a modern version").

26.3 (protocol 777)

26.3 is the 26.2 row with its own modules and the V26_3 physics rules. Client-visible deltas: the teleport confirm carries the pose and no position packet follows it; the movement packet is sent after the other entities and moving blocks ticked; there is no serverbound swing (punch replaces the swing packet); held digs use the new CHANGE_DESTROY_DIRECTION action. Proven (2026-11-27): the 26.3 engine replays (pistons 206 cases, boats, minecarts, entities, border, nether, elytra, riptide, restitution, place) are 0 diffs, and a held-dig oracle for 26.1 / 26.2 / 26.3 (≈ 265 cases, ≈ 14,900 ticks, ≈ 39,000 packets per version) replays through the engine at 0 diffs: the dig packet rules on all three, including CHANGE_DESTROY_DIRECTION, the teleport that aborts a dig and punch instead of the swing. Also on 26.3: a live menu session (80 clicks incl. the furnace and brewing stand slot rules, none corrected by the server), the dialog answers (identical to 26.2), the nether, the end and a data-pack dimension with its own height (12,079 block probes, a tour through them ending at the server's position at every stop, a death in the nether and the respawn in the overworld), online-mode login against the local stand-in, proxy reconfiguration (Velocity 4.3.1) and server transfers. Not shown on 26.3: force_step_position making a difference (the sub-threshold landing it exists for did not occur in 80 attempts).

26.2 (protocol 776)

26.2 is the 26.1 row with its own modules. True deltas: the play login's onlineMode decides whether a chat session starts (26.1: an encrypted connection); the team parameter order (display name, prefix, suffix, visibility, collision rule, optional colour, options); 40 renumbered attributes, three of them new for movement (bounciness, friction_modifier, air_drag_modifier: fed to the physics, the extended tick runs while any is not at its default); collision restitution in the physics (V26_2: slime and bed bounces, signed zeros). The login's session id is telemetry in the vanilla client and is not used; spectator_action is never sent. Proven: every 26.1 engine replay also runs on tests/golden/26.2/ (joins, teleports, elytra, riptide, entities, border, nether, boats, minecarts, item use, entity pick, player_loaded, signed chat, login encryption) plus the idle slime / bed drop scenarios (8500 ticks to the end of the bounce tail), packet for packet.

26.1 (protocol 775)

Read from the decompiled 26.1 client (Minecraft.tick, LocalPlayer.tick / sendPosition, ClientPacketListener, ClientConfigurationPacketListenerImpl, MultiPlayerGameMode):

  • Login → configuration → play. After login_success the client sends login_acknowledged, its brand and client information (in the configuration state, not on join), answers keep-alives and pings, selects the server's minecraft packs of the 775 family as known (core and the feature packs; the server then sends vanilla registry entries without data), keeps the registries the world needs (dimension types with their height, biome count; chat types and enchantment names for the wire layer), answers cookie requests (stored cookies or none), accepts the code of conduct, reports optional resource packs declined and required ones accepted + loaded (Client::accept_required_resource_packs, nothing is downloaded), and enters play on finish_configuration.
  • Reconfiguration (start_configuration in play, e.g. a proxy switching backends): like handleConfigurationStart, the pending chat acknowledgement goes out first, then configuration_acknowledged; the level is dropped (world columns, tracked entities, the player; cookies stay), the configuration state runs again with the new server's registries (a different dimension height takes effect with the next join), no ticks meanwhile.
  • Transfers (transfer, configuration or play state): the session ends with SessionEnd::Transferred { host, port }; with Client::follow_transfers(true) the client logs in to the target with the transfer intent and the stored cookies inside the same run (the behaviour stops and starts again; at most 8 in a row).
  • Online mode: encryption (also shouldAuthenticate = false: no session join, any account) and the session-server join with Account::Microsoft; the services' URLs are ghast_auth::microsoft::Endpoints (a local stand-in for tests: Endpoints::with_base_url).
  • Signed chat (encrypted connections, Client::signed_chat, default on): the profile key pair is fetched once per Client (player/certificates, refreshed when due; or given with Client::profile_keys), each join starts a chat session (random id) announced with chat_session_update from the connection tick, and chat messages and the minecraft:message arguments of commands are signed (SHA256withRSA over the 26.1 signed body: link, salt, timestamp, content, last-seen signatures). Which commands are signed comes from a Brigadier-style parse over the server's declare_commands tree (kept raw, parsed only when a command is sent): selectors need permission level 2, arguments behind a redirect to the root (execute … run say) are not signed; such commands go out as chat_command_signed (without signatures when there is no chat session), the rest as chat_command. Offline connections do no signing work.
  • Tick order (one client tick): held slot sync → player_loaded (once per level, from the connection tick inside gameMode.tick) → key handling: dig / place / use / attack, written immediately → LocalPlayer.tick: abilities (flight toggle), player_input when the keys changed, sprint player_command, the movement packet (on_ground and horizontal_collision flags; squared threshold 2e-4, a position at least every 20 ticks) → tick_end. So the server still judges a tick's actions with the previous tick's sent pose.
  • Level loading (ghast_physics::modern::LoadGate, proven on the oracle's tests/golden/26.1/joins.jsonl.gz, which the engine replays packet for packet). The player does not tick until the level is loaded: after the server's LEVEL_CHUNKS_LOAD_START game event, once the player's section is "compiled" (spectators, dead players and feet outside the build height at once; after 30 s anyway). Until then each tick sends only tick_end (position packets are still answered; only the entity tick counter runs). Vanilla compiles the player's section once its column and the eight around it are loaded (RenderSection.hasAllNeighbors), in a frame after that tick, so the engine's "compiled" signal is the nine columns loaded on two consecutive ticks. The gate tick sends player_loaded, the first movement packet (position/look, on-ground false, no mouse turn on that tick) and tick_end. Opening the gate earlier (on the player's own column) drew Grim Simulation + GroundSpoof flags when the saved position floated above the ground (lab/airborne-join.sh). A respawn starts over (with the respawn packet's kept data: attributes, last input and sprint state).
  • Wire layer (Wire26_1, per connection): block action sequence numbers (start and finish digging, use_item_on, use_item take a new one; abort and release send 0; reset per level), use_item with the current look, chat with the last-seen acknowledgement state (offset, 20-bit set, checksum; message_acknowledgement after 64 pending signed messages), the chat session and command tree above, the permission level (entity events 24–28), cookies, chunk batch answers with vanilla's chunks-per-tick estimate.
  • Item use: the use state, food gating and the movement slowdown come from the used stack's components (ghast_inventory::v26_1::item_use: duration, use_effects, food); the server's entity event 9 completes a use (the client never does it itself); clicks that drop a stack send their swings first.
  • Minecarts (26.1): seated by the server's set_passengers; the cart moves as the server says, the player sits on it (vehicle() reports it with controlled: false). Mounts not listed below (llamas, ravagers) are not simulated: the client keeps its walking physics while on one.
  • Boats (26.1): boarded when the server's set_passengers names the player (right-click a boat with the crosshair on it, or /ride); TickContext::vehicle / is_riding. While riding, the movement keys paddle (the client moves the boat, as vanilla); sneak to get off. The own boat needs no entity tracking; collisions with other boats and mobs need Interests::ENTITIES. Behind another passenger (26.x, the seat from set_passengers) the player does not steer: the boat is where the tracker's interpolation of the server's moves has it, the player's look stays clamped to 105 degrees of it, only player_input and look are sent; when the one in front leaves, the player steers from where the boat is (and back).
  • Horses (26.x: horse, donkey, mule, skeleton and zombie horse): boarded by the server's set_passengers; saddled (entity_equipment; a donkey or mule also tame, entity data) the client moves it with the movement keys, the jump key charges the jump bar (start_riding_jump on release), vehicle_move every tick, the server's move_vehicle answered at once; its update_attributes (speed, jump strength, step height, gravity) apply. Unsaddled the server moves it. No entity tracking needed.
  • Pigs, striders and camels (26.x): a saddled pig or strider is steered while either hand holds a carrot / warped fungus on a stick (the engine's inventory, each tick); its boost comes from the server's boost-time entity data (send the stick's use_item and the server boosts it). A saddled camel or camel husk rides like a horse: the jump bar dashes (55 ticks of cooldown, from the DASH entity data too), sprint works on it, and the server's sitting (pose and pose change tick entity data, against the game time from set_time) stops it until the forward key stands it up. Oracle-proven through the engine, with and without entity tracking. A camel seats two (26.x): behind someone the player does not steer (the server moves it, the client follows the tracker's interpolation); when the one in front leaves, the player steers it from where it is, and back. A camel's or nautilus' dash cooldown started by the server's DASH before the boarding keeps running until then (the client runs it on at the boarding). Not modelled: a boost that ticked on a pig or strider the client has forgotten (re-boarding after its parked copy is gone restarts it), the motion of an unridden mount at the boarding (at rest). Boarding or taking the reins of a mount or boat the server is still moving runs the rest of its interpolation as vanilla does (its vehicle_move carries the interpolation's target meanwhile). Without Interests::ENTITIES the other passengers are unknown: on 26.3 a boat behind a mob or an armor stand shows its paddles as if a player paddled (animation only).
  • Happy ghasts and nautili (26.x): a happy ghast with a harness (entity_equipment, body slot) flies with the movement keys along the look, the jump key rises; the server's STAYS_STILL entity data (a player on top, a rider just off) hands it to the server. The player's seat follows its index in set_passengers: as a second, third or fourth passenger it sits on that seat and does not steer. With Interests::ENTITIES an unridden adult happy ghast is solid to stand on (feet at or above its top, or while kept still). A tame (set_entity_data) and saddled nautilus or zombie nautilus swims with the movement keys along the look; the jump bar dashes (40 ticks of cooldown, from the server's DASH entity data too). Oracle-proven through the engine, with and without entity tracking. Not modelled: the dash cooldown of a nautilus boarded within 40 ticks of a server dash flag, a happy ghast's collision with other ghasts.
  • Elytra and riptide (ghast_physics::modern::PlayerExt): glide starts on a jump press in the air with a glider equipped (TickContext::start_gliding, is_gliding), the server's own shared and living entity flags, firework rockets attached to the player and riptide launches are applied as the real client does; the own-entity packets are decoded only for the player's id, attached rockets and mounts (no entity tracking needed). use_item carries the rotation of the tick's movement packet. Riptide in rain needs the biome to rain at the feet or head block (Level.isRainingAt): biomes are kept from the first time a riptide trident is held (columns that arrived before count as raining until the server resends them); turn on WorldConfig::biomes with Client::world_config to have them from the start. Sky light is not modelled (the column above must be free of motion-blocking blocks and fluids).
  • Physics is ghast_physics::modern (V26_1), fed every movement attribute in packet order, effects (weaving too), abilities, teleports with all nine relative bits and their delta, LpVec3 motion, explosions, server rotations (answered with a look packet), leather boots. Digging uses ghast_data::v26_1::dig (oracle-verified) with the server's mining_efficiency, block_break_speed and submerged_mining_speed attributes. The crosshair is the oracle-verified 26.1 pick (blocks and the tracked entities).
  • Entities (opt-in, Interests::ENTITIES): ghast_entity::v26_1::Tracker gets every packet it wants (also the map_chunk / unload_chunk the world reads) and ticks once per client tick after the pick (interpolation, with the block / border collision test); entities(), target_entity() and attack() work as on the older versions. With it the player also collides with boats, rafts and shulkers and is pushed by the mobs and boats around it, as the real client does. Without Interests::ENTITIES neither happens: a bot that walks into a boat or through a crowd then moves differently from a vanilla client (an anticheat can flag it); turn the interest on where that can happen. Team collision rules (never, pushOtherTeams, pushOwnTeam) are followed; other players' teams need Interests::PLAYER_LIST (unit- and lab-tested, not oracle-proven). Pushes follow the client's entity tick order. An unridden adult happy ghast collides as the real client decides it (the player's feet at or above its top at the start of its tick, or kept still). Not modelled: open or scaled shulkers (the closed shell is used).
  • Chat arrives as NBT components: system chat, player chat (rendered with the vanilla pattern of its chat type: <name> message, whispers, /say, /me) and disguised chat.
  • Proven against the real 26.1 client (oracle vectors, cargo test): tests/golden/26.1/chat_signing.jsonl.gz — chat_session_update, signed and unsigned chat_message, chat_command / chat_command_signed (which arguments are signed, the signatures, the bytes) and acknowledgements, byte-identical; net_crypto.jsonl.gz — session hash, the hello packet, the key packet both ways, AES/CFB8 both directions.
  • Not yet on 26.x: incoming signed messages are not verified (a message vanilla would reject as invalid still enters the last-seen list), WorldView::column (the 26.1 column type differs). Not verifiable without a real account: the real services' responses (player/certificates format and key sizes as documented, join errors) — the lab uses a local stand-in that follows authlib's parsing.

Packet filter

The play-state filter is built per version from the core's needs plus the behaviour's Interests (re-read every tick). Everything else — tab list, teams, scoreboards, particles, sounds, entities, time, recipes, tags, commands — is dropped by the frame decoder before it is decoded (after inflating only the id when compressed).

Core set: keep_alive, login, update_health, respawn, position, held_item_slot, game_state_change, open/close window, transaction, abilities, kick_disconnect, the world (ghast_world::v1_*::PACKET_IDS: chunks, block changes, explosion, world border; 1.8 map_chunk_bulk; 1.16 unload_chunk, update_view_position / distance), entity_velocity (1.8 knockback), set_compression (1.8 play), combat_event (1.16 immediate respawn), experience (the anvil's level check), the tab-completion answer (it only follows a request). Interests::CHAT adds chat; Interests::HUD adds the boss bar, title (26.x: the title, subtitle, times, clear and action bar packets), tab list header / footer and the chat that carries action bar messages. Villager offers (1.8 / 1.12 custom_payload, of which only MC|TrList is decoded — the channel name is checked first; 1.16.5 trade_list) pass only while a merchant window is open: the filter is rebuilt right after the open_window, so the offers behind it in the same read are seen. Interests::RECIPES (1.16.5) adds declare_recipes and tags, which the inventory needs for crafting remainders, the furnace (shift-click, fuel slot), the beacon payment slot, llama carpets, the smithing table and the stonecutter; without it those clicks are refused (ClickError::Unpredictable), never guessed. The server sends them once at join, so set it from the start. Interests::BLOCK_UPDATES copies the block changes the world applies into TickEvents::block_updates (position, raw state; at most 4096 between two behaviour ticks, the rest counted in block_updates_dropped) — no extra packets, only the copy.

Raw tap: Behavior::raw_packets(version) names extra clientbound play packet ids; each such frame — also one the core consumes itself (position, held slot, abilities, …) — is copied undecoded (Bytes clone) into TickEvents::raw (RawInbound { id, body, at }, arrival order, kept while the behaviour is on hold, at most 4096 per tick, the rest counted in raw_dropped). The core's own handling does not change; a tapped id the core handles optionally (chat) is then handled too. Read every tick; a change rebuilds the filter.

Vanilla details reproduced

  • Join: settings then the brand plugin message (MC|Brand / minecraft:brand, vanilla).
  • Teleport: relative flags; absolute axes zero that motion; 1.8 yaw % 360, pitch % 360; 1.16 x/z clamped to ±3e7, pitch clamped to ±90 then % 360. lastReported* untouched, so the next tick sends the position again.
  • A fresh player (join / respawn) has lastReported* = 0.
  • Server held_item_slot changes only the selection; the next sync echoes it (vanilla).
  • Chat truncated to 100 (1.8) / 256 (1.16) UTF-16 units like the vanilla packet constructor.
  • 1.16 immediate respawn (game state 11 / combat_event entity dead) respawns at once.
  • Login plugin requests (1.16) are answered "not understood".
  • Server resource packs on 1.8 – 1.16 (ClientPlayNetworkHandler.onResourcePackSend, the server entry's pack policy set): accepted then loaded (Client::accept_required_resource_packs, default on; these versions have no "required" flag) or declined; nothing is downloaded. A level:// pack (no world saves) and, on 1.12+, a URL the client's check rejects (scheme not http / https / level, invalid URI syntax) get "failed download" alone. The 1.8 answer echoes the pack hash.

Movement and world

  • 1.8.9: ghast-physics (bit-exact against the vanilla oracle) runs the movement step on the ghast-world chunk store and produces the tick's sprint / sneak / abilities packets and the movement packet. Server teleports, abilities, food (sprint), our entity_velocity and explosion pushes are fed to it; the world border (moving borders advanced 50 ms per tick) reaches the collision code through the world. Controls are the vanilla keys (W/A/S/D, jump, sneak, sprint).
  • 1.12.2: ghast-physics::v1_12 (0 diffs against the 1.12.2 oracle) on the 1.12.2 chunk store. A fresh player is added to its chunk on the first tick its column is loaded and moves from the next one, as vanilla 1.9+ does; standing still sends no idle packets (only the position refresh every 20 ticks). Recording is not available on 1.12.2 yet. With entity tracking (Interests::ENTITIES or ENTITY_TRACKING) the player is pushed by the mobs, other players and boats around it and collides with boats and live shulkers, as the 1.12.2 client does (it pushes the local player itself): the sim keeps the entities' client positions (interpolation over 3 ticks, boats 10), pushes after the player's tick in spawn order, follows the team collision rules of the teams packet (players by the profile name they spawned with) and skips spectator players; a boat breaks the lily pads it touches. Without entity tracking none of this happens. Proven against the 1.12.2 oracle through the engine (tests/golden/1.12.2/entities.jsonl.gz and a 2 M tick cached fuzz, 0 differences). Not modelled: riding (the bot or the pushing entity), open shulkers, entities left from before a same-dimension respawn that the server does not resend (vanilla ticks those before the player).
  • 1.16.5: ghast-physics::v1_16_5 (0 diffs against the 1.16.5 oracle) on the 1.16.5 chunk store, fed the same way (teleports with relative flags, abilities, food, velocity). Its packet rules are 1.16's: teleport confirm + position_look, no packet at all on idle ticks (flying only when on-ground changes), a position at least every 20 ticks.
  • Elytra on 1.12.2 / 1.16.5 (ghast_physics::v1_12::PlayerExt, v1_16_5::PlayerExt): TickContext::start_gliding / is_gliding as on 26.x. The chest slot is read on jump presses in the air; 1.16.5 starts the glide itself (and sends start_fall_flying), 1.12.2 only sends the request and glides once the server sets shared flag 7. From the first such press with an elytra on, the sim reads our entity data (flag 7, set and cleared by the server) and the firework rockets the server attaches to us (spawn + shooter entity data, destroy); a rocket boosts a gliding player each tick it ticks. 1.16.5 rockets tick before or after the player in the client world's entity map order: exact with entity tracking, without it they count as after the player. Using a rocket from the hand while gliding sends use_item (and on 1.16.5 a swing). Proven against the oracles through the engine (elytra.jsonl.gz of both versions and their 1 M tick cached fuzz, 0 differences; the replay starts with the sim already reading the glide packets).
  • Boats on 1.16.5 (ghast_physics::v1_16_5::{Boat, tick_boat}, needs Interests::ENTITIES): boarded when set_passengers names the player and the vehicle is a tracked boat; TickContext::vehicle reports it (controlled: true). The client moves the boat as vanilla (paddles, water / ice / land, collisions with the other boats, shulkers and living entities as the tracker holds them) and sends steer_boat, look, steer_vehicle and vehicle_move every tick; the server's vehicle_move is applied and answered at once. Sneak gets off (the client dismounts itself); a boat it left stays where it was driven until the server moves it. Vehicles other than boats, minecarts and living mounts (below) are not simulated (the walking tick goes on). Proven through the engine (boats.jsonl.gz and the 1 M tick cached boat fuzz, 0 differences). Two passengers: the seat follows set_passengers (0.2 forward in front, 0.6 back behind, Boat::set_seat); only the front passenger drives. Behind another player or a mob the boat interpolates the server's moves over 10 steps, the client sends look + steer_vehicle only (controlled: false) and a turn left from our own paddling keeps turning us (vanilla never decays it there). Hand-overs of the front seat, boarding a moving / interpolating boat (its client box, interpolation and tracked position, the push an empty boat took from us), its other passengers' pushes after we leave are followed. Proven through the engine (boats_seat.jsonl.gz and the 300 k tick cached seat fuzz, 0 differences). Not modelled: bubble columns under a boat.
  • Boats on 1.12.2 (ghast_physics::v1_12::{Boat, tick_boat}, needs Interests::ENTITIES): the same boarding and packets (steer_boat, look, steer_vehicle, vehicle_move every tick; the server's vehicle_move applied and answered at once). The boat ticks at its place in the client world's entity list: the entities spawned before it step first, then it collides with the boats, minecarts and pushable living entities around it (v1_12::blocks_boat), the entities after it push the passenger (that motion carries into a walking tick when the server takes the player off in between). The 1.12 client never gets off by itself: sneak only goes to the server in steer_vehicle, whose set_passengers then takes the player off; the boat stays where it was driven (the server's moves of it are ignored while the client controls it, as vanilla). Proven through the engine (boats.jsonl.gz, 22 hand cases + 100 fuzz, and the 1 M tick cached boat fuzz, 0 differences). Two passengers as on 1.16.5 (a pending interpolation is frozen, not dropped, while we drive); proven through the engine (boats_seat.jsonl.gz and the 300 k tick cached seat fuzz, 0 differences). Not modelled: riders other than players in boats (their seat is not followed: left out of collisions and pushes); boarding a boat whose yaw is still interpolating starts from the server's yaw.
  • Boats on 1.8.9 (ghast_physics::v1_8::{Boat, tick_boat}, needs Interests::ENTITIES): the 1.8 client simulates the boat its player rides. Boarded when attach_entity names the player and a tracked boat (at the server's last position of it: the client's interpolation of an empty boat ends there); look + steer_vehicle every tick; the server's teleport, relative moves, looks and velocity of that boat are applied as the 1.8 client does (a relative move only restores the server's motion when the boat is more than a block off); attach_entity with vehicle -1 or the boat's destruction takes the player off (it walks from its seat). The boat's Math.sin / Math.cos are the platform's; the real client's are its JVM's, which differ in the last bit for about 0.2 % of the values. Proven through the engine with the oracle JVM's values (boats.jsonl.gz and the 1 M tick cached boat fuzz, 0 differences); with the platform's, the packets of 2 of the 10,000 cached cases differ (a 1-ulp seat position sent after a dismount). Not modelled: other entities near the boat.
  • Minecarts on 1.16.5 (ghast_physics::v1_16_5::{Minecart, tick_minecart}, needs Interests::ENTITIES): set_passengers naming the player on a tracked minecart seats it (at the server's position of the cart: the client's interpolation of a cart at rest ends there). The server moves the cart; the client interpolates its teleports, relative moves and looks (3 + 2 steps) and sends look + steer_vehicle every tick (no vehicle_move); sneak gets off (the client dismounts itself); the cart's removal or the server's set_passengers takes the player off. TickContext::vehicle reports it with controlled: false. Proven through the engine (minecarts.jsonl.gz and the 1 M tick cached minecart fuzz, 0 differences).
  • Living mounts on 1.16.5 (ghast_physics::v1_16_5::{Mount, tick_mount}, needs Interests::ENTITIES or ENTITY_TRACKING): set_passengers naming the player on a tracked horse, donkey, mule, skeleton or zombie horse, llama, trader llama, pig or strider seats it, with the speed / jump strength attributes and the saddle / boost entity data the server sent for that entity. The client moves the horse family (llamas excepted), a pig while a hand holds a carrot on a stick and a strider while one holds a warped fungus on a stick (the tracker then ignores the server's moves of it), sends look + steer_vehicle + vehicle_move and answers the server's vehicle_move; the jump key charges a saddled horse's jump bar (Outbound::RidingJump on release); other mounts are interpolated from the server's moves. Sneak, the server's set_passengers or the mount's removal take the player off. Proven through the engine (mounts.jsonl.gz and the 500 k tick cached mount fuzz, 0 differences). Boarding takes the mob as the client watched it from its spawn packet on (v1_16_5::Mount::watched: the spawn's velocity, the interpolation and the steps left, the velocity packets and their decay, head yaw, the mob's own pushes on the player, the walk animation, the rearing flag, a boost); a mount the player left is watched again (mounts_board.jsonl.gz: watched 1 – 40 ticks while the server walks it, then ridden; 300 k cached ticks; 0 differences through the engine, with and without the metadata store). While it rides a pig or strider the client reads the hands again after each inventory packet, so a move of the mount in the same batch as a stick change is judged with the new hands, as vanilla does. The server's dismount with a placement above the ground is vanilla's too (mounts_dismounts.jsonl.gz). Not modelled: a mount another entity rides (boarding it later starts from where the tracker draws it, at rest) and what ghast-physics leaves out (random rearing, baby mounts).
  • Minecarts on 1.12.2 (ghast_physics::v1_12::{Minecart, tick_minecart}, needs Interests::ENTITIES): the same as 1.16.5 at the cart's place in the client world's entity list (the entities before it step first; the ones after it push the passenger), from the cart's client position; the 1.12 client never gets off by itself (sneak only goes to the server). Proven through the engine (minecarts.jsonl.gz and the 1 M tick cached minecart fuzz, 0 differences). Not modelled: an interpolation still running when the player boards (the cart starts from where the client has it).
  • Living mounts on 1.12.2 (ghast_physics::v1_12::{Mount, tick_mount}, needs Interests::ENTITIES or ENTITY_TRACKING): set_passengers naming the player on a tracked horse, donkey, mule, skeleton or zombie horse, llama or pig seats it, at the mount's place in the client world's entity list, with the movement speed / jump strength attributes and the horse status / pig saddle and boost entity data the server sent for that entity. The sim reads a mount's entity data itself from its spawn on, with or without the metadata store; for a mount whose spawn it did not see and without the metadata store a horse's status flags cannot be known: the sim takes it as tame and saddled (the only horse a rider steers) and logs a warning (the engine test mounts_without_metadata_take_a_tame_saddled_horse_1_12_2: every tame saddled horse and every pig case still matches the oracle). The client moves the horse family (llamas excepted) and a pig while a hand holds a carrot on a stick (the tracker then ignores the server's moves of it, ghast_entity::v1_12::Tracker::set_steer_carrot), sends look + steer_vehicle + vehicle_move and answers the server's vehicle_move; the jump key charges a saddled horse's jump bar (Outbound::RidingJump on release); a llama or an unsteered pig is interpolated from the server's moves (no vehicle_move). The 1.12 client never gets off by itself: the server's set_passengers or the mount's removal take the player off. TickContext::vehicle reports the mount (controlled: the client moves it). Proven through the engine (mounts.jsonl.gz and the whole 1.5 M tick cached mount fuzz, 0 differences; the hands are taken again after each inventory packet, so a pig move in the same batch as a carrot change is judged with the new hands, as vanilla does). Boarding takes the mob as the client watched it from its spawn packet on (v1_12::Mount::watched: the spawn's velocity, the interpolation, velocity packets and their decay, head yaw, the mob's pushes on the player, body clock, rearing; velocity packets reach the ridden mount too); a mount the player left is watched again (mounts_board.jsonl.gz and 300 k cached ticks, 0 differences through the engine; without the metadata store a llama's pushes differ: the tracker sizes its box by the baby flag). The server's dismount with a placement above the ground is vanilla's too (mounts_dismounts.jsonl.gz). Not modelled: a mount another entity rides; what ghast-physics leaves out (random rearing, baby mounts).
  • Minecarts on 1.8.9 (ghast_physics::v1_8::{Minecart, tick_minecart}, needs Interests::ENTITIES): boarded by attach_entity naming the player and a tracked minecart (at the server's position of it); the server's teleports, relative moves, looks and bare entity packets of the cart are interpolated as the 1.8 client does; look + steer_vehicle every tick; vehicle -1 or the cart's removal takes the player off. Proven through the engine (minecarts.jsonl.gz and the 1 M tick cached minecart fuzz, 0 differences).
  • Horses and pigs on 1.8.9 (ghast_physics::v1_8::{Mount, tick_mount}, needs Interests::ENTITIES or ENTITY_TRACKING): boarded by attach_entity naming the player and a tracked horse (any kind) or pig, from where the client draws it (its interpolation continues); the server's teleports, moves, looks, head yaw and entity data 16 (saddle, rearing) of the mob are applied as the 1.8 client does (it never moves the mob itself); look + steer_vehicle every tick; on a saddled horse holding jump charges the jump bar and letting go sends entity_action riding jump with the bar × 100 (Outbound::RidingJump); vehicle -1 or the mob's removal takes the player off. TickContext::vehicle reports it with controlled: false. Proven through the engine (mounts.jsonl.gz and the 1 M tick cached mount fuzz, 0 differences). Boarding takes the mob as the client watched it from its spawn packet on (its interpolation, body clock and head turn, rearing animation and entity data 16, read by the sim itself; a mob the player left is watched again): mounts_board.jsonl.gz and 300 k cached ticks, 0 differences through the engine, the player's position compared every tick. For a mob whose spawn the sim did not see and without the metadata store (Interests::ENTITIES) a mount's status flags cannot be known: the sim takes it as saddled and not rearing and logs a warning (mounts_without_metadata_take_a_saddled_mount_1_8_9: every case whose mount is saddled and not rearing still matches). Not modelled: a mob another entity rides; baby mounts and other mobs as mounts.
  • Mount screens on 1.8.9 – 1.16.5 with entity tracking: when a mount's window opens (open_window EntityHorse, 1.16.5 open_horse_window), the saddle and armor slot rules (ghast_inventory::MountRules) are read off the tracked entity like HorseScreenHandler does: 1.8.9 saddle always, horse armor for horse type 0 (entity data 19, needs the metadata store); 1.12.2 by type (saddle for all but llamas, horse armor for horses, carpets for llamas); 1.16.5 saddle for a live, tame (horse flags 16, bit 2), adult (entity data 15) horse, donkey, mule, zombie or skeleton horse (needs the metadata store), never for llamas; horse armor for horses, carpets for llamas and trader llamas. Unknown entity or missing data: no rules (as before). TickContext::set_mount_rules still replaces them.
  • ctx.world() (WorldView): loaded columns and raw block states; None = not loaded.

What the physics is fed

Teleports (relative flags), abilities, food, our entity velocity and explosion pushes, the movement speed attribute (update_attributes base + server modifiers, the client's own sprint modifier excluded; 1.8 physics takes only the base so far), status effects (jump boost, blindness; 1.16 also levitation, slow falling, dolphin's grace), boots enchantments (1.16 depth strider / soul speed from the armour NBT) and spectator mode (1.16). Haste / mining fatigue (effects) and aqua affinity (helmet) feed the dig speed.

Hands: dig, place, use (phase 3 groundwork)

Entities are invisible without entity tracking (Interests::ENTITIES or Interests::ENTITY_TRACKING). The crosshair (set_buttons, target(), dig, place) is then a block pick: a player or mob standing in front of the block does not stop the dig and cannot be attacked or used, and nothing pushes the bot. Ask for one of them whenever other entities can be near (keep it and stop pushes with Client::entity_push(false) if needed, a non-vanilla opt-in).

hands.rs ports 1.8.9 MinecraftClient.tick key processing and ClientPlayerInteractionManager (verified against recorded lab packet traces); it runs after the behaviour, this tick's turn and the held-slot sync and before the movement step, so its packets precede the tick's movement packet. Vanilla turns the player at frame time, between ticks, and the tick's crosshair pick and key handling then read that look (1.8 – 26.x alike), so the held buttons and queued presses pick with the look the tick's movement packet carries: ctx.planned_look() and ctx.press_preview(..) describe it once ctx.set_aim(..) is called. Oracle-proven by replaying the 1.8.9 / 1.12.2 / 1.16.5 attack and item-use goldens and the 26.x held-dig goldens with each tick's look arriving as the tick's turn. (Up to 0.5.4 the buttons picked with the look before the turn when no press was queued.)

Turn held on action ticks (Client::hold_turn_on_action, on by default): Grim's RotationPlace re-checks a dig / place with the look of the movement packet that follows it. When this tick's rotation step would take the crosshair off a block the behaviour dug (start / finish) or placed this tick — full-cube ray from the sent and the current feet, standing or sneaking eyes, old or new yaw, 6 blocks — the look stays for one tick and the turn continues the next time the behaviour aims (ctx.held_turns() counts them). The buttons' own digs and places come after the turn and pick with its look, so they never hold it.

  • ctx.set_buttons(Buttons { left, right }): left held mines the crosshair block — block_dig start (abort of a previous block), damage from relative_hardness (hardness, harvest tools, tool multiplier + efficiency, haste / fatigue, eyes in water, not on ground ÷5; f32 sums like vanilla), finish at ≥ 1, then 5 ticks of hit delay; an arm swing per click and per damage tick; letting go aborts. Right held: block_place on the face (activation or placing swings) every 4 ticks, else the item use packet; usable items (food, potion, milk, bow, sword) set using_item until right is released (block_dig release), the server's entity status 9, a slot change, or the used hand no longer holding that item (1.16.5 tickActiveItemStack, 26.1 updatingUsingItem; 1.8 / 1.12 also end it on any server write of that hand's slot, as their use is tied to the stack object: oracle case use_apple_held_split_finish, Grim-vs-vanilla case (4) below). A broken block is predicted air until the server answers: 26.x restores the server's state at its block_changed_ack (block updates for the block wait until then), 1.16.5 applies acknowledge_player_digging like vanilla; 1.8.9 / 1.12.2 wait for the server's block change. A broken waterlogged block (or kelp, seagrass) leaves a water source, as vanilla's destroyBlock does (26.x, 1.16.5).
  • A spectator's right click on a block sends the block packet and ends there (no placement, off hand or item use): 1.8.9 – 1.16.5 swing (interactBlock true / SUCCESS), 26.x does not (CONSUME).
  • 1.8.9 / 1.12.2 write no block_place for a block item that cannot go there, like vanilla's canPlaceItemBlock check: the spot next to the face (or the clicked tall grass / dead bush / vine / snow layer) is not replaceable, or a block that is a full cube on every data value would overlap the player. The item use follows instead (1.8 use_item form; 1.12 use_item, then the off hand); ctx.place returns false. Not decided (sent as before): anvils, slab items, double plants as the clicked block, the block's own placement rules (torch supports, flower soil, …), partial collision boxes, other entities in the spot. With entity tracking on, 1.12.2 also decides other entities (World.hasEntityIn over the living entities, players that are not spectators, boats and shulkers whose client position the sim keeps); minecarts, armor stands, bats, parrots, TNT, falling blocks and riders are not decided, nor is any entity on 1.8.9 (no client positions kept) or with tracking off. 1.16.5 and 26.x have no such client check.
  • Placed blocks are predicted (every version) when the result is known exactly: a block whose only state is a full collision cube (stone, cobblestone, planks on 1.13+, ores, wool on 1.13+, glass, …; 1.8.9 / 1.12.2: the blocks without block-state properties, so not stone / planks / wool there), or a block whose only property is its axis (logs, wood, stems, pillars, basalt, hay, bone blocks: the clicked face's axis; 1.8.9 / 1.12.2 logs, hay, purpur pillars, bone blocks with the item's variant) from a stack without block data, placed on a full-cube block the click does not activate (or while sneaking with an item), into air, water or lava, inside the build height and the world border, not into the player's box, in survival or creative. The placing stack loses one item at once like vanilla (not in creative). 26.x keeps the server's state until its block_changed_ack like vanilla (oracle-proven: tests/golden/26.x/place.jsonl.gz); older versions take the server's block updates for the clicked block and its neighbour. Not predicted (the server's updates bring them): other placement rules of the block (facing, half, slabs, waterlogging, concrete powder), replaceable clicked blocks (grass, snow), multi-block items (doors, beds), neighbour shape updates (fences, panes, stairs, note block instruments), other entities in the way.
  • ctx.drop_held(whole_stack) / ctx.swap_hands(): the drop and swap-hands keys outside a screen (MinecraftClient.handleInputEvents), a block_dig drop item (4) / drop stack (3) / swap (6, 1.9+) at the origin facing down, written now in call order. 1.16.5 and 26.x predict the drop like vanilla (ClientPlayerEntity.dropSelectedItem, LocalPlayer.drop): the item leaves the held slot at once and the main arm swings when one did; 1.8.9 / 1.12.2 send the packet alone. The swap predicts nothing (the server's slot updates move both stacks). Refused while a screen is open (window, inventory, dialog), dead or spectating; the swap also on 1.8.9.
  • ctx.dig(pos, face) / ctx.place(support, face, hit): refused unless ctx.target() — the ray from the sent eyes along the sent look, reach 4.5 — is on that block face; dig = start (+ instant break) then swing, place = block_place then swing.
  • ctx.target(), ctx.mining(), ctx.broken(), ctx.using_item().
  • The crosshair is vanilla 1.8's World.rayTrace(eyes, eyes + look × reach, false, false, true) (block walk with the −1e−4 zero-fraction rule, per-block six-plane test, ties to the earlier plane; stairs: the eight half-cube passes, the hit farthest from the ray's end wins) with Entity.getRotationVector from the float sine table and eyes = feet + 1.62F (− 0.08F sneaking); ray shapes from ghast_physics::v1_8::ray_shape (ghast-data's oracle-verified selection() bounds plus the neighbour-dependent fences / panes / walls / doors / chests and the stairs passes). tests/oracle_raytrace.rs: all 2000 of the oracle's rays bit-exact (hit block, face, hit vector, miss block).

1.9+ rules (1.16.5): the left click digs first and swings after (a click on air is a miss); the right click tries the main hand, then the off hand — per hand the block (activation unless sneaking with an item; a block item places and swings), then the item itself (use_item), the first success ending it, so empty hands send a block_place per hand; swords no longer block, shields / bows / crossbows / tridents / potions / milk / food are used; the swing names its hand.

26.x item uses in the air (sim/modern/air.rs, the items whose use reads more than the stack's flags): spawn eggs succeed with a block on their own ray (from the eyes along the look to the block interaction range), filled buckets pour into air (success; outside creative the hand's stack becomes an empty bucket; the fluid itself comes with the server's block update), boats succeed when their box at the hit point is free of blocks, the border and the boats, minecarts, shulkers and pushable mobs it meets, bundles start using and succeed, books, empty maps and fishing rods succeed, a knowledge book is used up outside creative (no recipes: fail), bows and crossbows start using only with ammunition or in creative (else fail, and the off hand's turn follows). A creative (invulnerable) player eats whether hungry or not (Player.canEat). Not decided (nothing after the use is predicted): a fluid on the ray of a spawn egg or boat, a bucket poured into anything but air, a charged crossbow, a boat next to a happy ghast, a creaking or a mob whose feet are not in air; 26.3's peaceful refusal of hostile spawn eggs is not modelled (the difficulty is not tracked). Proven by the entity click replays (the item-use class fails the test).

The 1.16 crosshair also picks entities (see Entities below), the attack cooldown is kept (Hands::attack_strength), and the ray boxes are the oracle-verified outline shapes.

Item cooldowns (1.12.2, 1.16.5, 26.x; module cooldown): the client's cooldown manager. The server's set_cooldown (an item on 1.12.2 / 1.16.5, a cooldown group on 26.x; 0 removes it) and the client's own starts (1.12.2 / 1.16.5: an ender pearl's 20 ticks; 26.x: the use_cooldown component after an instant use, a use on a block or a finished use, so ender pearls, wind charges, chorus fruit and any item a server gives the component, groups shared between items included) count down in the player tick and end with a new player entity. While a stack cools down a right click with it sends its packets and does nothing else (no throw, no placement, no use started; the off hand gets its turn), so the held button throws a pearl every 20 ticks and sends use_item every 4, like vanilla. Read them with ctx.item_cooldowns(), ctx.item_cooldown(stack), ctx.held_cooldown() (ticks left and vanilla's getCooldownPercent) and ctx.events().cooldowns() (started, removed, ended). Oracle-proven: tests/golden/<v>/cooldowns.jsonl.gz on 1.12.2, 1.16.5 (Combat.cooldownGolden) and 26.1 – 26.3 (Cooldowns, which also records the client's cooldowns and hands each tick). 1.8.9 has no item cooldowns. Not modelled: a goat horn's own cooldown before the server's packet (its length comes from the instrument registry), a 26.x use_cooldown on an item whose release (releaseUsing: bows, crossbows, tridents) starts it.

Entities (ghast-entity, opt-in)

With Interests::ENTITIES (and PLAYER_LIST for the tab list) the session creates the version's ghast_entity tracker; its packet ids join the filter, so bots without the interest never decode entity packets. ctx.entities() is the store (get, within, players, …). The interests can change mid-session: a tracker started late is empty but knows our own entity id and dimension (it replays the session's join / respawn packets); switching off drops it.

  • Crosshair: vanilla GameRenderer.updateTargetedEntity — entities that collides() (living, players, paintings, boats, minecarts, TNT, falling blocks, item frames, armor stands, leash knots, end crystals) whose box, grown by 0.1 on 1.8 (0 on 1.9+), the look ray hits first, within 3 blocks and closer than the block hit. It takes over the buttons: left attacks (use_entity attack; 1.8 swing first, 1.16 swing after and the attack cooldown resets), right interacts (interact-at, then interact, then the held item like vanilla's fall-through for plain entities; 1.16 per hand; 26.x: one interact packet per hand, the hand's turn ends when the entity consumes the click).
  • ctx.target_entity() (from the sent pose), ctx.attack(id) (refused unless the sent crosshair is on it; no miss delay or cooldown check, the attack tick holds the turn), ctx.attack_strength(attack_speed) (1.16 cooldown, 1.0 on 1.8).
  • ctx.press(Button::Left) queues one vanilla click for this tick's key handling (N calls, N clicks): the turn comes first (as on every tick), the key handling picks once (1.8 with the head yaw) and every click acts on that pick — attack with the swing in the version's order and its slow-down, 1.9+ cooldown reset per click, a miss's 10-tick delay that holds back the rest of the tick (released, it ends with the tick). The movement packet then carries the pick's look. Oracle-proven on 1.8.9, 1.12.2 and 1.16.5 (attacks.jsonl.gz, cases attack_player_clicks*) and 26.x (held_dig.jsonl.gz, attack_mob_clicks*). The right button is not queued.
  • ctx.sprinting() is the client's sprint flag now (after this tick's entity data, before the attacks); ctx.attack_slows(id) says whether an attack issued now slows the bot (a landed hit with knockback: x / z × 0.6, the sprint ends). ctx.set_turn_rate(yaw, pitch) / ctx.turn_rate() change and read the aim's cap per tick mid-session.
  • With Interests::ENTITY_EVENTS: ghast_entity::Event::Swing { id, off_hand } for the arm swings of tracked entities (1.16.5 / 26.x read the packet only then). Always: events().knockback() lists our own velocity packets and explosion pushes of the tick (common::Knockback { motion, explosion }).
  • Entity boxes come from ghast-entity (minecraft-data sizes, server positions; vanilla picks the interpolated position). Which clicks the entity consumes on the client (and whether the hand swings, what happens to the hand's stack) follows vanilla per version: 1.8.9 – 1.16.5 hand tables of the oracle's interact_* / mob_* cases; 26.x a table dumped from the real client for every pickable entity type and item (EntityClicks), read from the tracked entity data, equipment, riders, leash holder and effects (without entity tracking every entity reads as a fresh one). Not predicted: what the server then does (trading screens, boarding). 26.x picks also hit the types with their own box (item frames, paintings, leash knots, shulkers, interaction entities, wind charges: ghast-entity builds their boxes), and the engine gives the player the game mode's abilities at a join, respawn and game mode change as vanilla does before the server's abilities packet (a spectator flies at once). The engine replay of every entity_clicks.jsonl.gz case fails on any pick difference except with a spear in the main hand (an attack range component: AttackRange.getClosesetHit, not modelled).

Client-side physics of projectiles, items, orbs, TNT, falling blocks (opt-in Interests::ENTITY_PHYSICS, every version)

A vanilla client ticks every tracked projectile, item entity, experience orb, primed TNT and falling block itself between two server updates (ClientLevel.tickNonPassenger: the commonTick interpolation step of orbs and bobbers, then the entity's own tick with the client's side of the rules). With Interests::ENTITY_PHYSICS on top of ENTITIES or ENTITY_TRACKING, a 26.1 / 26.2 / 26.3 bot does the same with the oracle-proven ghast_physics::modern::{projectile, drop} (client side): Entity::position, velocity (then the client copy's motion, not the last one the server sent), yaw / pitch and on_ground are what the vanilla client holds. Packets correct it as in vanilla (spawn, moves, syncs, teleports, motion; an arrow's IN_GROUND, a TNT fuse, a dangerous skull, a hurting projectile's projectile_power; a non-zero motion frees a stuck arrow); 26.3's recordMovement hands each move to an interpolation in progress. The client removes a TNT whose fuse ran out, a bobber without its player owner and a falling block of air.

Proof: tests/golden/<v>/nonliving_tracking.jsonl.gz (oracle NonLivingTrackDump: random spawn / move / sync / teleport / motion / entity data / power packets through the real client's packet listener over a floor with walls, water and slippery patches, the client level ticking them): every entity's position, motion, rotation and ground flag after each tick's packets, bit for bit, 16 cases (4 with orbs around players) / 768 ticks / 3,922 entity states per version, and a cached run (oracle/cache/<v>/fuzz-nonliving/, the ignored test nonliving_cache_matches_the_oracle) of 720 cases / 49,600 ticks / 260,195 entity states per 26.x version (1.8.9 – 1.16.5: 920 cases, about 370,000 states each) with 0 diffs.

Experience orbs follow the nearest player within 8 blocks, as the vanilla client's own orb tick does on every version (26.x followNearbyPlayer; 1.8.9 – 1.16.5 a target search every 20 + id % 100 ticks of the orb's clock). The players are ours and the tracked ones, each where it is when the orb ticks (one that ticks after the orb is read before its own interpolation step), with the eye height its pose (1.8.9 / 1.12.2: its sneaking and gliding flags) gives it and its tab-list spectator flag (26.x: also its health); an orb keeps following a player object that left the world. Checked by the orb cases of the same oracle dump (our player standing on the floor, up to three other players coming, moving, crouching, turning spectator and leaving). Pickup, merging and hits are the server's on every version: the vanilla client runs none of them itself.

Not simulated: entity hits (a projectile hitting a pickable entity: TNT, falling blocks, fireballs, wind charges, mobs), entities with NO_GRAVITY (they stay where their packets put them), passengers, explosions. A client entity's random is unseeded in vanilla (a bobber's bobbing differs between two vanilla clients); here it is seeded with the entity id. A bobber hooked to an entity follows it and a biting bobber takes the bite's jerk (see Fishing).

1.16.5 (ghast_physics::v1_16_5::{projectile, drop}, client side, each entity ticked as ClientWorld.tickEntity does: in a loaded column, filed in its chunk): every packet the tracker applies is handed to the client copy the way ClientPlayNetworkHandler does it. A spawn builds what the client constructs (the spawn packet's motion is not applied; a fireball, dragon fireball or wither skull turns it into its acceleration); moves, looks and teleports put the copy at the new tracked position (updateTrackedPositionAndAngles; relative moves add to the tracked position, kept apart from the copy's own, see v1_16_5::Tracker::client_simulated), except a fishing bobber, which ignores them; a velocity packet turns a fresh projectile to its motion (setVelocityClient); entity data sets no gravity, a TNT fuse, a dangerous wither skull, a tipped arrow's colour, a fire-proof item. An item's, orb's and TNT's constructor motion is drawn from the client's unseeded random: here it is the spawn packet's motion until the server's velocity packet (which a server sends right after every spawn). An arrow with the no-clip flag is not simulated. Proof: tests/golden/1.16.5/nonliving_tracking.jsonl.gz (12 cases / 576 ticks / 2,715 entity states) and cached runs of 300 cases × 48 ticks (67,141 entity states) and 150 cases × 96 ticks (78,987 entity states), 0 diffs.

1.12.2 (ghast_physics::v1_12, client side): the same, with 1.12's handlers. A spawn builds the client's constructor (a falling block 0.01 above the packet's position) and applies the packet's motion through setVelocityClient only when the object data is above 0 after the client's resets (fireballs, potions, falling blocks, bobbers reset it); relative moves and the bare entity packet move the copy to the tracked position (tracedX / 4096); a teleport within 1/32 (1/64 vertically) of the copy keeps the copy's position; a velocity packet turns only a fresh thrown item or arrow; a 1.12 client ticks every entity it holds, loaded column or not. Proof: tests/golden/1.12.2/nonliving_tracking.jsonl.gz (12 cases / 576 ticks / 2,408 entity states) and cached runs of 300 × 48 (65,618 entity states) and 150 × 96 ticks (76,239 entity states), 0 diffs. A hurting projectile spawned without motion (NaN acceleration in vanilla) is not modelled.

1.8.9 (ghast_physics::v1_8, client side): positions in 1/32 blocks; the spawn as on 1.12.2 (no falling-block offset); every position packet (relative moves, the bare entity packet, teleports with the 1/32 rule) goes through updateTrackedPositionAndAngles, which on 1.8 pushes thrown items, hurting projectiles, items, orbs, TNT and falling blocks up onto the highest block box their box (less 1/32 on each side) runs into, moves an arrow plainly, and starts a 3-step interpolation of a fishing bobber (which also takes the last velocity packet's motion again); entity data: a dangerous wither skull. An entity spawned in an unloaded column ticks once a packet moves it into a loaded one; after that it ticks wherever it goes. Proof: tests/golden/1.8.9/nonliving_tracking.jsonl.gz (12 cases / 576 ticks / 2,596 entity states) and cached runs of 300 × 48 (66,983 entity states) and 150 × 96 ticks (78,957 entity states), 0 diffs (the push-up and the bobber's interpolation each fail the cached run when switched off). Not modelled: other entities' boxes (boats, minecarts) in the push-up.

Cost: off by default; without the interest the session runs nothing for these entities (no per-tick work beyond one None check, no extra state). With it, a side table of the simulated entities (cold, boxed) and one physics tick per entity in a loaded column per client tick.

TickContext::predict_throw(Throw, max_ticks) (ghast_client::throw, every version): the expected flight of a snowball, egg, ender pearl, potion, bottle o' enchanting, wind charge, trident or arrow (bow / crossbow) thrown now from the sent pose, without the random spread (ThrowPrediction::max_spread bounds it): the path and the first block hit, from the version's oracle-proven launch and server-side projectile tick. Entities in the way are not seen.

Dialogs (26.1+, opt-in Interests::DIALOGS)

show_dialog / clear_dialog in the configuration and the play state (ghast_client::dialog; its module docs list what the vanilla client does). In play the dialog arrives in ctx.dialog_events() / ctx.dialog() and ctx.answer_dialog(&DialogAnswer::button(i) .with_value(key, value)) sends what vanilla sends for that button: custom_click_action (inputs added to the payload in vanilla's order), the command as an unsigned chat_command when vanilla would send it without asking (verifyCommand on the server's command tree; otherwise held, or sent with confirm_commands(true)), nothing for client-only actions. During configuration the client asks Behavior::configuration_dialog and sends its answer at once (commands do nothing there, as in vanilla). Without the interest, a configuration dialog is logged as a warning. Checked byte for byte against answers written by the vanilla client classes (tests/golden/26.2/dialog_answers.txt, oracle/dialogs/) and through the whole client against replayed vanilla 26.1.2 / 26.2 server sessions (tests/dialogs.rs).

HUD and tab completion (opt-in Interests::HUD)

ctx.hud() (ghast_client::hud::Hud) is what a player would see now: the boss bars (1.9+; Capabilities::boss_bars) in display order with title, progress, colour, division and flags; the title and subtitle while the title's countdown runs (title_ticks, title_times, title_phase); the action bar for its 60 ticks; the tab list's header and footer. Changes arrive as ctx.events().hud() (HudEvent), including the countdowns running out. The state follows each version's client handlers and InGameHud.tick / Gui.tick (one countdown step per client tick, after the packets): the subtitle waits for a title, times apply to the next title or restart the one showing, 1.8 – 1.16.5 clear zeroes the times (a later title does not show until new times arrive), 1.8 / 1.12 reset shows an empty title for the old times, 1.8 / 1.12 never drop an empty header, the 1.12 / 1.16.5 boss bar fog flag quirks, the 26.x HUD reset at a reconfiguration (the module docs list them). The action bar is fed by the title packet's action, 26.x set_action_bar_text, and chat at the action bar position (decoded for the HUD even without Interests::CHAT, and then not reported as chat). Without the interest the HUD packets are dropped undecoded and nothing is kept. Not modelled: client-made overlay messages (mounting, jukebox) and the bars' 100 ms progress easing.

ctx.tab_complete(text) writes a completion request now (1.8 / 1.12 tab_complete with the optional looked-at block and the 1.12 assume-command flag via tab_complete_with, 1.13+ command_suggestion with vanilla's transaction ids) and returns a request number; the answer arrives as ctx.events().tab_completions() with that number, the replaced range and the matches (1.13+ with tooltips). What to ask is the caller's business (vanilla 1.13+ asks only at minecraft:ask_server argument nodes). ghast-ext wraps it as bot.tab_complete(text).await.

Proof: engine tests feed every version's packets, encoded with the generated codecs, through the wire layer and the engine (engine/tests/hud.rs: countdown, clear / reset per version, action bar paths, header rules, boss bar operations and flags, the interest gate, request bytes and answer matching); the rules themselves are read from each version's client jar (no oracle golden). Live: lab/hud.sh on 26.3, 1.16.5, 1.12.2 and 1.8.9 (2026-12-02): completion of /ti, the bar's add / value / colour / style / rename / remove (1.16.5, 26.3), title with subtitle, the action bar (1.12.2+), and a 5 + 20 + 5 title ending 29 ticks after the tick it arrived; all PASS, 0 Grim flags. The header and footer have no vanilla command (engine tests only).

Sign editing (every version)

The server opens the sign editor after the player placed a sign (and on 1.20+ after a right click on a sign the player may edit, front or back side); ctx.sign_editor() (ghast_client::sign::SignEditor: position, side) is the open editor and ctx.events().signs() reports it opening (SignEvent::Opened), closing by itself (Closed, with the reason) or being ignored (Ignored, 26.x). The behaviour answers with ctx.write_sign(&["line 1", "line 2"]) (typed, then Done) or ctx.close_sign() (Done / Escape without typing): one update_sign goes out in call order with the tick's other actions, before the movement packet, as the vanilla screen's removed() sends it. While the editor is open the screen has the keyboard and the mouse (movement keys released, buttons up). Rules read from each client jar: the screen's character filter (§, control characters and DEL dropped; sign::vanilla_line), 1.8.9's JSON lines (Text.Serializer, Gson's HTML-safe escaping) vs plain strings from 1.12.2, the 26.x side flag (26.3: a var-int SignTextSlot), the server's 384 character read limit, an editor replacing another (the old one sends first), 1.16.5 closing an editor opened where it has no sign on the screen's first tick, 26.x ignoring an editor for a position without a sign and closing it when the sign is gone or the eyes are more than the block interaction range + 4 from it. Not modelled: the 90-pixel line width (it needs the font; keep lines short), and the text a sign already shows (vanilla sends it back unchanged when closed without typing; ghast sends empty lines, so pass the old lines to keep them). ghast-ext: bot.wait_sign_editor(ticks), bot.write_sign(&[..]), bot.close_sign(), Event::Sign. Proof: engine/tests/screens.rs (every version's packets through the wire layer and the engine, the written bytes read back with the generated codecs).

Book and quill (every version)

ctx.edit_book(off_hand, &pages, title) does what the vanilla book screen sends when the pages are typed and Done is pressed (title: None) or the book is signed (Some(title)), in call order before the movement packet (ghast_client::book): 1.8.9 / 1.12.2 custom_payload MC|BEdit / MC|BSign with the held stack, 1.16.5 edit_book (stack, signing flag, hotbar slot or 40), 26.x edit_book (slot, pages, optional title). The screen's limits and filter (pages 50 / 50 / 100 / 100, page length 255 / 255 / 1023 / 1024, title 16 / 16 / 15 / 15, line breaks kept, the title trimmed and not blank), the trailing empty pages it drops (1.8 / 1.12 keep one, 26.x's Sign keeps them all), and the held stack it changes at once (1.8 – 1.16.5 NBT pages / author / title, 1.8.9's signing makes it a written book with JSON pages, 26.x's Done sets writable_book_content) are read from each client jar. The book screen itself is not modelled (it is client-only); its font-based page height is not checked. Servers check more than vanilla: Grim (ExploitB) wants the book's use packet before each edit ("not editing book"; one edit per use) and flags an empty last page among several (vanilla 26.x's Sign can send one), Paper kicks a player whose book edits are less than 20 ticks apart ("Book edited too quickly!"). ghast-ext: bot.edit_book(off_hand, &pages, title) right-clicks with the book first (look away from usable blocks) and waits 5 ticks. Proof: engine/tests/screens.rs (the packets read back with the generated codecs, the held stack after each edit).

Sleeping (every version)

Right-clicking a bed is an ordinary block use; the server answers by putting the player in it. ctx.sleeping() is the bed (its head block) and ctx.events().sleep() reports SleepEvent::FellAsleep(bed) / WokeUp: 1.8 / 1.12 from the bed packet and the wake-up animation (2; other animations are skipped after their first two fields), 1.16.5+ from our sleeping position in the entity data. What the vanilla client does then is kept: it puts the player on the bed (1.8 trySleep with the facing's 0.9F / 0.1F offsets, 1.12 0.5F + facing * 0.4F, both in float, + 0.6875; 1.16.5, 26.1 and 26.2 the block centre + 0.6875, bed or not; 26.3 the centre + the bed's sleep height + 0.125, and only when a bed is there), zeroes the velocity (1.8 / 1.12), ignores the movement keys and buttons (isImmobile, the sleep screen), does not turn (1.16.5+ levels the pitch to 0 every tick), counts sleep_ticks() up to 100, and still runs the movement step (the player drops onto the bed's top like any entity). ctx.leave_bed() is the sleep screen's "Leave Bed" (entity_action STOP_SLEEPING); the player stays asleep until the server wakes it and teleports it next to the bed. The sleeping player has vanilla's 0.2 × 0.2 box and eye height 0.2 (it moves, collides and is pushed out of blocks with that box); waking grows the standing box back (1.8 / 1.12 from the small box's corner, 1.16.5+ with the server's standing pose). No version's client wakes itself when its bed is broken: the server does. Not modelled: the stand-up position the client computes when woken (the server's position packet in the same tick replaces it), and the timer counting on to 110 after a wake-up. ghast-ext: bot.sleep_in(bed) (right click, wait for the server), bot.leave_bed(), bot.sleeping(), Event::Sleep. Proof: the oracle's sleep.jsonl.gz on every version replayed through the engine (engine/tests/sleep.rs), and engine/tests/screens.rs.

Live (signs, books, sleeping): lab/sign_book_bed.sh on 1.8.9, 1.12.2, 1.16.5, 26.1, 26.2 and 26.3 (2026-12-03): the sign's four lines (with an escaped < on 1.8.9), the signed book's title, author and pages, and the sleeping player read back on the server; all PASS, 0 Grim flags.

Fishing (every version)

Casting and reeling in are plain right clicks with a fishing rod (set_buttons: one tick down; a held button repeats the use every four ticks). With entity tracking (ENTITIES or the lean ENTITY_TRACKING) the client knows the bot's own bobber: ctx.fishing() (Bobber: id, position, BobberState flying / bobbing / hooked, hooked entity, biting, age) and ctx.events().fishing() (FishingEvent::Cast, Bite, BiteEnded, Hooked, Unhooked, Gone). See ghast_client::fishing for the details per version.

  • Ours: the bobber spawn whose object data is our entity id (vanilla's spawn handler makes it the owner's fishing / fishHook); the newest replaces an older one. It is gone when the server removes the entity (reel-in, rod no longer held, more than 32 blocks away: all the server's decisions), when the tracker forgets it (respawn, dimension change, configuration), or when the client's own tick removes it (1200 ticks on the ground, with ENTITY_PHYSICS).
  • The bite, 1.16.5 and 26.x: exact, the bobber's synced biting flag (CAUGHT_FISH, DATA_BITING); BiteEnded when the server clears it (the fish got away).
  • The bite, 1.8.9 and 1.12.2: a heuristic, as these servers send no flag. The server plays the bobber splash sound at the bobber when a fish bites (1.8.9 named_sound_effect random.splash, which no other vanilla 1.8.9 code plays; 1.12.2 sound_effect 153 entity.bobber.splash, played only by the bite): a splash within 2 blocks of our bobber's tracked position with no other tracked bobber nearer is our bite. biting stays set for the shortest hook time after the splash (10 ticks on 1.8.9, 20 on 1.12.2); no BiteEnded. The sound packets are read only while a bobber of ours is out. A plugin that silences or moves the sound hides the bite.
  • State: hooked while the server's synced hooked-entity id is set (1.12.2+; a 1.8.9 server does not send it), bobbing from the first tick its position holds water, flying before.
  • Cost: nothing per tick without a bobber of ours (a spawn of another type is dismissed by its type); with one, a tracker lookup and a block read per tick.

With ENTITY_PHYSICS the simulated bobber (see above) also follows a hooked entity (1.12.2, 1.16.5, 26.x: at 0.8 of its height, HookedEntity; a removed entity lets it fly again) and on 1.16.5 / 26.x takes the bite's jerk when the flag arrives and the pull while it bites. Both draw from the bobber's "synchronized" random, which vanilla seeds from the bobber's UUID and the world's game time at the start of each of its ticks, so a client draws them exactly (the bobbing itself still uses the unseeded entity random). Proof: tests/golden/<v>/fishing.jsonl.gz (oracle fishing: the real client bobber with the entity data applied through the client's own path before each tick and an armor stand it is hooked to, walked and removed; 1.16.5 and 26.x 44 cases / 2,669 ticks, 1.12.2 42 cases / 2,537 ticks (hook only), 0 diffs).

Not modelled: a bite flag that arrives before the bobber's first tick (vanilla draws that jerk from an unseeded random), the order of the hooked entity's own tick against the bobber's (the bobber reads the entity's position as the tracker has it), and the pull of an entity status 31 (a bobber reeled in while hooked to our player pulls our player on 1.12.2+; the server pulls other entities).

ghast-ext: bot.cast(), bot.wait_for_bite(ticks), bot.reel_in(), bot.fish(ticks) (equip a rod, cast, wait, reel in; recast when the bobber is lost without a bite), bot.bobber(), Event::Fishing. Example fishing. Live: lab/fishing.sh on 1.8.9, 1.12.2, 1.16.5, 26.1, 26.2 and 26.3 (2026-12-04): three casts each with a Lure V rod, every bite seen and reeled in, a catch in the inventory each time (cod, salmon, pufferfish, lily pad, raw fish), all PASS, 0 Grim flags.

Also for behaviours: ctx.send_raw(id, body) / ctx.send_packet(&p) (a serverbound play packet of the session's version, in call order with the other actions; protocol correctness is the caller's job), TickView::outbound() (the tick's packets as written) and prediction_sequence() (26.1+: the last block-prediction sequence number sent).

Inventory (ghast-inventory)

Every window packet is fed to ghast_inventory::Inventory on arrival; the inventory answers window confirms (exactly once — the engine does not). ctx.inventory(), ctx.click(Click) (refused while turning or when the inventory refuses: one click in flight, same-tick order rules, unpredictable results), ctx.open_inventory(), ctx.close_window(); ctx.events().inventory carries change flags and click results. The held stack drives dig speed (tool, efficiency from NBT) and placing; an open GUI releases the mouse buttons.

Grim compatibility (Client::force_step_position, off by default, NOT vanilla)

Grim 2.3.73 sets back two vanilla-exact situations found first, by the movement course (oracle replays of the exact recordings: ghast == vanilla, states and packets): (1) a landing step-up onto a 1/8-higher block (soul sand → grass) whose move stays under the 0.03-block resend threshold, so vanilla sends only look / flying with on-ground true (both versions); (2) 1.16.5 walking on slime (on-ground alternates every tick; GroundSpoof). With force_step_position(true) the client sends the position on ticks whose feet height changed under the threshold (and updates its sent bookkeeping): (1) disappears on both labs (16 min, 0 setbacks); (2) remains. The option is implemented on every version (on 1.12.2 and 26.x a status-only movement packet whose feet height changed gets the position; unit-tested), but shown to matter in the lab only on 1.8.9 and 1.16.5: on 26.3 the sub-threshold landing it exists for did not occur in 80 attempts (the code is the 26.1 / 26.2 one). Cases (3) – (12) below were found later.

(3) 26.2 (and 26.3), an idle fall onto slime whose landing move is below the position threshold (in the lab: exactly 20 blocks): Grim 2.3.74 and 2.3.75 (alpha e457d55) flag Simulation ≈ 0.0417 at the tail of the bounce, on every such drop. The player rests 6.2e-5 above the slime, the next tick's landing moves only that far, so the client sends flying(on_ground = true) without a position, then bounces. The real 26.2 client sends the same packets: oracle scenario slime_drop_20_long (tests/golden/26.2/scenarios.jsonl.gz), replayed through the engine packet for packet (restitution_drops_through_the_engine). The other heights of the 6 – 30 block sweep and the bed drop have no such tick and draw no flag. No client-side option fixes it: force_step_position covers case (1) on every version (a moved position under the threshold), but here the position did not change. Practical advice: behaviours should not stand still through a long slime bounce tail; any input (or a different height) avoids it. lab/slime-drops.sh 26.2 runs the sweep and reports this case as the expected flag.

(4) 1.8.9 / 1.12.2, a use restarted by the held right button in the tick it finished. A Paper server sends the finish (entity status 9) and, a tick later, the eaten stack's set_slot. By then the held button has started the next use on the client; the slot update puts a new stack object in the hand, and the real 1.8 / 1.12 client ends that use (its use is tied to the stack object) while the server keeps using. ghast does the same (oracle case use_apple_held_split_finish on all three legacy rows; 1.16.5 keeps the use). An anticheat that does not model the client's reset sees a few ticks of unslowed movement (Grim 2.3.73: NoSlow while sprint-eating with the button held). Behaviour-level answer, vanilla input throughout: release the button for one tick on the finish event, or press again only after the held slot's resync:

for e in ctx.events().item_use() {
    if matches!(e, UseEvent::Finished { .. }) {
        self.release_ticks = 1; // keep the right button up for one tick
    }
}
let right = self.want_use && self.release_ticks == 0;
self.release_ticks = self.release_ticks.saturating_sub(1);
ctx.set_buttons(Buttons { right, ..Buttons::default() });

(5) 26.x, a dismount that places the player above the ground next to the mount. Grim 2.3.73 and 2.3.74 flag one Simulation of 0.0046 in the free ticks after the server's dismount teleport (lab: the strider, which also pushes the player while their boxes overlap; 1.8 horses show the same value). The real 26.x client sends the same packets: oracle scenarios {strider,horse,pig,camel}_dismount_above_{0,1} and strider_dismount_above_lava (tests/golden/26.x/mounts_lab.jsonl.gz: teleport 0.5 or 1.3 blocks to the side, 0.4 or 1.2 above the ground, the mount's push included), replayed through the engine packet for packet on 26.1, 26.2 and 26.3 (mounts_lab_match_the_oracle). No client-side change can avoid it while staying vanilla.

(6) 26.x, a strider stepping from a one-deep lava pool up 0.5 onto grass. Grim 2.3.74 flags Simulation at the step, one to four flags of 0.0029 – 0.05 each (the same scene on 1.16.5 draws none). The real client sends the same packets: oracle scenarios strider_square_shore_{0,1} (the lab's course: a square over a one-deep lava pool on dirt with grass around, a boost per side) and the older strider_lava / strider_shore (mounts_steer.jsonl.gz), physics and engine replays 0 differences on every 26.x version.

(7) 1.16.5, getting off a floating boat onto its top: the server's teleport loop. A Paper server places the dismounted player exactly on the boat's top (lab: y 4.0857 over a boat at 3.5233). Its next teleport of the boat lifts the client's copy 0.00008 (the server's own float position), so the boat's box overlaps the standing player, which then falls through it; the server puts it back on top, the boat does not move, and the player falls again (21 teleports in the lab, 0 Grim flags). The real client does the same: oracle scenario dismount_boat_rises_under_player (tests/golden/1.16.5/dismounts.jsonl.gz, 13 cases of placements after a dismount), physics and engine replays 0 differences (dismounts_match_the_oracle_1_16_5). The lab also found a real bug, fixed: a 1.16.5 player_position packet takes a riding player off its vehicle at once (onPlayerPositionLook -> method_29239), so the tick after the server's placement no longer sends steer_boat without a movement packet. Practical advice: step off sideways (walk a tick) instead of standing on the boat.

(8) 1.8.9, a dismount that places the player above the ground on or beside the mount. Grim 2.3.73 / 2.3.74 flag one Simulation of 0.0046 in the free ticks after the server's dismount teleport on every horse / pig scene (the player falls through the mount, which the 1.8 client does not collide with). The real 1.8.9 client sends the same packets: oracle scenarios dismount_{horse,pig}_{0..6}[_teleport_first] (tests/golden/1.8.9/dismounts.jsonl.gz: placed 0.05 to 1.85 above the ground on, beside and off the mount's centre, the teleport before or after attach_entity), physics and engine replays 0 differences (dismounts_match_the_oracle_1_8_9). Same case as (5) on 26.x.

(9) 1.12.2, getting off a minecart: the first free tick after the server's placement. Grim 2.3.73 flags one Simulation of 0.15 at the tick after a Paper server places the player above the cart (lab: y 4.7125 over a cart at 4.0625 on a rail). In that tick the real 1.12 client does not move yet and sends position_look (position when it did not turn while seated: the riding look packets do not update the client's last sent rotation) at the placement; the fall starts a tick later. ghast sends the same: oracle scenarios dismount_cart_{0..3}[_turned, _teleport_first] (tests/golden/1.12.2/dismounts.jsonl.gz, also boats), physics and engine replays 0 differences (dismounts_match_the_oracle_1_12_2).

(10) 1.8.9 / 1.12.2 / 1.16.5, boarding a mount the server is moving. In the lab (natural wander, or lab/mounts.sh NUDGE: the console sets the mount's Motion back and forth) Grim 2.3.73 flags one or two Simulation of 0.11 – 0.52 at the first vehicle_move after the boarding in roughly a third to a half of the 1.12 / 1.16 horse, step and pig runs and sets the vehicle back, often to a place 1 – 1.5 blocks from the server's last position of the mount (the server keeps moving it). The server sends a zero velocity just before set_passengers. What the client sends is vanilla's: it starts from its own copy of the mob (the interpolated position, the steps left, the velocity of the last velocity packets, decayed; packets after the boarding as vanilla applies them), oracle-proven by tests/golden/{1.12.2,1.16.5}/mounts_board.jsonl.gz and 300 k cached ticks per version (watched 1 – 40 ticks while the server walks, pushes and teleports the mob, then ridden; physics and engine 0 differences). The real client sends the same packets in the lab sessions themselves: 40 recorded 1.16 runs (horse, step and pig, natural and NUDGE; 14 of them flagged 0.14 – 0.53) and 15 recorded 1.12 runs (pig, step and horse; 5 flagged 0.09 – 0.36), replayed through the vanilla client (oracle/run.sh replay --in) with the mount's packets from its spawn on, gave every packet identical bit for bit, the flagged vehicle_move included (270 – 740 ticks per run, from the join through the ride, the setback or the dismount). Grim's simulation of the boarding differs from the vanilla client's, not ghast's. On 1.8.9 the client sends only look + steer_vehicle while riding, whatever the mount does; the occasional setback there (to the seat over the server's mount, at boarding) is the server's.

(11) 26.x, boarding a mount the server moves: Simulation and AimModulo360 at the boarding. With lab/mounts.sh NUDGE (the mount's Motion set back and forth while the bot comes) or a nautilus that swims about in an open pool, Grim 2.3.74 flags at the first vehicle_move after set_passengers: on 26.1 a nautilus Simulation 0.13 – 0.80 with two setbacks (thrown off) and a horse 0.0017 – 0.0049; on 26.2 a pig 0.008 – 0.073 and a nautilus 0.49 with setbacks; on 26.3 a nautilus 0.005 – 0.007 with AimModulo360; on 26.1 AimModulo360 on a nautilus boarded after the bot walked into its open pool, where the first vehicle_move carries the interpolation's wrapped target yaw and the next the mount's own yaw next to the rider's unwrapped one. The real client sends the same packets: each of these runs was recorded (Client::record) and replayed through the vanilla client (oracle/run.sh replay --in), every vehicle_move from the boarding on identical (positions, rotations and ground flags bit for bit; up to 1011 riding ticks; a replay that diverges later does so where the scene's walls were removed, which a recording cannot express). The boarding itself is oracle-proven by tests/golden/26.x/mounts_wander.jsonl.gz, mounts_board_yaw.jsonl.gz and 200 k cached fuzz ticks per version (0 differences through the engine).

(12) 1.8.9, signing a book and quill (MC|BSign): an exception in Grim's ExploitB. The vanilla 1.8.9 book screen (BookEditScreen.finalizeBook) writes each page of a signed book through Text.Serializer as a LiteralText, and a plain literal text serializes as a bare JSON string ("page text", Gson's HTML-safe escaping), not as an object; ghast sends the same bytes (sign::gson_string, unit-tested). On a 1.8 server Grim 2.3.73 reads every signed page with a strict Gson JsonReader and expects {"text": …}: the server's Gson 2.2.4 refuses a top-level string in strict mode (MalformedJsonException), which Grim rethrows as a RuntimeException (a stack trace in the server log, no flag; the server still signs the book: lab/sign_book_bed.sh 1.8 passes with 0 flags). MC|BEdit (Done) sends plain pages and is not affected. ghast keeps the vanilla encoding.

Recording (Client::record(path), every version)

Writes the session in the oracle's replay format when it ends: setup = the player at the first movement step, with its exact bounding box (bb; 1.16.5 and 26.x also pose; 26.x also the attributes the server sent before, as attribute_bases / attribute_modifiers), so replays need no box rebuild; loaded_chunks / fills = every column loaded within 3 chunks of the player at any step, with its blocks as first seen (26.x: state ids named in states); one tick line per movement step with the input (keys, yaw, pitch, using item) and the inbound events applied before it (teleports — raw packet values with their flags, 26.x with the velocity delta; the reply the client sent in ghast_reply on 1.8 – 1.16 — our velocity (26.x: exact motion), abilities, effects, the speed attribute / 26.x attributes), plus ghast's own state and packets. Replay with MC=<row> oracle/run.sh replay --in <file> (row: 1.8.9, 1.12.2, 1.16.5, 26.1, 26.2, 26.3; sub-versions use their row) and compare with oracle/cache/replay_compare.py. Not representable (ghast_note once): block changes after a column was first seen, explosion pushes, gliding on 1.12.2, entity collisions on 26.x, and pushes and collisions of entities that are not recorded vehicles on 1.12.2. Riding is recorded for the vehicles whose spawn the session saw (26.x: mounts and boats; 1.16.5 / 1.12.2: living mounts): their packets from the spawn on as wire bytes (entity_packet events the oracle decodes and handles with the real classes; packets from before the first movement step go into its tick, noted), the hands, the server's vehicle_move with the client's answer, on 26.x the game time; 1.16.5 / 1.12.2 recordings keep our real entity id (entity_id in the setup: on 1.16.5 it decides where the player ticks among the entities, which orders the pushes; 26.x swaps it with the oracle's). Boats and minecarts on 1.16.5 / 1.12.2, and other entities around the player, are not recorded. A tick's state is the player's after the entity tick that follows its step (the pushes of the entities after it), as vanilla's. 1.12.2 starts at the first tick the player really ticks (its column has arrived). Checked 2026-11-16: a 40-tick session with an effect, a teleport, a velocity and a speed attribute replays in vanilla with identical state on every row (engine/tests/record.rs; GHAST_KEEP_RECORDINGS=<dir> keeps the files).

API stability (0.4)

Types the library fills in and may extend are #[non_exhaustive]: the events (TickEvents, RawInbound, TeleportEvent), the pose and status types (Pose, Health, Abilities, ChatMessage, Teleport, JoinGame), the crosshair results (BlockHit, EntityHit, RayResult), and the enums Inbound, Outbound, SessionEnd, ClientError, ClickRefused, GameVersion, Account, ForceStepPosition, ... (match them with a _ arm). New Minecraft versions arrive as new GameVersion variants in patch releases; GameVersion::ALL is a slice. Option structs are built with methods: ClientSettings::default().with_view_distance(4), WorldConfig::default().with_light(true). Plain inputs (Controls, Buttons, Vec3, the hands' BlockQuery / HeldItem / DigFactors) stay open structs.

Observers (viewers, recorders)

All read-only and free unless used:

  • Client::world_config(WorldConfig::default().with_light(true)…): what the world keeps besides block states (light, biomes, block entities; default: nothing extra).
  • ctx.world().column(cx, cz) / view.world().column(..): the stored ghast::world::Column (sections, light, biomes) for bulk reads, instead of one raw_block call per block.
  • ctx.swings(): arm swings written so far (behaviour, actions and held buttons).
  • Behavior::after_tick(&TickView): called after every movement step (also while on hold or after the behaviour finished) with the sent pose, world, entities, inventory and events.

Behaviour API reference and trace replay

PARITY.md describes the behaviour contract (Behavior + TickContext) member by member and records the trace replay: wheat plant / harvest traces recorded on a local lab server by a reference mineflayer-based bot, replayed through the engine, give the same packets in the same order on every tick (src/trace_replay.rs). PORTING.md is the guide for porting a mineflayer-style bot to ghast (before / after snippets, Grim settings, a one-process-per-bot runner).

Tests

cargo test -p ghast-client
  • src/engine/tests/general.rs: tick order (actions before the single movement packet, one per tick), join/teleport replies per version, standing packets (C06, then C03 with a C04 every 21st tick), silent guard, transactions, panicking behaviour, immediate respawn.
  • src/engine/tests/general.rs (parity): block-change events per version (1.16 section y sign), set_flying (needs "may fly", abilities before the move), running() == false stops the ticks, turn held on a place tick, click tickets.
  • src/engine/tests/general.rs: 1.8 planting uses the seed at once (not on stone, not for a block item).
  • src/trace_replay.rs: trace replay of the lab fixtures in tests/fixtures/traces/ (every tick identical), see PARITY.md.
  • src/movement.rs, src/rotation.rs: packet choice, GCD steps, Java float maths.
  • src/sim/tests.rs: the 1.8 physics' teleport equals the documented 1.8 rules; standing on and walking over a chunk decoded by ghast-world.
  • tests/fake_server.rs: an in-process fake server, every test for both versions: offline login with compression (and 1.8's mid-stream play compression), keep-alive, transaction, kick reason, login refusal, online mode without an account, server close (play and login), malformed packet, garbage compressed frame, read timeout, wire-level tick order, silent guard, clean shutdown, chat events, two bots on one multi-threaded runtime.
  • tests/cpu.rs (ignored; cargo test -p ghast-client --release --test cpu -- --ignored --nocapture): one bot against a busy fake 1.8 server (per tick a Grim-style transaction, 40 entity moves, 4 entity velocities; time and keep-alive): client thread CPU from /proc/thread-self/stat. WSL2 desktop, 2026-11-03: 50 ms CPU in 20 s = 0.25 % of one core at ~900 inbound packets/s.

Live results: 26.3 (local WSL labs, 2026-11-27)

On a vanilla 26.3 server: 5.5 min AFK without a kick; a 3-minute movement course ending at the server's position bit for bit; server teleports, respawns, and 34 digs / 34 places confirmed by the server.

On Paper 26.3 build 263 + Grim 2.3.74 (Grim's profile shows the client as "26.3"): AFK, dig / place incl. server teleports during a held dig, the movement course, pistons, item use, elytra, riptide, entities, the pathfinder course, attack, and the new 26.3 spots (shelf mushroom and straw bed landings, signs, poplar doors / gates): 0 Grim flags. The idle drop onto slime from 20 blocks reproduces corner case (3) as on 26.2. Also passed with LAB_VER=26.3: online-26.1.sh (encrypted login, signed chat and commands), proxy-switch.sh 10 (10 of 10 switches) and transfer.sh; a 31-minute mixed soak (339 walks, 168 digs, 168 places, 224 clicks): 0 flags, no kick; a 10-minute soak ended at the server's position bit for bit. A Paper 26.3 server logs "moved too quickly" on some first joins far from the world origin: the server measures the first teleport confirm before the player's first tick; the real client's join sequence draws the same lines (see lab/README.md).

Live results: 26.2 (local WSL lab, Paper 26.2 build 135 + Grim 2.3.74, 2026-11-12/13)

Every script the 26.1 lab passes, on 26.2 (LAB_VER=26.2 / <script> 26.2):

run result
AFK 1 min and 5 min 0 flags (5 min: CPU 0.41 % of a core, RSS 8.3 MB with every version compiled in)
movement_course 3 min, dig_place, attack 0 flags
airborne-join.sh 26.2 3 0 flags
use-items.sh 26.2 (golden apple, shield, bow while walking) 0 flags
elytra.sh, riptide.sh (water and rain) 0 flags
entities.sh crowd, boat, teams (collisionRule never: the 26.2 team layout), horse, villager, border, cart all PASS, 0 flags
inventory_probe (chest + clicks of every mode) PASS, 0 flags
pathfinder lab course (corridor, maze, follow) 0 failed legs, 0 setbacks, 0 flags
transfer.sh (2 transfers) PASS, 0 flags
proxy-switch.sh 4 (Velocity 3.5.1, two 26.2 backends, different heights) 4/4, 0 flags, RSS growth 0 %
online-26.1.sh with LAB_VER=26.2 (online mode, signed chat) PASS (signed chat secure, unsigned control refused), 0 flags
idle drops onto slime (8, 12, 30 blocks) and a bed (6) 0 flags
idle drop onto slime from 20 blocks Grim Simulation 0.0417 every time: corner case (3) above, vanilla-exact
dialog example (0.4.3 dev, 2026-11-13), dialogs shown with the vanilla /dialog show / /dialog clear run_command and dynamic/run_command sent (/me says $(msg) with a typed input ran on the server); /me without --confirm held as SignatureRequired by the server's command tree, the dialog left open; dynamic/custom sent and accepted (no disconnect); after_action: none kept the dialog open until /dialog clear. A configuration-state dialog cannot be shown with vanilla commands (fake-server test only)

Live results: 26.1 (local WSL lab, Paper 26.1.2 build 74 + Grim 2.3.74, 2026-11-11)

Native 26.1 connections (no ViaVersion); Grim's profile shows the bot as Version: 26.1, brand vanilla. The lab is a superflat world with the surface at y = 3 like the other labs (lab/templates/server-26.1.properties).

run result
AFK 30 s, then 10.5 min (view distance 8) 0 Grim flags, 0 kicks
movement_course 3 min (walk, sprint, sprint-jump, jump, sneak incl. an edge, slab, block, wall, fence, ice, packed ice, soul sand, slime, water) 0 flags, 0 setbacks
chat: a chat line, /msg, /say delivered ([Not Secure] = unsigned), whisper and /say rendered, no kick
dig_place 2 min (grass by hand, dirt placed back) 94 broken, 94 placed, 0 flags
inventory_probe PASS: chest opened, 30 clicks of every mode accepted, the server's resent contents equal the prediction (0 differing slots), 0 flags
attack 1 min next to an armor stand (entity tracking on), attack --burst on a breakable one 83 attacks + 28 interacts, 0 flags; the burst run breaks the stand (2 hits, removed + item dropped)
lab/airborne-join.sh 26.1 5 (log in 1 block above the ground, 5 times) 0 flags (Grim 2.3.74 and 2.3.75-e457d55)
lab/proxy-switch.sh 10: Velocity 3.5.1 + two backends (overworld y -64.. and a datapack overworld y -128..), /server ten times while walking 10/10 switches, the bot sees each backend's floor (-64 / -128), 0 flags on both backends, resident memory flat (6.0 → 4.6 MB over the switches)
lab/online-26.1.sh: online mode + enforce-secure-profile against a local account stand-in encryption + session join, signed chat, /say, /me, /msg accepted as secure, 0 flags; control run with --unsigned: chat refused ("missing profile public key")
lab/transfer.sh: /transfer back to the same server twice (--follow-transfers) both followed (3 logins), 0 flags
lab/elytra.sh 4: walk off a tower, glide with a turn, rockets, land 233 ticks gliding, 3 rockets attached and boosting, landed, 0 flags
lab/riptide.sh: riptide III trident in the water strip, then on grass in the rain 2 + 11 launches, 0 flags
lab/use-items.sh 26.1: golden apple, shield, bow while walking 0 flags
lab/entities.sh crowd: walk through 6 NoAI cows into an oak boat, entity tracking on, then off on: pushed aside and over the boat, 0 flags; off: walks straight through, also 0 flags (Grim 2.3.74 does not check entity collision or pushes)
lab/entities.sh horse / villager: sneak-click a tamed horse (saddle out and back), trade with a villager (select trade, take the result) horse screen 2 clicks, merchant screen 1 click, all confirmed as predicted, 0 flags
lab/entities.sh teams: two bots walk through each other, without a team, then in a collisionRule never team without: pushed apart; with: pass straight through (x unchanged); 0 flags both ways
lab/entities.sh boat: board an oak boat (right click with tracking, /ride without), paddle straight, left, right against the pool's edge, then from the ice strip onto grass, sneak off 3 runs, boarded and dismounted each, 0 flags
lab/entities.sh cart: seated by /ride, the cart runs ~35 blocks along powered rails, sneak off; tracking on and off 0 flags both
lab/entities.sh border: walk into a 24-wide border, keep walking while it shrinks to 10 stops at the edge (rounded out to whole blocks, as vanilla), the shrinking border passes, border damage kills, respawn, stops at the new edge, 0 flags
creative_probe (creative screen: clone, place, Q, drop outside, ctrl+Q) 6 clicks accepted, 0 corrections, 0 flags

AFK cost, lab/bench-afk.sh (30 s warm-up, 300 s), x86-64 WSL, one bot:

CPU (one core) worst 10 s RSS PSS threads
26.1, view distance 8 0.34 % 0.50 % 6.9 MB 5.3 MB 1
26.1, view distance 2 0.33 % 0.45 % 6.2 MB 4.8 MB 1
1.8.9 on the 1.8 lab (view distance 6), same machine 0.34 % 0.40 % 6.5 MB 5.2 MB 1

Live results: 1.12.2 (local WSL lab, Paper 1.12.2 build 1620 + Grim 2.3.73, 2026-11-07)

Account GhastBot13, release examples, each run under timeout -s TERM, ~33 min in total:

run duration activity Grim flags setbacks
afk (measured with lab/measure.sh, 300 s) 6.7 min standing at the spawn; CPU 0.13 % of one core (max 10 s 0.30 %), RSS 5.5 MB, PSS 4.0 MB, 1 thread 0 0
movement_course --seed 7 8 min 4 laps: ice, packed ice, soul sand, slime, water, slab step-up, block jump, sneak edge, wall / fence pushes, GCD turning 0 0
soak 12.7 min 127 walks, 63 digs, 63 places, 84 clicks (all accepted) 0 0
inventory_probe 0.5 min chest opened by right click, 30 clicks of every mode accepted, server contents equal the prediction (PASS) 0 0
dig_place 5 min 238 broken, 238 placed 0 0
chat 0.3 min chat sent and received 0 0

Live results: 30-min mixed soaks (local WSL labs, 2026-11-04)

crates/ghast/examples/soak.rs (walk / sprint / sprint-jump / sneak on open grass, dig + place with vanilla timing, inventory open / 4 clicks / close; --grim-compat, --record), 30 min per version, final binary:

1.8.9 (Paper 1.8.8 + Grim) 1.16.5 (Paper 1.16.5 + Grim)
activity 314 walks, 156 digs, 156 places, 208 clicks 306 walks, 153 digs, 153 places, 204 clicks
Grim flags 0 0
setbacks 1 — an external console tp of the account 0
click results all accepted all accepted
CPU (avg / max 10 s) 0.29 % / 0.50 % 0.31 % / 0.50 %
RSS max 59 MB (recording buffered in memory then; now streamed to a .part file) 54 MB (same)

An earlier 1.16 soak exposed the speed-attribute bug (sprint modifier excluded → Grim Simulation .002–.03); fixed before these runs. attack example (entity pick + attacks; 1.16 at full attack strength): 1.8 villager 30+ attacks, 1.16 armor stand 50+ attacks, 0 flags.

Live results: movement course, dig / place / use (local WSL labs, 2026-11-04)

crates/ghast/examples/movement_course.rs (ice, packed ice, soul sand, slime, water strips; slab step-up, block jump, sneak edge, wall and fence pushes, circles; GCD turning; seeded): 1.8.9 ~30 min, 1.16.5 ~25 min. All flags are the two Grim-vs-vanilla cases above; with --grim-compat 0 setbacks on both (1.16 slime GroundSpoof x2 per crossing remains). dig_place (left button dig with vanilla timing, place back; 1.8: stone by hand 151 ticks, 1.16: dirt) and use_item (golden apple eaten while walking: 32 ticks, ended by entity status 9; sword blocking; ×0.2 input) : 0 Grim flags. Found on the way: 1.8 C08 must carry the held stack (Grim BadPacketsU) — fixed; food only starts eating below a full bar — fixed.

Live results (local WSL labs, 2026-11-03)

lab/bench-afk.sh --warmup 30 --secs 600 -- target/.../release/examples/afk --host 127.0.0.1 --port 25618|25616 --username GhastBot2|GhastBot3 --version 1.8.9|1.16.5, both bots at the same time, standing at the superflat spawn:

1.8.9 (Paper 1.8.8 + Grim 2.3.73) 1.16.5 (Paper 1.16.5 + Grim 2.3.73)
connected 630 s, no disconnect 630 s, no disconnect
Grim flags 0 0 (after the 20-tick position refresh fix; before it, BadPacketsE every second)
CPU (one core, 600 s avg / max 10 s) 0.41 % / 0.69 % 0.31 % / 0.86 %
RSS / PSS 3.9 MB / 1.8 MB 3.8 MB / 2.1 MB
threads 1 1