Skip to main content

KubeJS Legacy

This wiki is for KubeJS 1.18.2 and below. That said, this one still has a lot of useful info!

Intro

FAQ What does this mod do? This mod lets you create scripts in JavaScript language to manage yo...

Migrating to KubeJS 6

This page is still being worked on, so if some info is missing, please check back later! What's ...

Getting Started

A step by step guide for learning the basics of KubeJS

Events

Events that get fired during game to control recipes, world, etc.

List of all events

This is a list of all events. It's possible that not all events are listed here, but this list wi...

Custom Items

This is a startup_scripts/ event // Listen to item registry event onEvent('item.registry', even...

EventJS

This event is the most basic event class, parent of all other events. Parent class Object Can ...

Custom Blocks

This is a startup script. onEvent('block.registry', event => { event.create('test_block') ...

CommandEventJS

This event needs cleanup! Using it is not recommended. Information This event is fired when a c...

TagEventJS

This event is fired when a tag collection is loaded, to modify it with script. You can add and re...

Loot Table Modification

onEvent('block.loot_tables', event => { event.addSimpleBlock('minecraft:dirt', 'minecraft:red_...

RecipeEventJS

Examples The most basic script to add a single recipe: onEvent('recipes', event => { event.s...

Item Modification

item.modification event is a startup script event that allows you to change properties of existin...

WorldgenAddEventJS (1.16)

This event isn't complete yet and can only do basic things. Adding dimension-specific features al...

Block Modification

block.modification event is a startup script event that allows you to change properties of existi...

JEI Integration

All JEI events are client sided and so go in the client_scripts folder Sub-types onEvent('jei.s...

WorldgenRemoveEventJS (1.16)

For more information on biomes field, see worldgen.add event page. onEvent('worldgen.remove', ev...

REI Integration

Note: REI integration only works on Fabric in 1.16. In 1.18+, it works on both Forge and Fabric! ...

ItemTooltipEventJS

A client event that allows adding tooltips to any item! onEvent('item.tooltip', tooltip => { ...

Worldgen Events

These following examples will only work on 1.18+! If you need examples for 1.16, you can look her...

Chat Event

This script is peak of human evolution. Whenever someone says "Creeper" in chat, it replies with ...

Custom Fluids

Supported by Forge on all versions, and Fabric on 1.18.2+ // Startup script onEvent('fluid.regi...

Command Registry

This page is unfinished and only provides basic information Example: The following code has not...

Datapack Load Events

You can load json datapack files programmatically! onEvent('server.datapack.first', event => { ...

Examples

Example scripts for various things you can do with KubeJS

Classes

Available fields and methods and examples on how to use them

Global

Constants, classes and functions

Other

Examples and how-tos of other things KubeJS can do!

Addons

Scripts using various KubeJS addons for recipes.