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§
- Sound
Handle - 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),Nonefor an empty hand. - key_
down - Whether GLFW key
keyis held right now. - open_
ui_ flags - Open the Yog UI
ui_idwithui_flagsbits. - play_
sound - Play sound event
sound_idfor the local player only, at their position;loopingkeeps it playing (following the player) untilstop_sound. - set_
block_ tint - Tints the block at
posindimensionon this client — the faces of its model with atintindex —0xRRGGBB;Noneclears 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.