Advanced Search
Search Results
110 total results found
KubeJS Legacy
This wiki is for KubeJS 1.18.2 and below. That said, this one still has a lot of useful info!
KubeJS
Events
Events that get fired during game to control recipes, world, etc.
Classes
Available fields and methods and examples on how to use them
Global
Constants, classes and functions
KubeJS
This wiki is for KubeJS 6+, for Minecraft versions 1.19.2+. This wiki still is incomplete, so you may fallback to 1.18.2 one, see KubeJS Legacy page.
Examples
Example scripts for various things you can do with KubeJS
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') ...
Other
Examples and how-tos of other things KubeJS can do!
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...
Addons
Scripts using various KubeJS addons for recipes.
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')) { ...
Events
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...
Examples
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...