Zig: Client¶
Declarations¶
client.KeyHandler¶
| Zig | |
|---|---|
Called on the client thread for each press and release of a registered key: the user pointer given at registration, the action, and the focus impact the engine reports.
Functions¶
client.property¶
| Zig | |
|---|---|
One numeric client property by its PIER_CPROP_* key. NoAnswer for a key this host does not know, or a key about the local player while the client is not in a world.
- Parameters:
- prop :
i32
- prop :
- Return type:
core.Error!f64 - Slots:
client_get_num
client.localPosition¶
| Zig | |
|---|---|
The local player's feet position: x, y and z.
- Return type:
core.Error![3]f64 - Slots:
client_get_num
client.localRotation¶
| Zig | |
|---|---|
The local player's pitch and yaw in degrees; a negative pitch looks up.
- Return type:
core.Error![2]f64 - Slots:
client_get_num
client.localDimension¶
| Zig | |
|---|---|
The id of the dimension the local player is in.
- Return type:
core.Error!i32 - Slots:
client_get_num
client.guiScale¶
| Zig | |
|---|---|
The GUI scale this client draws with.
- Return type:
core.Error!f64 - Slots:
client_get_num
client.serverPingMs¶
| Zig | |
|---|---|
The round trip to the server in milliseconds, as this client measures it.
- Return type:
core.Error!f64 - Slots:
client_get_num
client.isShowingMenu¶
| Zig | |
|---|---|
Whether a menu screen is showing.
- Return type:
core.Error!bool - Slots:
client_get_num
client.isShowingPauseScreen¶
| Zig | |
|---|---|
Whether the pause screen is showing.
- Return type:
core.Error!bool - Slots:
client_get_num
client.isPlaying¶
| Zig | |
|---|---|
Whether the client is playing a world.
- Return type:
core.Error!bool - Slots:
client_get_num
client.isInRealm¶
| Zig | |
|---|---|
Whether the world is a Realm.
- Return type:
core.Error!bool - Slots:
client_get_num
client.isGameInputEnabled¶
| Zig | |
|---|---|
Whether game input reaches the world, which a screen on top takes away.
- Return type:
core.Error!bool - Slots:
client_get_num
client.topScreenName¶
| Zig | |
|---|---|
The topmost screen of the client's screen stack, owned by the caller.
- Parameters:
- allocator :
std.mem.Allocator
- allocator :
- Return type:
(core.Error || std.mem.Allocator.Error)![]u8 - Slots:
client_get_str
client.registeredKeys¶
| Zig | |
|---|---|
Every key binding name the key registry holds, whichever mod registered it. The caller frees each name and the slice.
- Parameters:
- allocator :
std.mem.Allocator
- allocator :
- Return type:
(core.Error || std.mem.Allocator.Error)![][]u8 - Slots:
client_list_keys
client.showMessage¶
| Zig | |
|---|---|
Shows text in this client's chat. Nothing is sent to a server.
- Parameters:
- text :
[]const u8
- text :
- Return type:
core.Error!void - Slots:
client_action
client.setTitle¶
| Zig | |
|---|---|
Shows text as the title on this client.
- Parameters:
- text :
[]const u8
- text :
- Return type:
core.Error!void - Slots:
client_action
client.setSubtitle¶
| Zig | |
|---|---|
Shows text as the subtitle on this client.
- Parameters:
- text :
[]const u8
- text :
- Return type:
core.Error!void - Slots:
client_action
client.setActionBar¶
| Zig | |
|---|---|
Shows text above the hotbar on this client.
- Parameters:
- text :
[]const u8
- text :
- Return type:
core.Error!void - Slots:
client_action
client.showTip¶
| Zig | |
|---|---|
Shows text as a tip on this client.
- Parameters:
- text :
[]const u8
- text :
- Return type:
core.Error!void - Slots:
client_action
client.playUiSound¶
| Zig | |
|---|---|
Plays a UI sound by name on this client, such as "random.click".
- Parameters:
- name :
[]const u8 - volume :
f64 - pitch :
f64
- name :
- Return type:
core.Error!void - Slots:
client_action
client.grabMouse¶
| Zig | |
|---|---|
Captures the mouse for the game, as a click into the world does.
- Return type:
core.Error!void - Slots:
client_action
client.releaseMouse¶
| Zig | |
|---|---|
Releases the mouse to the screen.
- Return type:
core.Error!void - Slots:
client_action
client.setInputDisabled¶
| Zig | |
|---|---|
Disables or enables game input.
- Parameters:
- disabled :
bool
- disabled :
- Return type:
core.Error!void - Slots:
client_action
client.leaveLevel¶
| Zig | |
|---|---|
Leaves the current world for the menus. The engine does it asynchronously.
- Return type:
core.Error!void - Slots:
client_action
client.health¶
| Zig | |
|---|---|
Actor::getHealth of the local player
- Return type:
core.Error!f64 - Slots:
client_get_num
client.maxHealth¶
| Zig | |
|---|---|
Actor::getMaxHealth of the local player
- Return type:
core.Error!f64 - Slots:
client_get_num
client.isOnGround¶
| Zig | |
|---|---|
Actor::isOnGround of the local player
- Return type:
core.Error!bool - Slots:
client_get_num
client.isInWater¶
| Zig | |
|---|---|
Actor::isInWater of the local player
- Return type:
core.Error!bool - Slots:
client_get_num
client.isSneaking¶
| Zig | |
|---|---|
Actor::isSneaking of the local player
- Return type:
core.Error!bool - Slots:
client_get_num
client.isSprinting¶
| Zig | |
|---|---|
Actor::isSprinting of the local player
- Return type:
core.Error!bool - Slots:
client_get_num
client.isSwimming¶
| Zig | |
|---|---|
Actor::isSwimming of the local player
- Return type:
core.Error!bool - Slots:
client_get_num
client.isOnFire¶
| Zig | |
|---|---|
Actor::isOnFire of the local player
- Return type:
core.Error!bool - Slots:
client_get_num
client.isFlying¶
| Zig | |
|---|---|
Player::isFlying of the local player
- Return type:
core.Error!bool - Slots:
client_get_num
client.gameType¶
| Zig | |
|---|---|
Player::getPlayerGameType of the local player
- Return type:
core.Error!f64 - Slots:
client_get_num
client.selectedSlot¶
| Zig | |
|---|---|
Player::getSelectedItemSlot of the local player
- Return type:
core.Error!f64 - Slots:
client_get_num
client.velX¶
| Zig | |
|---|---|
Actor::getPosDelta of the local player, blocks per tick
- Return type:
core.Error!f64 - Slots:
client_get_num
client.velY¶
| Zig | |
|---|---|
Actor::getPosDelta, the vertical part
- Return type:
core.Error!f64 - Slots:
client_get_num
client.velZ¶
| Zig | |
|---|---|
Actor::getPosDelta, the z part
- Return type:
core.Error!f64 - Slots:
client_get_num
client.xpNeededNextLevel¶
| Zig | |
|---|---|
Player::getXpNeededForNextLevel of the local player
- Return type:
core.Error!f64 - Slots:
client_get_num
client.isLeavingGame¶
| Zig | |
|---|---|
IClientInstance::isLeavingGame
- Return type:
core.Error!bool - Slots:
client_get_num
client.isExitingLevel¶
| Zig | |
|---|---|
IClientInstance::isExitingLevel
- Return type:
core.Error!bool - Slots:
client_get_num
client.isInBedScreen¶
| Zig | |
|---|---|
IClientInstance::isInBedScreen
- Return type:
core.Error!bool - Slots:
client_get_num
client.isInDeathScreen¶
| Zig | |
|---|---|
IClientInstance::isInDeathScreen
- Return type:
core.Error!bool - Slots:
client_get_num
client.isShowingLoadingScreen¶
| Zig | |
|---|---|
IClientInstance::isShowingLoadingScreen
- Return type:
core.Error!bool - Slots:
client_get_num
client.isShowingProgressScreen¶
| Zig | |
|---|---|
IClientInstance::isShowingProgressScreen
- Return type:
core.Error!bool - Slots:
client_get_num
client.isShowingWorldProgressScreen¶
| Zig | |
|---|---|
IClientInstance::isShowingWorldProgressScreen
- Return type:
core.Error!bool - Slots:
client_get_num
client.isShowingDeathScreen¶
| Zig | |
|---|---|
IClientInstance::isShowingDeathScreen
- Return type:
core.Error!bool - Slots:
client_get_num
client.isShowingServerForm¶
| Zig | |
|---|---|
IClientInstance::isShowingServerForm
- Return type:
core.Error!bool - Slots:
client_get_num
client.isInWorldWithoutMenu¶
| Zig | |
|---|---|
IClientInstance::isInWorldAndNotShowingAnyMenuScreens
- Return type:
core.Error!bool - Slots:
client_get_num
client.isWorldActive¶
| Zig | |
|---|---|
IClientInstance::isWorldActive
- Return type:
core.Error!bool - Slots:
client_get_num
client.hasLevel¶
| Zig | |
|---|---|
IClientInstance::hasLevel
- Return type:
core.Error!bool - Slots:
client_get_num
client.isPreGame¶
| Zig | |
|---|---|
IClientInstance::isPreGame
- Return type:
core.Error!bool - Slots:
client_get_num
client.isInMultiplayerGame¶
| Zig | |
|---|---|
IClientInstance::isInMultiplayerGame
- Return type:
core.Error!bool - Slots:
client_get_num
client.isMultiplayerClient¶
| Zig | |
|---|---|
IClientInstance::isMultiPlayerClient
- Return type:
core.Error!bool - Slots:
client_get_num
client.isPrimaryLevelMultiplayer¶
| Zig | |
|---|---|
IClientInstance::isPrimaryLevelMultiplayer
- Return type:
core.Error!bool - Slots:
client_get_num
client.isPrimaryLevelCrossPlatform¶
| Zig | |
|---|---|
IClientInstance::isPrimaryLevelCrossPlatformMultiplayer
- Return type:
core.Error!bool - Slots:
client_get_num
client.isKeyboardEnabled¶
| Zig | |
|---|---|
IClientInstance::isKeyboardEnabled
- Return type:
core.Error!bool - Slots:
client_get_num
client.isUsingController¶
| Zig | |
|---|---|
IClientInstance::useController
- Return type:
core.Error!bool - Slots:
client_get_num
client.isUsingTouchscreen¶
| Zig | |
|---|---|
IClientInstance::useTouchscreen
- Return type:
core.Error!bool - Slots:
client_get_num
client.isMouseGrabbed¶
| Zig | |
|---|---|
IClientInstance::getMouseGrabbed
- Return type:
core.Error!bool - Slots:
client_get_num
client.isMouseAndKeyboard¶
| Zig | |
|---|---|
IClientInstance::currentInputModeIsMouseAndKeyboard
- Return type:
core.Error!bool - Slots:
client_get_num
client.hasConnectedController¶
| Zig | |
|---|---|
IClientInstance::hasConnectedController
- Return type:
core.Error!bool - Slots:
client_get_num
client.controllerId¶
| Zig | |
|---|---|
IClientInstance::getControllerId
- Return type:
core.Error!f64 - Slots:
client_get_num
client.isTouchGameplayAllowed¶
| Zig | |
|---|---|
IClientInstance::isTouchGameplayAllowed
- Return type:
core.Error!bool - Slots:
client_get_num
client.isSplitScreenActive¶
| Zig | |
|---|---|
IClientInstance::isSplitScreenActive
- Return type:
core.Error!bool - Slots:
client_get_num
client.splitScreenCount¶
| Zig | |
|---|---|
IClientInstance::getSplitScreenCount
- Return type:
core.Error!f64 - Slots:
client_get_num
client.guiScaleOffset¶
| Zig | |
|---|---|
IClientInstance::getGuiScaleOffset
- Return type:
core.Error!f64 - Slots:
client_get_num
client.isEduMode¶
| Zig | |
|---|---|
IClientInstance::isEduMode
- Return type:
core.Error!bool - Slots:
client_get_num
client.isInEditor¶
| Zig | |
|---|---|
IClientInstance::isPlayerInEditor
- Return type:
core.Error!bool - Slots:
client_get_num
client.isReadyToRender¶
| Zig | |
|---|---|
IClientInstance::isReadyToRender
- Return type:
core.Error!bool - Slots:
client_get_num
client.isFullVanillaPackOnStack¶
| Zig | |
|---|---|
IClientInstance::isFullVanillaPackOnStack
- Return type:
core.Error!bool - Slots:
client_get_num
client.serverConnectionTime¶
| Zig | |
|---|---|
IClientInstance::getServerConnectionTime
- Return type:
core.Error!f64 - Slots:
client_get_num
client.remoteServerTimeMs¶
| Zig | |
|---|---|
IClientInstance::getRemoteServerTimeMs
- Return type:
core.Error!f64 - Slots:
client_get_num
client.remoteServerNetworkTimeMs¶
| Zig | |
|---|---|
IClientInstance::getRemoteServerNetworkTimeMs
- Return type:
core.Error!f64 - Slots:
client_get_num
client.frameAlpha¶
| Zig | |
|---|---|
IClientInstance::getFrameAlpha, how far the frame is between two ticks
- Return type:
core.Error!f64 - Slots:
client_get_num
client.gameUpdateSeconds¶
| Zig | |
|---|---|
IClientInstance::getGameUpdateDurationInSeconds
- Return type:
core.Error!f64 - Slots:
client_get_num
client.isPrimaryClient¶
| Zig | |
|---|---|
IClientInstance::isPrimaryClient
- Return type:
core.Error!bool - Slots:
client_get_num
client.userId¶
| Zig | |
|---|---|
IClientInstance::getUserId
- Return type:
core.Error!f64 - Slots:
client_get_num
client.isGameplayTipsEnabled¶
| Zig | |
|---|---|
IClientInstance::isGamePlayTipsEnabled
- Return type:
core.Error!bool - Slots:
client_get_num
client.hasCommands¶
| Zig | |
|---|---|
IClientInstance::hasCommands
- Return type:
core.Error!bool - Slots:
client_get_num
client.platformId¶
| Zig | |
|---|---|
IClientInstance::getPlatformId
- Parameters:
- allocator :
std.mem.Allocator
- allocator :
- Return type:
(core.Error || std.mem.Allocator.Error)![]u8 - Slots:
client_get_str
client.platformOnlineId¶
| Zig | |
|---|---|
IClientInstance::getPlatformOnlineId
- Parameters:
- allocator :
std.mem.Allocator
- allocator :
- Return type:
(core.Error || std.mem.Allocator.Error)![]u8 - Slots:
client_get_str
client.localXuid¶
| Zig | |
|---|---|
Player::getXuid of the local player; fails outside a world
- Parameters:
- allocator :
std.mem.Allocator
- allocator :
- Return type:
(core.Error || std.mem.Allocator.Error)![]u8 - Slots:
client_get_str
client.localUuid¶
| Zig | |
|---|---|
Player::getUuid of the local player in its canonical form
- Parameters:
- allocator :
std.mem.Allocator
- allocator :
- Return type:
(core.Error || std.mem.Allocator.Error)![]u8 - Slots:
client_get_str
client.localNameTag¶
| Zig | |
|---|---|
Actor::getNameTag of the local player
- Parameters:
- allocator :
std.mem.Allocator
- allocator :
- Return type:
(core.Error || std.mem.Allocator.Error)![]u8 - Slots:
client_get_str
client.clipboard¶
| Zig | |
|---|---|
AppPlatform::getClipboardText, the system clipboard
- Parameters:
- allocator :
std.mem.Allocator
- allocator :
- Return type:
(core.Error || std.mem.Allocator.Error)![]u8 - Slots:
client_get_str
client.showPopup¶
| Zig | |
|---|---|
Shows a popup; a newline in text separates the message from a subtitle.
- Parameters:
- text :
[]const u8
- text :
- Return type:
core.Error!void - Slots:
client_action
client.showDevConsoleMessage¶
| Zig | |
|---|---|
Writes text to the developer console.
- Parameters:
- text :
[]const u8
- text :
- Return type:
core.Error!void - Slots:
client_action
client.setSuspendInput¶
| Zig | |
|---|---|
Suspends or resumes all input.
- Parameters:
- suspended :
bool
- suspended :
- Return type:
core.Error!void - Slots:
client_action
client.setSuspendDirectionalInput¶
| Zig | |
|---|---|
Suspends or resumes movement input.
- Parameters:
- suspended :
bool
- suspended :
- Return type:
core.Error!void - Slots:
client_action
client.setGameInputEnabled¶
| Zig | |
|---|---|
Enables or disables game input.
- Parameters:
- enabled :
bool
- enabled :
- Return type:
core.Error!void - Slots:
client_action
client.refocusMouse¶
| Zig | |
|---|---|
Gives the mouse back to the game.
- Parameters:
- lost :
bool
- lost :
- Return type:
core.Error!void - Slots:
client_action
client.muteAudio¶
| Zig | |
|---|---|
Mutes the client audio.
- Return type:
core.Error!void - Slots:
client_action
client.unmuteAudio¶
| Zig | |
|---|---|
Unmutes the client audio.
- Return type:
core.Error!void - Slots:
client_action
client.fadeOutMusic¶
| Zig | |
|---|---|
Fades out the music that is playing.
- Return type:
core.Error!void - Slots:
client_action
client.setGuiScaleOffset¶
| Zig | |
|---|---|
Sets the GUI scale offset.
- Parameters:
- offset :
i32
- offset :
- Return type:
core.Error!void - Slots:
client_action
client.resetPlayerMovement¶
| Zig | |
|---|---|
Resets the movement input of the local player.
- Return type:
core.Error!void - Slots:
client_action
client.pushLeaveGameScreen¶
| Zig | |
|---|---|
Opens the screen that asks whether to leave the world.
- Return type:
core.Error!void - Slots:
client_action
client.openContentLogHistory¶
| Zig | |
|---|---|
Opens the content log history.
- Return type:
core.Error!void - Slots:
client_action
client.setClipboard¶
| Zig | |
|---|---|
Writes value to the system clipboard.
- Parameters:
- value :
[]const u8
- value :
- Return type:
core.Error!void - Slots:
client_action
client.navigateHowToPlay¶
| Zig | |
|---|---|
Opens How to Play at topic, or at its start for an empty topic.
- Parameters:
- topic :
[]const u8
- topic :
- Return type:
core.Error!void - Slots:
client_action
client.options¶
| Zig | |
|---|---|
Every client option. The caller frees each key, each value and the slice.
- Parameters:
- allocator :
std.mem.Allocator
- allocator :
- Return type:
(core.Error || std.mem.Allocator.Error)![]OptionPair - Slots:
client_option_list
client.option¶
| Zig | |
|---|---|
One client option by its options.txt key, owned by the caller.
- Parameters:
- key :
[]const u8 - allocator :
std.mem.Allocator
- key :
- Return type:
(core.Error || std.mem.Allocator.Error)![]u8 - Slots:
client_option_get
client.setOption¶
| Zig | |
|---|---|
Writes one client option from its options.txt text form; read it back to see what the engine kept.
- Parameters:
- key :
[]const u8 - value :
[]const u8
- key :
- Return type:
core.Error!void - Slots:
client_option_set
client.registerKey¶
| Zig | |
|---|---|
Registers a key binding under name with its default key_codes. allow_remap lets the player rebind it. A name that is taken, or an empty code list, is Refused.
- Parameters:
- name :
[]const u8 - key_codes :
[]const i32 - allow_remap :
bool - user :
?*anyopaque - handler :
comptime KeyHandler
- name :
- Return type:
core.Error!KeyBinding - Slots:
client_register_key
client.isInLevel¶
| Zig | |
|---|---|
Whether the client is inside a level, which means a world is loaded.
- Return type:
core.Error!bool - Slots:
client_is_in_level
client.localPlayerName¶
| Zig | |
|---|---|
The name of the local player, owned by the caller. NoAnswer outside a level.
- Parameters:
- allocator :
std.mem.Allocator
- allocator :
- Return type:
(core.Error || std.mem.Allocator.Error)![]u8 - Slots:
client_get_local_player
client.KeyBinding¶
One registered key binding, kept to drop it.
client.KeyBinding.keyCodes¶
| Zig | |
|---|---|
The key codes currently assigned, which differ from the defaults when the player remapped the key. Owned by the caller.
- Parameters:
- allocator :
std.mem.Allocator
- allocator :
- Return type:
(core.Error || std.mem.Allocator.Error)![]i32 - Slots:
client_get_key_codes
client.KeyBinding.unregister¶
| Zig | |
|---|---|
Drops the binding: this mod's handler stops firing. The engine keeps one key per name and offers no removal, so registering the same name again reuses it. Calling it twice is harmless.
- Return type:
core.Error!void - Slots:
client_unregister_key
client.KeyAction¶
What a key binding reports.
client.KeyAction.isDown¶
| Zig | |
|---|---|
- Return type:
bool
client.OptionPair¶
One client option: its options.txt key and its value in that text form.