Expand description
Doing what a player does, for automation — tours, cut scenes, bots: moving (its own keys held), looking, attacking, using, mining, placing, picking a slot, clicking a container slot, chatting. No-ops on a dedicated server and without a player.
ⓘ
use yog_api::{client::player, control};
if let Some(me) = player::state() {
control::look(me.yaw + 90.0, 0.0);
control::drive(control::Drive { forward: 1.0, ..Default::default() });
}Structs§
Enums§
- Face
- A block’s side: the game’s
Direction.
Functions§
- attack
- Attacks entity
uuid, or (None) what the crosshair is on. - chat
- Sends
textto the chat — a command when it starts with/. - click
- Clicks
slotof the open container (buttonandmodeas the game’sClickType). - drive
- Holds
keysfor the player each tick, tillrelease. - look
- Turns the player to
yaw,pitch(degrees). - mine
- Keeps breaking the block at
posfromface(call each tick); whether it’s still there. - place
- Places the held block against the block at
pos, onface; whether the game took it. - release
- Gives the movement keys back to the player.
- select_
slot - Selects hotbar slot
slot(0–8). - stop_
mining - Stops breaking a block.
- use_
item - Uses the held item, the main hand’s or the off hand’s.