Skip to content
SpokenWig620933 edited this page Aug 15, 2026 · 14 revisions

Events are how KubeJS runs everything.

Available Events:

Events:

Modification:

Used to modify KeyBinds!

Available Methods:

Examples:

KeyMapping getKeyMapping(String name);

KeyBindExtendedEvents.modification(event => {
    // Retrieves KeyMapping for the Attack/Destroy KeyBind and logs its Category!
    console.log(event.getKeyMapping('key.attack').getCategory());
});

void hide(String name);

KeyBindExtendedEvents.modification(event => {
    // Hides the Open Command KeyBind from Controls, but does not clear its Assigned Key!
    event.hide('key.command');
});

void remove(String name);

KeyBindExtendedEvents.modification(event => {
    // Functionally removes the Cinematic Camera KeyBind from the game!
    event.remove('key.smoothCamera');
});

void resetKey(String name);

KeyBindExtendedEvents.modification(event => {
    // Resets the Command KeyBind to its Default Key!
    event.resetKey('key.command');
});

void setCategory(String name, String category);

KeyBindExtendedEvents.modification(event => {
    // Moved the Highlight Players (Spectator) KeyBind to a custom Debug category!
    event.setCategory('key.spectatorOutlines', 'key.categories.debug');
});

void setDefaultKey(String name, String key);

KeyBindExtendedEvents.modification(event => {
    // Sets the Default Key for the Load Hotbar Activator KeyBind to V!
    event.setDefaultKey('key.loadToolbarActivator', 'KEY_V');
});

void setDefaultKeyWithModifier(String name, String key, String modifier);

KeyBindExtendedEvents.modification(event => {
    // Sets the Default Key + Modifier for the Toggle Fullscreen KeyBind to ALT + F11!
    event.setDefaultKeyWithModifier('key.fullscreen', 'KEY_F11', 'ALT');
});

void setKey(String name, String key);

KeyBindExtendedEvents.modification(event => {
    // Overrides the List Players KeyBind EVERY Launch to TAB!
    event.setKey('key.playerlist', 'KEY_TAB');
});

void setKeyWithModifier(String name, String key, String modifier);

KeyBindExtendedEvents.modification(event => {
    // Overrides the Social Interactions Screen KeyBind EVERY Launch to ALT + P!
    event.setKeyWithModifier('key.socialInteractions', 'KEY_P', 'ALT');
});

IKeyConflictContext getKeyConflictContext(String name);

KeyBindExtendedEvents.categories(event => {
    event.getKeyMappingNames().forEach(keyMapping => {
        if(event.getKeyConflictContext(keyMapping) == KeyConflictContext.UNIVERSAL) {
            console.log('Universal Key: ' + keyMapping);
        }
    });
});

void setKeyConflictContext(String name, IKeyConflictContext keyConflictContext);

KeyBindExtendedEvents.categories(event => {
    event.setKeyConflictContext('key.sneak', KeyConflictContext.IN_GAME);
});

KeyConflictContextBuilder getKeyConflictContextBuilder();

KeyBindExtendedEvents.categories(event => {
    var builder = event.getKeyConflictContextBuilder();
    
    builder.setActive(() -> false);
    builder.setConflicts(keyConflictContext -> false);

    event.setKeyConflictContext('key.spectatorOutlines', builder.build());
});

Categories:

Used to modify KeyBind Categories!

Available Methods:

Examples:

void setDisplayIndex(String name, int index);

KeyBindExtendedEvents.categories(event => {
    // Moves the Creative KeyBind Category to the top!
    event.setDisplayIndex('key.categories.creative', 0);
});

void removeCategory(String name);

KeyBindExtendedEvents.categories(event => {
    // Removed the category by removing ALL KeyBinds using it!
    event.removeCategory('key.categories.creative');
});

List<String> getCategoriesInOrder();

KeyBindExtendedEvents.categories(event => {
    // Returns a List<String> of all sorted categories in the order they will be sorted in!
    event.getCategoriesInOrder().forEach(category => {
        // Logs the Category!
        console.log('Categories in Order: ' + category);
    });
});