Expand description
ghast: a headless Minecraft Java Edition client / bot library.
This facade re-exports the bot API of ghast-client at the top level and
the lower layers as modules:
| module | crate | what |
|---|---|---|
| (root) | ghast-client | Client, Behavior, TickContext, the tick loop |
protocol | ghast-protocol | packets per version, framing, compression, encryption, NBT |
auth | ghast-auth | offline identities, SOCKS5, login crypto, Microsoft accounts |
data | ghast-data | blocks, collision shapes, items, entities |
Supported versions: 1.8.9 and 1.16.5. See the afk and chat examples:
cargo run -p ghast --example afk -- --host localhost --port 25565 --username Bot --version 1.8.9Re-exports§
pub use ghast_protocol as protocol;pub use ghast_auth as auth;pub use ghast_data as data;
Modules§
- common
- The version-agnostic layer: what the client core receives from and sends to the server, independent of the protocol version.
- connect
- Re-exports of the connection setup types from
ghast-auth. - entity
- Entity tracking for the ghast Minecraft Java Edition client library (1.8.9 and 1.16.5).
- hands
- The mouse buttons in the world: digging, placing and using items, ported from 1.8.9
MinecraftClient.tick(doAttack,doUse,handleBlockBreaking) andClientPlayerInteractionManager(attackBlock,updateBlockBreakingProgress,cancelBlockBreaking,onRightClick,interactItem,stopUsingItem), verified against recorded lab packet traces. - inventory
- Inventory and container windows for the ghast Minecraft Java Edition client library (1.8.9 and 1.16.5).
- movement
- The per-tick movement packet (
ClientPlayerEntity.sendMovementPackets, 1.8 and 1.16) and the stand-in mover used untilghast-physicsis integrated. - rotation
- Rotation in whole mouse counts.
- version
- Per-version glue between the generated packets of
ghast-protocoland the common layer.
Structs§
- Block
Hit - A block the crosshair is on.
- Block
Pos - A block position.
x/zmust fit 26 signed bits,y12 signed bits to be encodable. - Buttons
- Mouse buttons held in the world (kept until changed; released by a join or respawn).
- Chat
Message - A chat message from the server. The text stays raw JSON until asked for.
- Click
Ticket - A click that was sent: match it with
TickEvents::inventory’sclickson a later tick (window id and action number, as the server’s confirm carries them). - Client
- A configured client: where to connect, which version, which account, and how.
- Client
Settings - Client settings (
settingspacket), sent right after join game like vanilla. - Controls
- Movement keys held for the next movement step (the keyboard state in vanilla).
- Health
- Health, food and saturation (
update_health). - Idle
- A behaviour that does nothing (the player stands still).
- Interests
- A set of optional packet groups (see the associated constants).
- Pose
- The player’s pose: feet position, look, motion and movement flags.
- RawInbound
- A clientbound play packet copied for the behaviour (
Behavior::raw_packets). - Tick
Context - The behaviour’s view of the client during one tick.
- Tick
Events - What happened since the behaviour’s previous tick.
- Vec3
- A position or direction in world space.
Enums§
- Account
- The account a client logs in with.
- Click
Refused - Why
TickContext::click(or opening / closing a window) sent nothing. - Client
Error - A session failed.
- Face
- A block face, as in the dig / place packets.
- Force
Step Position - Grim compatibility (not vanilla): when to send the position on a tick whose move stayed
under vanilla’s 0.03-block resend threshold. See
crates/ghast-physics/GRIM_NOTES.md. - Game
Mode - Game mode.
- Game
Version - A protocol version the client supports, chosen at run time.
- Session
End - How a session that reached the play state ended without an error.
Constants§
- TICK
- Length of one client tick.