How skiddermc/fdpclient works
Main Components
• Core Client Engine – The entry point of the client (e.g., FDPClient.kt) that initializes all other parts.
• Module Manager – Located under features/module, this component is responsible for loading, enabling, and managing various game modifications (modules) like combat, movement, visual, player, and other miscellaneous modules.
• Event System – Appropriately found in the event package (and its async subpackages) that implements an observer/subscribe pattern for events triggering module actions.
• Command Manager – Under features/command, this manages different client commands (commands to toggle modules, bind keys, etc.).
• Injection Layer – Consisting of numerous mixin-related packages (injection/forge, mixins, transformers, etc.) that inject custom code into Minecraft’s original classes.
• Handlers – Various handler packages (e.g., handler/api, handler/cape, handler/irc, handler/macro, handler/discord) manage external APIs, messaging, cape handling, and other integrations.
• Configuration & File Management – Under file and its subpackages (configs and config/section) that deal with saving/loading client settings, module configurations, and profiles.
• Scripting & Remapping – Found within the script package, these components provide a script system for extending or altering client behavior.
• User Interface (UI) – Two main UI layers:
– Click GUI & Alt Manager (under ui/client/clickgui and ui/client/altmanager) for interacting with modules and settings.
– HUD and in-game overlays (under ui/client/hud) to present information on screen.
• Utility Libraries – A collection of diverse utility packages (utils, utils/client, utils/render, etc.) that support tasks like rendering, rotation, inventory management, timing, etc.
Relationships and Interactions
• The Core Engine starts up and instantiates the Module Manager which in turn registers all available modules.
• A centralized Event System (observer pattern) sends events from the game loop to registered modules, UI components, and other systems.
• The Command Manager listens to user input (via the UI) and issues commands that are processed by the Module Manager.
• Handlers (e.g., Discord, IRC, cape) act as integration endpoints. They may consume events from the core or command modules and in some cases, provide callbacks and additional data.
• The Configuration & File Manager system ensures settings are persisted. It supports the Module Manager and UI by supplying configuration data during runtime.
• The Scripting system builds upon these components, allowing runtime modifications via scripts that may trigger module behavior or extend event handling.
• The Utility Libraries are utilized by nearly all of the above components and thus can be represented as shared services supporting the system’s overall functionality.
Architectural Patterns and Design Principles
• Modular Design – Each client feature is implemented as an independent module (evident from the numerous “modules” packages) allowing for extensibility and dynamic loading/unloading.
• Observer/Publisher-Subscriber Pattern – Implemented by the event system to decouple event producers (game events) from consumers (modules, handlers).
• Dependency Injection via Mixins – The use of mixin-based injection into Minecraft’s classes creates a separation between the vanilla code and the injected functionality.
• Layered Architecture – Differentiating between low-level injection/utility components and high-level features (module managers, UI, handlers).