Modern KeyBinding 图标

Modern KeyBinding

作者:rebot | 分类:模组

价格:0 墨喵币 下载量:0 点赞:0 版本 1.20.4-1.3.0
本资源为搬运资源,原资源地址: https://modrinth.com/mod/modernkeybinding
资源信息

Minecraft 版本: 1.20.4

平台: fabric

标签: library utility

资源介绍

Modern KeyBinding

The mod ported the newer version's KeyModifier && KeyConflictContext back to Fabric & Early Forge.

Features

You can now define a keybinding's activation key with key modifiers. Like "Ctrl + G" or "Alt + S";

The keybindings with the same activation key but different key conflict contexts no longer conflict.

"Non-conflict keys" (disabled by default): The keybindings with the same key will all be activated if the key is pressed.

Attention:

The mod will crash with NEI. Use NEI Unofficial(Dependencies: CodeChickenCore | CodeChickenLib) by GTNH instead.

Import as a Gradle dependency

repositories {
    //...
    maven {
        url "https://maven.nova-committee.cn/releases"
    }
}
dependencies {
    //...
    // Forge
    implementation "committee.nova.mkb.forge:mkb-${mc_version}:${mod_version}"
    // Fabric
    modImplementation "committee.nova.mkb.fabric:mkb-${mc_version}:${mod_version}"
}

Register a keybinding

Register a keybinding that:

  • Activates when Alt and C are pressed;

  • Only available in GUI.

ClientProxy.java

public class ClientProxy {
    public void init(final FMLInitializationEvent event) {
        //...
        yourKeyBinding = KeyBindingRegistry.INSTANCE.registerKeyBinding("key.exampleKey", KeyConflictContext.GUI, KeyModifier.ALT, Keyboard.KEY_C, "key.categories.example");
    }
}

Change the properties of an existing keybinding

ClientProxy.java

public class ClientProxy {
    //...
    public void postInit(final FMLPostInitializationEvent event) {
        final IKeyBinding extended = (IKeyBinding) yourKeyBinding;
        // Change the key's keyCode and modifier, as their default values.
        extended.setInitialKeyModifierAndCode(KeyModifier.ALT, Keyboard.KEY_E);
        // Change the key's keyCode and modifier.
        extended.setKeyModifierAndCode(KeyModifier.ALT, Keyboard.KEY_E);
        // Change the key's conflict context.
        extended.setKeyConflictContext(KeyConflictContext.IN_GAME);
    }
}
📥 下载与版本
评论(0)
登录 后发表评论。

暂无评论,抢个沙发吧~

举报此资源

请登录后举报

🔥 相关推荐
Smooth Boot (Reloaded)

价格:0 墨喵币
下载量:0

查看详情
Configured Defaults

价格:0 墨喵币
下载量:0

查看详情
Maxi's JourneyMap Cobblemon Minimap Icons

价格:0 墨喵币
下载量:0

查看详情
Jaden's Nether Expansion

价格:0 墨喵币
下载量:0

查看详情