Skip to main content

Module control

Module control 

Source
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§

Drive
Movement keys held for the player, till release.

Enums§

Face
A block’s side: the game’s Direction.

Functions§

attack
Attacks entity uuid, or (None) what the crosshair is on.
chat
Sends text to the chat — a command when it starts with /.
click
Clicks slot of the open container (button and mode as the game’s ClickType).
drive
Holds keys for the player each tick, till release.
look
Turns the player to yaw, pitch (degrees).
mine
Keeps breaking the block at pos from face (call each tick); whether it’s still there.
place
Places the held block against the block at pos, on face; 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.