levilamina::client
Client-only capabilities.
On a server host this whole family is empty slots
Not a compile error but a runtime Err. Contract Β§2.1: the layout is identical on every
target and an absent capability is a NULL slot, so the same mod source compiles for both
targets and loading onto the wrong one is refused explicitly by the host during the
handshake, from mod_flags.
Decide with is_available and not with a cfg.
A callback runs on the client thread
Not the server thread. A hotkey callback must not touch server state.
Functions
client::is_available
| Rust |
|---|
| pub fn is_available() -> bool
|
Whether this host was built for the client target, meaning whether the client_* slots
are filled.
client::is_in_level
| Rust |
|---|
| pub fn is_in_level() -> Result<bool>
|
Whether the client is currently in a world.
client::local_player_name
| Rust |
|---|
| pub fn local_player_name() -> Result<String>
|
The name of the local player. Not being in a world is an Err.
client::screen_name
| Rust |
|---|
| pub fn screen_name() -> Result<String>
|
The current screen name, such as "hud_screen" or "pause_screen".
client::register_key
| Rust |
|---|
| pub fn register_key(
name: &str,
key_codes: &[i32],
allow_remap: bool,
handler: impl FnMut(KeyAction, i32) + Send + 'static,
) -> Result<KeyBinding>
|
Registers a hotkey.
key_codes is the default binding and allow_remap decides whether the player may
change it in the settings.
The callback receives (action, focus impact) and both run on the client thread.
- Parameters:
- name :
&str
- key_codes :
&[i32]
- allow_remap :
bool
- handler :
impl FnMut(KeyAction, i32) + Send + 'static
- Return type:
Result<KeyBinding>
- Slots:
client_register_key
client::property
| Rust |
|---|
| pub fn property(prop: i32) -> Result<f64>
|
One numeric client property by its PIER_CPROP_* key.
An Err covers a host without the slot, a key this host does not know, and a key about
the local player read while the client is not in a world.
client::local_position
| Rust |
|---|
| pub fn local_position() -> Result<[f64; 3]>
|
The local player's feet position as [x, y, z], the point get_player_position reports.
client::local_rotation
| Rust |
|---|
| pub fn local_rotation() -> Result<(f32, f32)>
|
The local player's (pitch, yaw) in degrees; a negative pitch looks up.
client::local_dimension
| Rust |
|---|
| pub fn local_dimension() -> Result<i32>
|
The id of the dimension the local player is in.
client::gui_scale
| Rust |
|---|
| pub fn gui_scale() -> Result<f32>
|
The GUI scale this client draws with.
client::server_ping_ms
| Rust |
|---|
| pub fn server_ping_ms() -> Result<u64>
|
The round trip to the server in milliseconds, as this client measures it.
| Rust |
|---|
| pub fn is_showing_menu() -> Result<bool>
|
Whether a menu screen is showing.
client::is_showing_pause_screen
| Rust |
|---|
| pub fn is_showing_pause_screen() -> Result<bool>
|
Whether the pause screen is showing.
client::is_playing
| Rust |
|---|
| pub fn is_playing() -> Result<bool>
|
Whether the client is playing a world.
client::is_in_realm
| Rust |
|---|
| pub fn is_in_realm() -> Result<bool>
|
Whether the world is a Realm.
| Rust |
|---|
| pub fn is_game_input_enabled() -> Result<bool>
|
Whether game input reaches the world, which a screen on top takes away.
client::top_screen_name
| Rust |
|---|
| pub fn top_screen_name() -> Result<String>
|
The topmost screen of the client's screen stack.
client::show_message
| Rust |
|---|
| pub fn show_message(text: &str) -> Result<()>
|
Shows text in this client's chat. Nothing is sent to a server.
client::set_title
| Rust |
|---|
| pub fn set_title(text: &str) -> Result<()>
|
Shows text as the title on this client.
client::set_subtitle
| Rust |
|---|
| pub fn set_subtitle(text: &str) -> Result<()>
|
Shows text as the subtitle on this client.
client::set_action_bar
| Rust |
|---|
| pub fn set_action_bar(text: &str) -> Result<()>
|
Shows text above the hotbar on this client.
client::show_tip
| Rust |
|---|
| pub fn show_tip(text: &str) -> Result<()>
|
Shows text as a tip on this client.
client::play_ui_sound
| Rust |
|---|
| pub fn play_ui_sound(name: &str, volume: f32, pitch: f32) -> Result<()>
|
Plays a UI sound by name on this client, such as "random.click".
- Parameters:
- name :
&str
- volume :
f32
- pitch :
f32
- Return type:
Result<()>
- Slots:
client_action
client::grab_mouse
| Rust |
|---|
| pub fn grab_mouse() -> Result<()>
|
Captures the mouse for the game, as a click into the world does.
client::release_mouse
| Rust |
|---|
| pub fn release_mouse() -> Result<()>
|
Releases the mouse to the screen.
| Rust |
|---|
| pub fn set_input_disabled(disabled: bool) -> Result<()>
|
Disables or enables game input.
client::leave_level
| Rust |
|---|
| pub fn leave_level() -> Result<()>
|
Leaves the current world for the menus. The engine does it asynchronously.
client::registered_keys
| Rust |
|---|
| pub fn registered_keys() -> Result<Vec<String>>
|
Every key binding name the key registry holds, whichever mod registered it.
client::has_key
| Rust |
|---|
| pub fn has_key(name: &str) -> Result<bool>
|
Whether a key binding of this name is registered.
| Rust |
|---|
| pub fn show_popup(message: &str, subtitle: &str) -> Result<()>
|
Shows a popup with an optional subtitle on this client.
- Parameters:
- message :
&str
- subtitle :
&str
- Return type:
Result<()>
- Slots:
client_action
client::show_dev_console_message
| Rust |
|---|
| pub fn show_dev_console_message(text: &str) -> Result<()>
|
Writes text to the client's developer console.
| Rust |
|---|
| pub fn set_suspend_input(suspended: bool) -> Result<()>
|
Suspends or resumes all input.
| Rust |
|---|
| pub fn set_suspend_directional_input(suspended: bool) -> Result<()>
|
Suspends or resumes movement input.
| Rust |
|---|
| pub fn set_game_input_enabled(enabled: bool) -> Result<()>
|
Enables or disables game input.
client::refocus_mouse
| Rust |
|---|
| pub fn refocus_mouse(lost: bool) -> Result<()>
|
Gives the mouse back to the game; lost tells the engine the focus was lost.
client::mute_audio
| Rust |
|---|
| pub fn mute_audio() -> Result<()>
|
Mutes the client's audio.
client::unmute_audio
| Rust |
|---|
| pub fn unmute_audio() -> Result<()>
|
Unmutes the client's audio.
client::fade_out_music
| Rust |
|---|
| pub fn fade_out_music() -> Result<()>
|
Fades out the music that is playing.
client::set_gui_scale_offset
| Rust |
|---|
| pub fn set_gui_scale_offset(offset: i32) -> Result<()>
|
Sets the GUI scale offset.
client::reset_player_movement
| Rust |
|---|
| pub fn reset_player_movement() -> Result<()>
|
Resets the local player's movement input.
client::push_leave_game_screen
| Rust |
|---|
| pub fn push_leave_game_screen() -> Result<()>
|
Opens the screen that asks whether to leave the world.
client::open_content_log_history
| Rust |
|---|
| pub fn open_content_log_history() -> Result<()>
|
Opens the content log history.
client::set_clipboard
| Rust |
|---|
| pub fn set_clipboard(text: &str) -> Result<()>
|
Writes text to the system clipboard.
client::navigate_how_to_play
| Rust |
|---|
| pub fn navigate_how_to_play(topic: &str) -> Result<()>
|
Opens the How to Play screen at topic, or at its start for an empty topic.
client::options
| Rust |
|---|
| pub fn options() -> Result<Vec<(String, String)>>
|
Every client option as (key, value) pairs, in the text form options.txt stores.
client::option
| Rust |
|---|
| pub fn option(key: &str) -> Result<String>
|
One client option by its options.txt key, such as "gfx_field_of_view".
client::set_option
| Rust |
|---|
| pub fn set_option(key: &str, value: &str) -> Result<()>
|
Writes one client option from its options.txt text form. The engine keeps what it can
parse and reports nothing, so a caller that needs to know reads the key back.
Client
The client as a value, for the property table below: Client.health() reads the local
player's health and Client.is_mouse_grabbed() asks the client instance.
- Implements:
Debug, Clone, Copy, Default, PartialEq, Eq
Client::pos_x
| Rust |
|---|
| pub fn pos_x(&self) -> Result<f64>
|
Client::pos_y
| Rust |
|---|
| pub fn pos_y(&self) -> Result<f64>
|
Client::pos_z
| Rust |
|---|
| pub fn pos_z(&self) -> Result<f64>
|
Client::pitch
| Rust |
|---|
| pub fn pitch(&self) -> Result<f64>
|
Client::yaw
| Rust |
|---|
| pub fn yaw(&self) -> Result<f64>
|
Client::dimension
| Rust |
|---|
| pub fn dimension(&self) -> Result<i32>
|
Client::gui_scale
| Rust |
|---|
| pub fn gui_scale(&self) -> Result<f64>
|
Client::server_ping_ms
| Rust |
|---|
| pub fn server_ping_ms(&self) -> Result<f64>
|
| Rust |
|---|
| pub fn is_showing_menu(&self) -> Result<bool>
|
Client::is_showing_pause_screen
| Rust |
|---|
| pub fn is_showing_pause_screen(&self) -> Result<bool>
|
Client::is_playing
| Rust |
|---|
| pub fn is_playing(&self) -> Result<bool>
|
Client::is_in_realm
| Rust |
|---|
| pub fn is_in_realm(&self) -> Result<bool>
|
| Rust |
|---|
| pub fn is_game_input_enabled(&self) -> Result<bool>
|
Client::health
| Rust |
|---|
| pub fn health(&self) -> Result<f64>
|
Client::max_health
| Rust |
|---|
| pub fn max_health(&self) -> Result<f64>
|
Client::is_on_ground
| Rust |
|---|
| pub fn is_on_ground(&self) -> Result<bool>
|
Client::is_in_water
| Rust |
|---|
| pub fn is_in_water(&self) -> Result<bool>
|
Client::is_sneaking
| Rust |
|---|
| pub fn is_sneaking(&self) -> Result<bool>
|
Client::is_sprinting
| Rust |
|---|
| pub fn is_sprinting(&self) -> Result<bool>
|
Client::is_swimming
| Rust |
|---|
| pub fn is_swimming(&self) -> Result<bool>
|
Client::is_on_fire
| Rust |
|---|
| pub fn is_on_fire(&self) -> Result<bool>
|
Client::is_flying
| Rust |
|---|
| pub fn is_flying(&self) -> Result<bool>
|
Client::game_type
| Rust |
|---|
| pub fn game_type(&self) -> Result<i32>
|
Client::selected_slot
| Rust |
|---|
| pub fn selected_slot(&self) -> Result<i32>
|
Client::vel_x
| Rust |
|---|
| pub fn vel_x(&self) -> Result<f64>
|
Client::vel_y
| Rust |
|---|
| pub fn vel_y(&self) -> Result<f64>
|
Client::vel_z
| Rust |
|---|
| pub fn vel_z(&self) -> Result<f64>
|
Client::xp_needed_next_level
| Rust |
|---|
| pub fn xp_needed_next_level(&self) -> Result<f64>
|
Client::is_leaving_game
| Rust |
|---|
| pub fn is_leaving_game(&self) -> Result<bool>
|
Client::is_exiting_level
| Rust |
|---|
| pub fn is_exiting_level(&self) -> Result<bool>
|
Client::is_in_bed_screen
| Rust |
|---|
| pub fn is_in_bed_screen(&self) -> Result<bool>
|
Client::is_in_death_screen
| Rust |
|---|
| pub fn is_in_death_screen(&self) -> Result<bool>
|
Client::is_showing_loading_screen
| Rust |
|---|
| pub fn is_showing_loading_screen(&self) -> Result<bool>
|
Client::is_showing_progress_screen
| Rust |
|---|
| pub fn is_showing_progress_screen(&self) -> Result<bool>
|
Client::is_showing_world_progress_screen
| Rust |
|---|
| pub fn is_showing_world_progress_screen(&self) -> Result<bool>
|
Client::is_showing_death_screen
| Rust |
|---|
| pub fn is_showing_death_screen(&self) -> Result<bool>
|
| Rust |
|---|
| pub fn is_showing_server_form(&self) -> Result<bool>
|
| Rust |
|---|
| pub fn is_in_world_without_menu(&self) -> Result<bool>
|
Client::is_world_active
| Rust |
|---|
| pub fn is_world_active(&self) -> Result<bool>
|
Client::has_level
| Rust |
|---|
| pub fn has_level(&self) -> Result<bool>
|
Client::is_pre_game
| Rust |
|---|
| pub fn is_pre_game(&self) -> Result<bool>
|
Client::is_in_multiplayer_game
| Rust |
|---|
| pub fn is_in_multiplayer_game(&self) -> Result<bool>
|
Client::is_multiplayer_client
| Rust |
|---|
| pub fn is_multiplayer_client(&self) -> Result<bool>
|
Client::is_primary_level_multiplayer
| Rust |
|---|
| pub fn is_primary_level_multiplayer(&self) -> Result<bool>
|
| Rust |
|---|
| pub fn is_primary_level_cross_platform(&self) -> Result<bool>
|
Client::is_keyboard_enabled
| Rust |
|---|
| pub fn is_keyboard_enabled(&self) -> Result<bool>
|
Client::is_using_controller
| Rust |
|---|
| pub fn is_using_controller(&self) -> Result<bool>
|
Client::is_using_touchscreen
| Rust |
|---|
| pub fn is_using_touchscreen(&self) -> Result<bool>
|
Client::is_mouse_grabbed
| Rust |
|---|
| pub fn is_mouse_grabbed(&self) -> Result<bool>
|
Client::is_mouse_and_keyboard
| Rust |
|---|
| pub fn is_mouse_and_keyboard(&self) -> Result<bool>
|
Client::has_connected_controller
| Rust |
|---|
| pub fn has_connected_controller(&self) -> Result<bool>
|
Client::controller_id
| Rust |
|---|
| pub fn controller_id(&self) -> Result<i32>
|
Client::is_touch_gameplay_allowed
| Rust |
|---|
| pub fn is_touch_gameplay_allowed(&self) -> Result<bool>
|
Client::is_split_screen_active
| Rust |
|---|
| pub fn is_split_screen_active(&self) -> Result<bool>
|
Client::split_screen_count
| Rust |
|---|
| pub fn split_screen_count(&self) -> Result<i32>
|
Client::gui_scale_offset
| Rust |
|---|
| pub fn gui_scale_offset(&self) -> Result<i32>
|
Client::is_edu_mode
| Rust |
|---|
| pub fn is_edu_mode(&self) -> Result<bool>
|
Client::is_in_editor
| Rust |
|---|
| pub fn is_in_editor(&self) -> Result<bool>
|
Client::is_ready_to_render
| Rust |
|---|
| pub fn is_ready_to_render(&self) -> Result<bool>
|
Client::is_full_vanilla_pack_on_stack
| Rust |
|---|
| pub fn is_full_vanilla_pack_on_stack(&self) -> Result<bool>
|
Client::server_connection_time
| Rust |
|---|
| pub fn server_connection_time(&self) -> Result<f64>
|
Client::remote_server_time_ms
| Rust |
|---|
| pub fn remote_server_time_ms(&self) -> Result<f64>
|
Client::remote_server_network_time_ms
| Rust |
|---|
| pub fn remote_server_network_time_ms(&self) -> Result<f64>
|
Client::frame_alpha
| Rust |
|---|
| pub fn frame_alpha(&self) -> Result<f64>
|
Client::game_update_seconds
| Rust |
|---|
| pub fn game_update_seconds(&self) -> Result<f64>
|
Client::is_primary_client
| Rust |
|---|
| pub fn is_primary_client(&self) -> Result<bool>
|
Client::user_id
| Rust |
|---|
| pub fn user_id(&self) -> Result<i32>
|
Client::is_gameplay_tips_enabled
| Rust |
|---|
| pub fn is_gameplay_tips_enabled(&self) -> Result<bool>
|
Client::has_commands
| Rust |
|---|
| pub fn has_commands(&self) -> Result<bool>
|
Client::screen_name
| Rust |
|---|
| pub fn screen_name(&self) -> Result<String>
|
Client::top_screen_name
| Rust |
|---|
| pub fn top_screen_name(&self) -> Result<String>
|
| Rust |
|---|
| pub fn platform_id(&self) -> Result<String>
|
| Rust |
|---|
| pub fn platform_online_id(&self) -> Result<String>
|
Client::local_xuid
| Rust |
|---|
| pub fn local_xuid(&self) -> Result<String>
|
Client::local_uuid
| Rust |
|---|
| pub fn local_uuid(&self) -> Result<String>
|
Client::local_name_tag
| Rust |
|---|
| pub fn local_name_tag(&self) -> Result<String>
|
Client::clipboard
| Rust |
|---|
| pub fn clipboard(&self) -> Result<String>
|
KeyBinding
| Rust |
|---|
| pub struct KeyBinding {
// private fields
}
|
One registered hotkey. Dropping it deregisters.
KeyBinding::name
| Rust |
|---|
| pub fn name(&self) -> &str
|
KeyBinding::key_codes
| Rust |
|---|
| pub fn key_codes(&self) -> Result<Vec<i32>>
|
The key codes currently bound. They differ from the defaults once the player has
rebound them.
KeyBinding::forget
Keeps it alive until the mod unloads, when the host clears it.
KeyAction
| Rust |
|---|
| pub enum KeyAction {
Up,
Down,
/// The host reported an action code this side does not recognize.
Unknown(i32),
}
|
A key action.
- Implements:
Debug, Clone, Copy, PartialEq, Eq
KeyAction::from_i32
| Rust |
|---|
| pub fn from_i32(v: i32) -> KeyAction
|
- Parameters:
- Return type:
KeyAction
KeyAction::is_down
| Rust |
|---|
| pub fn is_down(self) -> bool
|