Advanced Search
Search Results
52 total results found
Custom Blocks
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
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
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
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
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
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 crea...
FTB Utilities Rank Promotions
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
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
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
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
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
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
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
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
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
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
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
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
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
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 =&...