Compatibility
Minecraft: Java Edition
Platforms
Supported environments
90% of ad revenue goes to creators
Support creators and Modrinth ad-free with Modrinth+Links
Details
Smart Key Prompts
Smart Key Prompts is a Minecraft mod that provides flexible key prompts and convenient key remapping, enhancing gameplay experience and improving keybind management.
For Modpack, we recommend working with KeyBindJS.
How to Use
- For regular players: Just install and play. No extra configuration needed.
- For modpack or mod developers: To define new key prompts in-game, choose one of the following methods:
- Have your target mod actively integrate with Smart Key Prompts.
- Use KubeJS to call exposed methods.
- Add support using datapacks (limited flexibility; see Datapack Extension Guide).
- Request native support through adaptation from this mod.
Main Features
Smart Key Prompts dynamically displays relevant key prompts based on context. It exposes APIs for developers to control prompt visibility:
// Show a registered key binding by ID.
public static void show(String id, String desc);
// Display a custom key prompt with key and description.
public static void custom(String id, String key, String desc);
// Alias an existing key binding with a different label.
public static void alias(String id, String key, String desc);
Call any of these methods during a client tick with conditional logic to show key prompts. See examples below.
Datapack-based support is also available, though with conditional limitations. For basic scenarios, it works well.
In-game Effect
Each id
represents a key group identifier. For example, the JEI integration uses jei_skp
and is disabled by default.
You can disable or enable key groups anytime via the config using their identifiers.
When prompts are visible:
- Press Control Key (default: K) + Left Click to open the keybinding config screen directly.
- Press Control Key + Right Click to toggle HUD visibility and position.
- Scroll Mouse Wheel while holding Control to scale the HUD.
Note: Keybinding config shortcut only works for
show
andalias
. It does not work forcustom
prompts.
In addition, this function can also be triggered actively to open the custom key binding settings interface and only display the given key bindings.
ConfigAction.modifyKey(List<String> keyDescList);
Holding the control key locks the prompt, removing the need to time your interactions precisely.
Development Examples
In language files, key
and desc
refer to these keys:
Example from assets/minecraft/lang/en_us.json
:
{
"key.keyboard.f11": "F11",
"key.keyboard.left.shift": "Left Shift",
"key.mouse.left": "Left Button"
}
Example from a mod’s file assets/tacz/lang/zh_cn.json
:
{
"key.tacz.fire_select.desc": "Fire Mode",
"key.tacz.inspect.desc": "Inspect",
"key.tacz.interact.desc": "Interact While Armed"
}
For a combination key, you can write it like this:
SmartKeyPrompts.custom(modid, "key.keyboard.left.shift+key.mouse.left", "Batch transfer of items");
Java Example:
@SubscribeEvent
public static void tick(TickEvent.ClientTickEvent event) {
if (!ModList.get().isLoaded("immersive_aircraft")) return;
Player player = Minecraft.getInstance().player;
if (player == null || Minecraft.getInstance().screen != null) return;
String vehicle = Utils.getVehicleType(player);
if (vehicle != null && vehicle.startsWith("immersive_aircraft:")) {
SmartKeyPrompts.custom(modid, Utils.getKeyByDesc("key.inventory"), "immersive_aircraft.slot.upgrade");
SmartKeyPrompts.show(modid, "key.immersive_aircraft.dismount");
String keyUse = Utils.getKeyByDesc("key.immersive_aircraft.fallback_use");
SmartKeyPrompts.custom(modid,
Objects.equals(keyUse, "key.keyboard.unknown") ? "key.mouse.right" : keyUse,
"item.immersive_aircraft.item.weapon");
if (vehicle.equals("immersive_aircraft:biplane")) {
SmartKeyPrompts.custom(modid, Utils.getKeyByDesc("key.jump"), "item.immersive_aircraft.engine");
}
}
}
KubeJS Example:
let SmartKeyPrompts = Java.loadClass("com.mafuyu404.smartkeyprompts.SmartKeyPrompts");
let Utils = Java.loadClass("com.mafuyu404.smartkeyprompts.init.Utils");
ClientEvents.tick(event => {
let player = event.player;
if (["key.left", "key.right", "key.forward", "key.back"]
.map(desc => Utils.isKeyPressedOfDesc(desc)).includes(true)) {
SmartKeyPrompts.show("parcool", "key.parcool.Dodge");
}
if (!player.onGround() && !player.isInWater()) {
SmartKeyPrompts.show("parcool", "key.parcool.Breakfall");
SmartKeyPrompts.show("parcool", "key.parcool.ClingToCliff");
}
if (player.isSprinting()) {
SmartKeyPrompts.show("parcool", "key.parcool.FastRun");
}
if (Utils.isKeyPressedOfDesc("key.parcool.FastRun")) {
SmartKeyPrompts.show("parcool", Utils.getKeyByDesc("key.parcool.Dodge"));
SmartKeyPrompts.custom("parcool", Utils.getKeyByDesc("key.sneak"), "parcool.action.CatLeap");
}
});
Datapack Example
From Datapack Extension Guide:
{
"modid": "tacz_skp",
"vars": {
"modLoaded": "isModLoaded('tacz')",
"hasTaczGun": "mainHandItem() == 'tacz:modern_kinetic_gun'",
"isNotInVehicle": "!isInVehicle()"
},
"entries": [
{
"when": {
"modLoaded": "true",
"hasTaczGun": "true",
"isNotInVehicle": "true"
},
"then": [
"show('tacz_skp', 'key.tacz.shoot.desc')",
"show('tacz_skp', 'key.tacz.zoom.desc')",
"show('tacz_skp', 'key.tacz.reload.desc')"
]
}
]
}
Advanced: Show Prompt Below Crosshair for Entity
@SubscribeEvent
public static void tick(TickEvent.ClientTickEvent event) {
if (!ModList.get().isLoaded(modid)) return;
if (Utils.getTargetedEntityType() == "minecraft:pig") {
SmartKeyPrompts.addDesc("key.pig.feed")
.forKey("key.mouse.right")
.withCustom(true)
.atPosition("crosshair")
.toGroup(modid);
}
}
In the example above:
custom
defines whether it appears in keybinding settings.position
sets display location; unaffected by HUD movement toggle.
Other Info
- Want another mod supported? Let us know!
- Want to contribute new key groups? Open a PR.
Planned Features
- More prompt display positions (e.g., follow mouse)
- Support for double-tap and long-press keys
- HUD aesthetic improvements
- Possible cross-version support