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 ​

clientCommonFunction
kotlin
fun client(): Minecraft

Gets the raw Minecraft client instance.

Returns ​

Minecraft client instance

clientPlayer ​

clientPlayerCommonFunction
kotlin
fun clientPlayer(): LocalPlayer?

Gets the raw client player entity.

Returns ​

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

clientLevel ​

clientLevelCommonFunction
kotlin
fun clientLevel(): ClientLevel?

Gets the raw client level (world).

Returns ​

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

clientTell ​

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

Sends a message to the client player's chat.

Parameters ​

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

Returns ​

if the message was sent successfully, false otherwise

runOnClient ​

runOnClientCommonFunction
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 ​

if the action was queued/executed successfully

isClientPaused ​

isClientPausedCommonFunction
kotlin
fun isClientPaused(): Boolean

Checks if the client game is paused.

Returns ​

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

isInClientWorld ​

isInClientWorldCommonFunction
kotlin
fun isInClientWorld(): Boolean

Checks if the client is currently in a world.

Returns ​

if the client has loaded a world, false otherwise

clientX ​

clientXCommonFunction
kotlin
fun clientX(): Double?

Gets the client player's X coordinate.

Returns ​

X coordinate, or null if not available

clientY ​

clientYCommonFunction
kotlin
fun clientY(): Double?

Gets the client player's Y coordinate.

Returns ​

Y coordinate, or null if not available

clientZ ​

clientZCommonFunction
kotlin
fun clientZ(): Double?

Gets the client player's Z coordinate.

Returns ​

Z coordinate, or null if not available

clientPos ​

clientPosCommonFunction
kotlin
fun clientPos(): Vec3?

Gets the client player's position as a Vec3.

Returns ​

position vector, or null if any coordinate is unavailable

clientYaw ​

clientYawCommonFunction
kotlin
fun clientYaw(): Float?

Gets the client player's yaw rotation.

Returns ​

yaw angle in degrees, or null if not available

clientPitch ​

clientPitchCommonFunction
kotlin
fun clientPitch(): Float?

Gets the client player's pitch rotation.

Returns ​

pitch angle in degrees, or null if not available

clientDimensionId ​

clientDimensionIdCommonFunction
kotlin
fun clientDimensionId(): String?

Gets the client player's current dimension identifier.

Returns ​

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

clientGameTime ​

clientGameTimeCommonFunction
kotlin
fun clientGameTime(): Long?

Gets the client world's current game time.

Returns ​

game time in ticks, or null if not available

clientActionBar ​

clientActionBarCommonFunction
kotlin
fun clientActionBar(message: Any): Boolean

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

Parameters ​

ParameterDescription
messageThe message to display

Returns ​

if displayed successfully, false otherwise

clientOverlay ​

clientOverlayCommonFunction
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 ​

if displayed successfully, false otherwise

clearClientOverlay ​

clearClientOverlayCommonFunction
kotlin
fun clearClientOverlay()

Clears any active overlay message on the client.

Returns ​

if cleared successfully, false otherwise

clientNowPlaying ​

clientNowPlayingCommonFunction
kotlin
fun clientNowPlaying(message: Any?)

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

Parameters ​

ParameterDescription
messageThe message to display

Returns ​

if displayed successfully, false otherwise

playClientSound ​

playClientSoundCommonFunction
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 ​

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

playClientSound ​

playClientSoundCommonFunction
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 ​

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

clientTitle ​

clientTitleCommonFunction
kotlin
fun clientTitle(message: Any?)

Displays a title on the client screen.

Parameters ​

ParameterDescription
messageThe title message to display

Returns ​

if displayed successfully, false otherwise

clientSubtitle ​

clientSubtitleCommonFunction
kotlin
fun clientSubtitle(message: Any?)

Displays a subtitle on the client screen.

Parameters ​

ParameterDescription
messageThe subtitle message to display

Returns ​

if displayed successfully, false otherwise

clientTitleTimes ​

clientTitleTimesCommonFunction
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 ​

if timing was set successfully, false otherwise

clearClientTitle ​

clearClientTitleCommonFunction
kotlin
fun clearClientTitle()

Clears any active title on the client.

Returns ​

if cleared successfully, false otherwise

clientFps ​

clientFpsCommonFunction
kotlin
fun clientFps(): Int

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

Returns ​

current FPS, or null if not available

isClientWindowFocused ​

isClientWindowFocusedCommonFunction
kotlin
fun isClientWindowFocused(): Boolean

Checks if the client window is focused.

Returns ​

if the window has focus, false otherwise

clientScreenName ​

clientScreenNameCommonFunction
kotlin
fun clientScreenName(): String?

Gets the name of the currently open screen.

Returns ​

screen class name, or null if no screen is open

isClientInMenu ​

isClientInMenuCommonFunction
kotlin
fun isClientInMenu(): Boolean

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

Returns ​

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

isClientChatOpen ​

isClientChatOpenCommonFunction
kotlin
fun isClientChatOpen(): Boolean

Checks if the chat screen is currently open.

Returns ​

if chat is open, false otherwise