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§
- control
- This client’s player doing what a player does — its own keys held, its clicks — for tours, cut scenes, bots: the host’s actions (nothing on a dedicated server, nor without a player).
- game
- The game running on the client.
- input
- What the player presses.
- keys
- GLFW key codes for
key_down. - local
- What this client’s player is and sees: the host’s actions (nothing on a dedicated server, nor without a player).
- net
- What the client hears over the network.
- render
- What the client draws.
- ui
- Screens opened and closed.
- ui_
flags - Flag bits for
OpenWithFlags.
Structs§
- Advancement
Done - Whether this client’s player has advancement
id. - Attribute
Value - An attribute’s value on this client’s player.
- Body
Track - Asks the mods about entity
uuid’s body each frame (on) or not. - Body
Track Type - The same for every entity of
entity_type. - Entity
Data - What this client was told an entity keeps under
key(the runtime keeps it). - Held
Item - What this client’s player holds.
- KeyDown
- Whether GLFW key
keyis held down. - Play
Sound - Plays
soundto this client’s player; its handle (to stop it). - Screen
Slots - The slots of the inventory screen this client has open (none when it has none).
- SetBlock
Tint - Tints the block at
poson this client (0xRRGGBB; -1 clears it). - SetDimensions
- This client’s side of an entity’s size (
width< 0: vanilla’s). - Sound
Handle - A sound started by
play_sound;SoundHandle(0)is “none”. - Stop
Sound - Stops a sound
PlaySoundstarted.
Functions§
- advancement_
done - Whether this client’s player has advancement
id. - attribute_
value - An attribute’s value on this client’s player.
- body_
track - Asks the mods about entity
uuid’s body each frame (on) or not. - body_
track_ type - The same for every entity of
entity_type. - control_
down - Either Control key is held (Minecraft’s
Screen.hasControlDown(); on macOS Minecraft uses Command — not covered here). - held_
item - What this client’s player holds.
- key_
down - Whether GLFW key
keyis held down. - 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. - screen_
slots - The slots of the inventory screen this client has open (none when it has none).
- 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. - set_
dimensions - This client’s side of an entity’s size (
width< 0: vanilla’s). - stop_
sound - Stop a sound from
play_sound.