fun client(): MinecraftGets the raw Minecraft client instance.
Returns
The Minecraft client instance
Common
fun client(): MinecraftGets the raw Minecraft client instance.
The Minecraft client instance
fun clientPlayer(): LocalPlayer?Gets the raw client player entity.
The client player entity, or null if not in a world or on server
fun clientLevel(): ClientLevel?Gets the raw client level (world).
The client level instance, or null if not in a world or on server
fun runOnClient(action: () -> Unit)Executes an action on the client thread.
This is useful for ensuring code runs on the client thread when called from a different thread context.
| Parameter | Description |
|---|---|
action | The action to execute |
true if the action was queued/executed successfully
fun isClientPaused(): BooleanChecks if the client game is paused.
true if the game is paused (e.g., pause menu open), false otherwise
fun isInClientWorld(): BooleanChecks if the client is currently in a world.
true if the client has loaded a world, false otherwise
fun clientX(): Double?Gets the client player's X coordinate.
The X coordinate, or null if not available
fun clientY(): Double?Gets the client player's Y coordinate.
The Y coordinate, or null if not available
fun clientZ(): Double?Gets the client player's Z coordinate.
The Z coordinate, or null if not available
fun clientPos(): Vec3?Gets the client player's position as a Vec3.
The position vector, or null if any coordinate is unavailable
fun clientYaw(): Float?Gets the client player's yaw rotation.
The yaw angle in degrees, or null if not available
fun clientPitch(): Float?Gets the client player's pitch rotation.
The pitch angle in degrees, or null if not available
fun clientDimensionId(): String?Gets the client player's current dimension identifier.
The dimension ID string (e.g., "minecraft:overworld"), or null if not available
fun clientGameTime(): Long?Gets the client world's current game time.
The game time in ticks, or null if not available
fun clearClientOverlay()Clears any active overlay message on the client.
true if cleared successfully, false otherwise
fun playClientSound(soundId: String, volume: Float = 1.0f, pitch: Float = 1.0f): BooleanPlays a sound on the client.
| Parameter | Description |
|---|---|
soundId | The sound identifier (e.g., "minecraft:block.note_block.pling") |
volume | The volume (0.0 to 1.0+) |
pitch | The pitch multiplier (0.5 to 2.0) |
true if the sound was played successfully, false if the sound ID was invalid
fun playClientSound(soundId: Identifier, volume: Float = 1.0f, pitch: Float = 1.0f): BooleanPlays a sound on the client.
| Parameter | Description |
|---|---|
soundId | The sound identifier (e.g., "minecraft:block.note_block.pling") |
volume | The volume (0.0 to 1.0+) |
pitch | The pitch multiplier (0.5 to 2.0) |
true if the sound was played successfully, false if the sound ID was invalid
fun clientTitleTimes(fadeInTicks: Int = 10, stayTicks: Int = 70, fadeOutTicks: Int = 20)Sets the timing for title display.
| Parameter | Description |
|---|---|
fadeInTicks | Ticks for fade-in animation |
stayTicks | Ticks to stay visible |
fadeOutTicks | Ticks for fade-out animation |
true if timing was set successfully, false otherwise
fun clearClientTitle()Clears any active title on the client.
true if cleared successfully, false otherwise
fun clientFps(): IntGets the client's current FPS (frames per second).
The current FPS, or null if not available
fun isClientWindowFocused(): BooleanChecks if the client window is focused.
true if the window has focus, false otherwise
fun clientScreenName(): String?Gets the name of the currently open screen.
The screen class name, or null if no screen is open
fun isClientInMenu(): BooleanChecks if the client is currently in a menu (not in-game).
true if a menu screen is open, false if in-game
fun isClientChatOpen(): BooleanChecks if the chat screen is currently open.
true if chat is open, false otherwise