$ show MrCrayfish/Controllable
Controllable is a Minecraft Java Edition mod that adds native game controller support, enabling gameplay with Xbox, PlayStation, or other controllers. It features analog movement, context-sensitive button bindings, a radial menu for quick actions, a virtual cursor for menu navigation, and extensive configuration options. The mod supports both Fabric and NeoForge loaders through a clean platform abstraction layer, with shared core logic in the 'common' module and loader-specific implementations in 'fabric/' and 'neoforge/'. It integrates with popular mods like JEI, REI, and EMI via Mixins to ensure compatibility. The architecture emphasizes separation of concerns, with distinct systems for input handling, GUI, and configuration, demonstrating strong modular design and maintainability.
The LLM identified 4 files worth highlighting for reuse:
Implements a smooth, customizable virtual cursor controlled by controller sticks, with acceleration, snapping to interactive elements, and seamless switching between controller and mouse modes. This complex input translation system is highly reusable in any application requiring controller-based mouse emulation.
Central registry for managing input bindings that maps controller inputs to actions with context awareness. Features a robust handler system (press, release, tick, render) and context rules (e.g., in-game vs. in-menu) for dynamic behavior. This flexible input binding system could be adapted for other games or applications needing configurable, context-sensitive controls.
Highly configurable pie-menu for quick access to actions, supporting submenus, smooth animations, and controller-driven navigation. Designed specifically for gamepad use with customizable layout and appearance. This reusable UI component solves the common problem of providing efficient, ergonomic access to multiple actions via controller.
Platform abstraction layer that decouples core logic from mod loader specifics (Fabric/NeoForge) via interfaces (IClientHelper, IPlatformHelper) and loader-specific implementations. Uses Java's ServiceLoader pattern for dynamic discovery. This clean separation enables true multi-loader support and is a best practice for maintaining compatibility across evolving mod ecosystems.