跳到正文

KubeJS KeyBinds

KubeJS extension for KeyBinds

收藏

介绍

中文介绍正在准备中,下面暂时显示原文。

KubeJS KeyBinds

Expands upon KubeJS by allowing you to modify existing KeyBinds and Categories

KubeJS already offers custom KeyBinds, so this will not be added by this project.

WIKI


Example client_scripts > keybinds.js

KeyBindExtendedEvents.modification(event => {
    // List all existing KeyBinds
    KeyBind.getKeyMappingNames().forEach(keyMapping => {
        console.log('KeyMapping: ' + keyMapping);
    });

    // List all existing Categories
    KeyBind.getKeyMappingCategories().forEach(category => {
        console.log('Category: ' + category);
    });

    // List all acceptable Keys
    KeyBind.getKeyNames().forEach(key => {
        console.log('Key: ' + key);
    });

    // List all acceptable Key Modifiers
    KeyBind.getKeyModifiers().forEach(modifier => {
        console.log('Modifier: ' + modifier);
    });

    // Remove the KeyBind from the game
    // void remove(string keyName);
    event.remove('key.saveToolbarActivator');
    event.remove('key.loadToolbarActivator');

    // Set the default KeyBind
    // void setDefaultKey(string keyName, string key);
    event.setDefaultKey('key.socialInteractions', 'KEY_UNKNOWN');

    // Set the default KeyBind with a Modifier
    // void setDefaultKeyWithModifier(string keyName, string key, string modifier);
    event.setDefaultKeyWithModifier('key.advancements', 'KEY_L', 'CONTROL');

    // Move the KeyBind to a new category
    // You can combine custom category names with a Language File (e.g. en_us.json > "key.categories.debug": "Debug")
    // void setCategory(string keyName, string category);
    event.setCategory('key.spectatorOutlines', 'key.categories.debug');
});

KeyBindExtendedEvents.categories(event => {
    // List current Category Order
    // By Default the only categories to order are the Vanilla Minecraft Categories
    var categories = event.getCategoriesInOrder();

    for(var i = 0; i < categories.size(); i++) {
        console.log('Index: ' + i + '; Category: ' + categories.get(i));
    }

    // Set our custom Debug category to appear right after the Miscellaneous category
    // void setDisplayIndex(string category, int index);
    event.setDisplayIndex('key.categories.debug', 7);
});

 


Copyright © 2026 [SpokenWig620933]

常见问题

KubeJS KeyBinds 支持哪些 Minecraft 版本?

KubeJS KeyBinds 支持 Minecraft Java 版 1.21.1,可用的加载器:NeoForge。下载时注意选择和你游戏版本一致的文件。

KubeJS KeyBinds 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 NeoForge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。

评论

登录后评论和评分

SpokenWig620933 的其他作品

查看全部 →