Wiki 9Minecraft Wiki 9Minecraft

KubeJS Library Mechanics and Utilities

Guides 2FAQ 10Dependencies 2Related mods 60
DownloadKubeJS Library

Get the files on 9Minecraft

Contents (6)
  1. Text and Chat
  2. Scheduling
  3. NBT Handling
  4. Inventory and Items
  5. Next guides
  6. More in this wiki

KubeJS includes several built-in utilities to simplify complex tasks.

Text and Chat

The Text utility allows for advanced chat formatting, including colors, click events, and hover tooltips. * Text.green('Success!').bold * Text.of('Click here').click('') (Note: External links are handled by the Minecraft client).

Scheduling

You can schedule tasks to run after a certain amount of time: * server.scheduleInTicks(20, callback) - Runs code after 1 second (20 ticks).

NBT Handling

KubeJS provides full access to NBT (Named Binary Tag) data. You can read, modify, and write NBT to item stacks, entities, and block entities (like chests or furnaces).

Inventory and Items

  • Item Stacks: Use Item.of('id') to create item objects with custom NBT or counts.
  • Ingredients: Use Ingredient.of('#tag') to refer to groups of items in recipes.