Skip to content
On this page

Common

KattonClientApi

top.katton.apicommon/src/main/kotlin/top/katton/api/KattonClientApi.kt
Gets the raw Minecraft client instance.

client

CommonFunction
kotlin
fun client(): Minecraft

Gets the raw Minecraft client instance.

Returns

The Minecraft client instance

clientPlayer

CommonFunction
kotlin
fun clientPlayer(): LocalPlayer?

Gets the raw client player entity.

Returns

The client player entity, or null if not in a world or on server

clientLevel

CommonFunction
kotlin
fun clientLevel(): ClientLevel?

Gets the raw client level (world).

Returns

The client level instance, or null if not in a world or on server

clientTell

CommonFunction
kotlin
fun clientTell(message: Any?, overlay: Boolean = true)

Sends a message to the client player's chat.

Parameters

ParameterDescription
messageThe message to display (will be converted to Component if not already)

Returns

true if the message was sent successfully, false otherwise

runOnClient

CommonFunction
kotlin
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.

Parameters

ParameterDescription
actionThe action to execute

Returns

true if the action was queued/executed successfully

isClientPaused

CommonFunction
kotlin
fun isClientPaused(): Boolean

Checks if the client game is paused.

Returns

true if the game is paused (e.g., pause menu open), false otherwise

isInClientWorld

CommonFunction
kotlin
fun isInClientWorld(): Boolean

Checks if the client is currently in a world.

Returns

true if the client has loaded a world, false otherwise

clientX

CommonFunction
kotlin
fun clientX(): Double?

Gets the client player's X coordinate.

Returns

The X coordinate, or null if not available

clientY

CommonFunction
kotlin
fun clientY(): Double?

Gets the client player's Y coordinate.

Returns

The Y coordinate, or null if not available

clientZ

CommonFunction
kotlin
fun clientZ(): Double?

Gets the client player's Z coordinate.

Returns

The Z coordinate, or null if not available

clientPos

CommonFunction
kotlin
fun clientPos(): Vec3?

Gets the client player's position as a Vec3.

Returns

The position vector, or null if any coordinate is unavailable

clientYaw

CommonFunction
kotlin
fun clientYaw(): Float?

Gets the client player's yaw rotation.

Returns

The yaw angle in degrees, or null if not available

clientPitch

CommonFunction
kotlin
fun clientPitch(): Float?

Gets the client player's pitch rotation.

Returns

The pitch angle in degrees, or null if not available

clientDimensionId

CommonFunction
kotlin
fun clientDimensionId(): String?

Gets the client player's current dimension identifier.

Returns

The dimension ID string (e.g., "minecraft:overworld"), or null if not available

clientGameTime

CommonFunction
kotlin
fun clientGameTime(): Long?

Gets the client world's current game time.

Returns

The game time in ticks, or null if not available

clientActionBar

CommonFunction
kotlin
fun clientActionBar(message: Any): Boolean

Displays a message in the client player's action bar.

Parameters

ParameterDescription
messageThe message to display

Returns

true if displayed successfully, false otherwise

clientOverlay

CommonFunction
kotlin
fun clientOverlay(message: Any?, tinted: Boolean = false)

Displays an overlay message on the client screen.

Parameters

ParameterDescription
messageThe message to display
tintedWhether to apply a background tint

Returns

true if displayed successfully, false otherwise

clearClientOverlay

CommonFunction
kotlin
fun clearClientOverlay()

Clears any active overlay message on the client.

Returns

true if cleared successfully, false otherwise

clientNowPlaying

CommonFunction
kotlin
fun clientNowPlaying(message: Any?)

Displays a "Now Playing" message for music/sound.

Parameters

ParameterDescription
messageThe message to display

Returns

true if displayed successfully, false otherwise

playClientSound

CommonFunction
kotlin
fun playClientSound(soundId: String, volume: Float = 1.0f, pitch: Float = 1.0f): Boolean

Plays a sound on the client.

Parameters

ParameterDescription
soundIdThe sound identifier (e.g., "minecraft:block.note_block.pling")
volumeThe volume (0.0 to 1.0+)
pitchThe pitch multiplier (0.5 to 2.0)

Returns

true if the sound was played successfully, false if the sound ID was invalid

playClientSound

CommonFunction
kotlin
fun playClientSound(soundId: Identifier, volume: Float = 1.0f, pitch: Float = 1.0f): Boolean

Plays a sound on the client.

Parameters

ParameterDescription
soundIdThe sound identifier (e.g., "minecraft:block.note_block.pling")
volumeThe volume (0.0 to 1.0+)
pitchThe pitch multiplier (0.5 to 2.0)

Returns

true if the sound was played successfully, false if the sound ID was invalid

clientTitle

CommonFunction
kotlin
fun clientTitle(message: Any?)

Displays a title on the client screen.

Parameters

ParameterDescription
messageThe title message to display

Returns

true if displayed successfully, false otherwise

clientSubtitle

CommonFunction
kotlin
fun clientSubtitle(message: Any?)

Displays a subtitle on the client screen.

Parameters

ParameterDescription
messageThe subtitle message to display

Returns

true if displayed successfully, false otherwise

clientTitleTimes

CommonFunction
kotlin
fun clientTitleTimes(fadeInTicks: Int = 10, stayTicks: Int = 70, fadeOutTicks: Int = 20)

Sets the timing for title display.

Parameters

ParameterDescription
fadeInTicksTicks for fade-in animation
stayTicksTicks to stay visible
fadeOutTicksTicks for fade-out animation

Returns

true if timing was set successfully, false otherwise

clearClientTitle

CommonFunction
kotlin
fun clearClientTitle()

Clears any active title on the client.

Returns

true if cleared successfully, false otherwise

clientFps

CommonFunction
kotlin
fun clientFps(): Int

Gets the client's current FPS (frames per second).

Returns

The current FPS, or null if not available

isClientWindowFocused

CommonFunction
kotlin
fun isClientWindowFocused(): Boolean

Checks if the client window is focused.

Returns

true if the window has focus, false otherwise

clientScreenName

CommonFunction
kotlin
fun clientScreenName(): String?

Gets the name of the currently open screen.

Returns

The screen class name, or null if no screen is open

isClientInMenu

CommonFunction
kotlin
fun isClientInMenu(): Boolean

Checks if the client is currently in a menu (not in-game).

Returns

true if a menu screen is open, false if in-game

isClientChatOpen

CommonFunction
kotlin
fun isClientChatOpen(): Boolean

Checks if the chat screen is currently open.

Returns

true if chat is open, false otherwise