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§

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§

AdvancementDone
Whether this client’s player has advancement id.
AttributeValue
An attribute’s value on this client’s player.
BodyTrack
Asks the mods about entity uuid’s body each frame (on) or not.
BodyTrackType
The same for every entity of entity_type.
EntityData
What this client was told an entity keeps under key (the runtime keeps it).
HeldItem
What this client’s player holds.
KeyDown
Whether GLFW key key is held down.
PlaySound
Plays sound to this client’s player; its handle (to stop it).
ScreenSlots
The slots of the inventory screen this client has open (none when it has none).
SetBlockTint
Tints the block at pos on this client (0xRRGGBB; -1 clears it).
SetDimensions
This client’s side of an entity’s size (width < 0: vanilla’s).
SoundHandle
A sound started by play_sound; SoundHandle(0) is “none”.
StopSound
Stops a sound PlaySound started.

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 key is held down.
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.
screen_slots
The slots of the inventory screen this client has open (none when it has none).
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.
set_dimensions
This client’s side of an entity’s size (width < 0: vanilla’s).
stop_sound
Stop a sound from play_sound.