Context-Aware Keybinds for Minecraft
Intent transforms your keybinds into intelligent, context-aware actions. Instead of remembering dozens of keys for different mods, you can assign multiple functions to a single key, triggered automatically by specific conditions like your health, equipment, or movement state.
R) to perform different actions based on the situation.
R throws an Ender Pearl if holding one, but opens your Inventory if your hand is empty.I (default) to open the Intent Editor to configure your rules visually.Press I to open the Intent Editor.
Key R) on the left.is_sneaking).Intent allows you to "Virtualize" a keybinding. This unbinds the action from the vanilla controls options so it doesn't conflict with your custom Intent rules.
Intent exports a dedicated API jar, allowing other mods to add custom Context Types (conditions) and Editors.
Intent is available via JitPack. Add the following to your build.gradle:
repositories {
maven { url '[https://jitpack.io](https://jitpack.io)' }
}
dependencies {
// Compile against the API (Recommended)
implementation "com.github.kjmaster1:Intent:v1.0.0:api"
// Or include the full mod for runtime testing
// implementation "com.github.kjmaster1:Intent:v1.0.0"
}
To add a new condition (e.g., checking if it's raining), implement IIntentContext and register a ContextType.
Create the Context:
public record RainingContext() implements IIntentContext {
public static final MapCodec<RainingContext> CODEC = MapCodec.unit(new RainingContext());
@Override
public boolean test(LocalPlayer player) {
return player.level().isRaining();
}
@Override
public ContextType<?> getType() {
return MyRegistries.IS_RAINING.get();
}
}
Register the Type:
Use IntentAPI.CONTEXT_TYPE_REGISTRY_KEY to register your type to the Intent registry.
public static final DeferredRegister<IIntentContext.ContextType<?>> CONTEXT_TYPES =
DeferredRegister.create(IntentAPI.CONTEXT_TYPE_REGISTRY_KEY, "my_mod_id");
public static final DeferredHolder<IIntentContext.ContextType<?>, IIntentContext.ContextType<RainingContext>> IS_RAINING =
CONTEXT_TYPES.register("is_raining", () -> () -> RainingContext.CODEC);
To make your custom context editable in the Intent GUI, register an IContextEditor.
// In your Client Setup
ContextEditorRegistry.register(MyRegistries.IS_RAINING.get(), () -> new SimpleStateEditor<>(RainingContext::new));
This project is licensed under the MIT License.