KubeJS
This wiki is still very much work in progress! Feel free to suggest changes in #kubejs-and-code Discord channel.
Information (Read this first!)
Website and FAQ: https://kubejs.latvian.dev/ Discord server: https://discord.gg/bPFfH6P Forge ...
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...
EventJS
This event is the most basic event class, parent of all other events. Parent class Object Can ...
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...
RecipeEventJS
Examples Possible settings you can change for recipes. It's recommended that you put this in it'...
WorldgenAddEventJS
This event isn't complete yet and can only do basic things. Adding dimension-specific features al...
WorldgenRemoveEventJS
For more information on biomes field, see worldgen.add event page. onEvent('worldgen.remove', ev...
Classes
Available fields and methods and examples on how to use them
Object
Parent class of all Java objects. Parent None (and itself at the same time, don't question it)...
String
Class of string objects, such as "abc" (and in JS 'abc' works as well) Parent Object Variable...
Primitive Types
Information Primitive types are objects that don't have a real class and don't inherit methods f...
Global
Constants, classes and functions
Examples
Example scripts for various things you can do with KubeJS
Recipes
Moved to RecipeEventJS!
Custom Blocks
This is a startup script. events.listen('block.registry', function (event) { event.create('te...
Reflection
Very limited reflection is possible, but is not recommended. Use it in cases, when mod doesn't ha...
Chat Event
This script is peak of human evolution. Whenever someone says "Creeper" in chat, it replies with ...
Network Packets
This script shows how to use network packets: // Listen to a player event, in this case item rig...
Starting Items
This script adds items on first time player joins, checking gamestages Requires GameStages mod! ...
Custom Items
// Listen to block registry event events.listen('item.registry', function (event) { // The te...
FTB Utilities Rank Promotions
With this script you can have FTB Utilities roles that change over time. Is for 1.12 only. Requi...
Clearlag
This script removes all items from world every 30 minutes. Only works in 1.12. // Create item wh...
Scheduled Server Events
At server load, you can schedule anything to happen at later time. Within callback handler you ca...
FTB Quests Integration
events.listen('ftbquests.custom_task.75381f79', function (event) { log.info('Custom task!') ...
JEI Integration
Sub-types onEvent('jei.subtypes', event => { event.useNBT('example:item') event.userNBT...
REI Integration (Fabric Only)
Hide Items onEvent('rei.hide.items', event => { event.hide('example:ingredient') }) Add ...
Changing Window Title and Icon
Yes, you can do that with KubeJS too. To change title, all you have to do is change title in kub...
KubeJS UI
You can also always look at existing modpack using KubeJS UI to see how they do it events.listen...
Loot Table Modification (WIP)
onEvent('block.loot_tables', event => { event.addSimpleBlock('minecraft:dirt', 'minecraft:r...