Skip to main content

Module client

Module client 

Source
Expand description

Client-side helpers (ABI minor 1): opening a screen with flags, sounds only the local player hears, the local player’s held items and the keyboard state. All are no-ops (or None/false) on a dedicated server and before the mod registered.

ⓘ
use yog_api::client::{self, ui_flags};
client::open_ui_flags("mymod:overlay", ui_flags::MODAL | ui_flags::NO_BACKGROUND);
let loop_ = client::play_sound("mymod:hum", 1.0, 1.0, true);
client::stop_sound(loop_);

Modules§

keys
GLFW key codes for key_down.
ui_flags
Flag bits for YogApi::ui_open_flags.

Structs§

SoundHandle
A sound started by play_sound; SoundHandle(0) is “none”.

Functions§

control_down
Either Control key is held (Minecraft’s Screen.hasControlDown(); on macOS Minecraft uses Command — not covered here).
held_item
Item id in the local player’s main hand (or off_hand), None for an empty hand.
key_down
Whether GLFW key key is held right now.
open_ui_flags
Open the Yog UI ui_id with ui_flags bits.
play_sound
Play sound event sound_id for the local player only, at their position; looping keeps it playing (following the player) until stop_sound.
set_block_tint
Tints the block at pos in dimension on this client — the faces of its model with a tint index — 0xRRGGBB; None clears it. The mod sends what to tint (its own packet); the tint lasts till cleared or the game closes.
stop_sound
Stop a sound from play_sound.