Skip to content

KubeJS Client API

hp-1e edited this page Oct 25, 2026 · 1 revision

English | 中文

Client API

Use SkillAtlasClient and SkillAtlasClientEvents in kubejs/client_scripts. Both exist only on the physical client; a dedicated server never loads the client helpers.

Tooltip event

SkillAtlasClientEvents.tooltip('haste', event => {
  event.add(Text.gold('Quest hint: finish the mining intro first'))
})

The node filter is optional. The event provides player, nodeId, categoryId, level, maxLevel, revision and hints. hints is true for the hover tooltip and false for the detail view.

  • event.baseLines is a read-only copy of the original tooltip.
  • event.add(Component) appends styled lines: at most 32 lines, 2048 characters per line and 16384 characters in total.
  • Writing to a saved, already closed event throws an error.
  • If the callback throws, the original tooltip is kept and the script is not run again for at least 100 ticks.

Appended lines are cached per node and per hover/detail mode: at most 128 entries for 20 ticks. The cache is cleared when the definition, player progress or client scripts change, and on disconnect. There is no per-frame drawing or per-frame server query. open / focus cannot be called from inside a tooltip callback, and read-only tooltip calls are protected against recursion.

Methods

Method Meaning
SkillAtlasClient.isReady() Both the full definition and the first player progress have arrived
SkillAtlasClient.getLevel(nodeId) Locally synced level; 0 when not ready or unknown
SkillAtlasClient.tooltip(nodeId) Read-only copy of the native tooltip plus script lines; empty when not ready, unknown or hidden
SkillAtlasClient.open() / open(categoryId) Open the atlas, optionally on a category
SkillAtlasClient.focus(nodeId) Open the atlas, switch category, move the camera and highlight the skill

A quest book button can call SkillAtlasClient.focus('haste').

  • An explicit local call opens the atlas and replaces the current quest screen. An already open atlas screen is reused.
  • If the definition or the first progress has not arrived yet, only the last navigation is kept while waiting for sync, for up to 200 ticks.
  • A connection change, disconnect, client script reload or timeout drops the pending request.
  • At most one local navigation is accepted per 5 ticks.

Navigation from the server

In a server quest callback use SkillAtlas.player(event.player).open('mining') or .focus('haste').

  1. The request goes only to that player. The server checks that the player is online and that the target exists and is visible, with a 5-tick limit per player.
  2. The client validates again and waits for the required definition revision.
  3. If another screen is open, a server navigation waits a short while for the player to close it, then is dropped.

Reading the atlas does not require canEdit, and navigation never reveals hidden nodes.

detail.state = 'sent' on the server only means the request was sent. Locally the client returns opened or queued. There is no confirmation that the GUI actually opened. The navigation packet is server-to-client only and carries a limited action, an ID and a revision. Clients cannot report points, resets or other player writes through it.

Clone this wiki locally