Skip to main content
Advanced Search
Search Terms
Content Type

Exact Matches
Tag Searches
Date Options
Updated after
Updated before
Created after
Created before

Search Results

70 total results found

KubeJS

KubeJS

This wiki is still very much work in progress! Feel free to suggest changes in the #off-topic Discord channel.

KubeJS 6 (1.19.2)

Events

KubeJS

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

Classes

KubeJS

Available fields and methods and examples on how to use them

Global

KubeJS

Constants, classes and functions

Examples

KubeJS

Example scripts for various things you can do with KubeJS

Other

KubeJS

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

Addons

KubeJS

Scripts using various KubeJS addons for recipes.

Events

KubeJS 6 (1.19.2)

Global

KubeJS 6 (1.19.2)

Examples

KubeJS 6 (1.19.2)

Other

KubeJS 6 (1.19.2)

Addons

KubeJS 6 (1.19.2)

Getting Started

KubeJS

A step by step guide for learning the basics of KubeJS

Custom Blocks

KubeJS Events

This is a startup script. onEvent('block.registry', event => { event.create('test_block') .material('glass') .hardness(0.5) .displayName('Test Block') // No longer required in 1.18.2+ .tagBlock('minecraft:mineable/shovel') ...

Reflection / Java access

KubeJS Examples

Very limited reflection is possible, but is not recommended. Use it in cases when KubeJS doesnt support something. In 1.18.2+ internal Minecraft classes are remapped to MojMaps at runtime, so you don't have to use obfuscated names if accessing internal Minecr...

Chat Event

KubeJS Events

This script is peak of human evolution. Whenever someone says "Creeper" in chat, it replies with "Aw man". onEvent('player.chat', (event) => { // Check if message equals creeper, ignoring case if (event.message.trim().equalsIgnoreCase('creeper')) { ...

Network Packets

KubeJS Examples

This script shows how to use network packets: // Listen to a player event, in this case item right-click // This goes in either server or client script, depending on which side you want to send the data packet to onEvent('item.right_click', event => { ...

Starting Items

KubeJS Examples

This server script adds items on first time player joins, checking stages. GameStages mod is not required // Listen to player login event onEvent('player.logged_in', event => { // Check if player doesn't have "starting_items" stage yet if (!event.pl...

Custom Items

KubeJS Events

This is a startup_scripts/ event // Listen to item registry event onEvent('item.registry', event => { // The texture for this item has to be placed in kubejs/assets/kubejs/textures/item/test_item.png // If you want a custom item model, you can c...

FTB Utilities Rank Promotions

KubeJS Examples

With this script you can have FTB Utilities roles that change over time. Is for 1.12 only. Requires FTB Utilities. events.listen('player.tick', function (event) { // This check happens every 20 ticks, a.k.a every second if (event.player.server &&am...

Clearlag 1.12

KubeJS Examples

This script removes all items from world every 30 minutes. Only works in 1.12. // Create item whitelist filter that won't be deleted with clearlag var whitelist = Ingredient.matchAny([ 'minecraft:diamond', // Adds diamond to whitelist 'minecraft:gold_i...

Intro

KubeJS

FAQ What does this mod do? This mod lets you create scripts in JavaScript language to manage your server, add new blocks and items, change recipes, add custom handlers for quest mods and more! How to use it? Run the game with mod installed once. It should ...

EventJS

KubeJS Events

This event is the most basic event class, parent of all other events. Parent class Object Can be cancelled No Variables and Functions Name Return Type Info cancel() void Cancels event. If the event can't be cancelled, it won't do anything.

CommandEventJS

KubeJS Events

This event needs cleanup! Using it is not recommended. Information This event is fired when a command is executed on server side. Parent class EventJS Can be cancelled Yes Variables and Functions Name Type Info parseResults ParseResul...

List of all events

KubeJS Events

This is a list of all events. It's possible that not all events are listed here, but this list will be updated regularly. Click on event ID to open it's class and see information, fields and methods. Type descriptions: Startup: Scripts go in kubejs/startu...

TagEventJS

KubeJS Events

This event is fired when a tag collection is loaded, to modify it with script. You can add and remove tags for items, blocks, fluids and entity types. This goes into server scripts. Tags are per item/block/fluid/entity type and as such cannot be added based ...

RecipeEventJS

KubeJS Events

Examples The most basic script to add a single recipe: onEvent('recipes', event => { event.shaped('3x minecraft:stone', [ 'SAS', 'S S', 'SAS' ], { S: 'minecraft:sponge', A: 'minecraft:apple' }) }) The most basic script to ...

Object

KubeJS Classes

Parent class of all Java objects.  Parent None (and itself at the same time, don't question it) Variables and Functions Name Type Info toString() String Tag collection type. equals(Object other) boolean Checks equality with another object. ...

String

KubeJS Classes

Class of string objects, such as "abc" (and in JS 'abc' works as well)  Parent Object Variables and Functions Name Type Info empty boolean Returns if string is empty a.k.a string === '' toLowerCase() String Returns a copy of this stri...

Primitive Types

KubeJS Classes

Information Primitive types are objects that don't have a real class and don't inherit methods from Object. All primitive types Type Java class Info void Void No type byte Byte 8 bit decimal number. short Short 16 bit decimal number. ...

Scheduled Server Events

KubeJS Examples

At server load, you can schedule anything to happen at later time. Within callback handler you can also call callback.reschedule() to repeat this event after initial timer or callback.reschedule(newTime) to change it. Whatever you pass as 2nd argument will be...

FTB Quests Integration

KubeJS Examples

onEvent('ftbquests.custom_task.75381f79', event => { log.info('Custom task!') event.checkTimer = 20 event.check = (task, player) => { if (player.world.daytime && player.world.raining) { task.progress++ } } }) onEv...

JEI Integration

KubeJS Events

All JEI events are client sided and so go in the client_scripts folder Sub-types onEvent('jei.subtypes', event => { event.useNBT('example:item') event.useNBTKey('example:item', 'type') }) Hide Items & Fluids onEvent('jei.hide.items', event =&...