Skip to main content

Intro

FAQ

What does this mod do?

WebsiteThis mod lets you create scripts in JavaScript language to manage your server, add new blocks and FAQ:items, change recipes, add custom handlers for quest mods and more!

How to use it?

Run the game with mod installed once. It should generate kubejs folder in your minecraft directory with example scripts and README.txt. Read that!

I don't know JavaScript

There's examples and pre-made scripts here. And you can always ask in discord support channel for help with scripts, but be specific.

Can I reload scripts?

Yes, use /reload to reload server_scripts/F3 + T to reload client_scripts/ and /kubejs reload startup_scripts to reload startup_scripts/. If you don't care about reloading recipes but are testing some world interaction event, you can run /kubejs reload server_scripts. Note: Not everything is reloadable. Some things require you to restart game, some only world, some work on fly. Reloading startup scripts is not recommended, but if you only have event listeners, it shouldn't be a problem.

What mod recipes does it support / is mod X supported?

If the mod uses datapack recipes, then it's supported by default. Some more complicated mods require addon mods, but in theory, still would work with datapack recipes. See Recipes section for more info.

What features does this mod have?

The feature list would go here if I actually wrote it. But basically, editing and creating recipes, tags, items, blocks, fluids, worldgen. Listening to chat, block placement, etc. events. Just look at the event list on Wiki.

How does this mod work?

It uses a fork of Rhino, a JavaScript engine by Mozilla to convert JS code to Java classes at runtime. KubeJS wraps minecraft classes and adds utilities to simplify that a lot and remove need for mappings. Architectury lets nearly the same source code be compiled for both Forge and Fabric making porting extremely easy.

Ok, but what if it.. doesn't work?

You can report issues here.

I have more questions/suggestions!

If wiki didn't have the answer for what you were looking for, you can join the Discord server and ask for help on #support channel!

 

 

Website: https://kubejs.latvian.dev/

Discord server: https://discord.gg/bPFfH6Pcom/

Source and issue tracker: https://github.com/KubeJS-Mods/KubeJS


Forge and Fabric download:Download: https://www.curseforge.com/minecraft/mc-mods/kubejs

 

Anything

1.12 versions aren't supported, onlybelow 1.1516 and up!


How to read Variables and Functions
FormatUse ExampleInfo
variableName

var x = event.variableName

event.variableName = 10

A simple variable, can be read and changed as well
functionName()event.functionName()Function withis no parameters,longer can be called
functionName(int x, String y)

event.functionName(10, 'abc')supported!

Function with parameters with types specified (even if JS doesn't have function types), can be called
variableNamevar x = event.variableNameVariable that can only be read but can't be changed
variableNameevent.variableName = 10Variable that can only be changed, but can't be read