Interface reference
Every public type in com.ifels.controlflex.api: the entry point, the plugin interface, the four providers, the state registry, the overlay and camera hooks, and the asset installer. Each section gives the signature and its calling rules; the snippets are meant to be copied.
Section: Overview · Setup & lifecycle · Interfaces · Implementations · Who uses the API
Type overview
Package com.ifels.controlflex.api, 13 public types. Everything except IPlayerStateRegistry.setState() must be called on the client main thread.
| Type | Purpose |
|---|---|
ControlFlexApi | Static entry point: availability check plus provider accessors |
IControlFlexPlugin | SPI plugin interface (lifecycle callbacks) |
ICompatAssetInstaller | Asset installer (only usable inside the matching callback) |
IActionStateProvider | Query whether an action is currently active |
IInputProvider | Controller connection state and hardware view |
IControllerState | Live view of sticks / triggers / buttons |
IControllerCapabilities | Hardware capabilities (type, paddles, gyro, rumble) |
ButtonName | Button and axis name constants |
IPlayerStateRegistry | Push modId:state states for JSON to consume |
IInteractiveContextRegistrar | Declare an interactive overlay's foreground / background |
ICameraLookConsumer | Take over each frame's look delta (when a mod owns the camera) |
ControllerType · InputMode | Controller type / current input mode enums |
Input injection was removed in 0.9.0: IInputInjector and getInputInjector() are gone, so tooling that needs synthetic gamepad input has to stay on 0.8.x.
ControlFlexApi (static entry point)
boolean isAvailable() // installed and fully initialized
boolean isControllerConnected() // a controller is connected
// Providers (null when unavailable)
IActionStateProvider getActionStateProvider()
IInputProvider getInputProvider()
IPlayerStateRegistry getPlayerStateRegistry()
IInteractiveContextRegistrar getInteractiveContextRegistrar()
String getApiVersion() // e.g. "0.9.2"
void reloadGuides() // reload guide configs from disk
IActionStateProvider
boolean isGameActionActive(String actionId) // game layer (no screen open)
boolean isGuiActionActive(String actionId) // GUI layer
Set<String> getActiveGameActions() // live view: never cache across ticks
Set<String> getActiveGuiActions() // live view: never cache across ticks
Three action ID forms:
- Built-in actions:
attack,use,jump,sneak,move_forward… - Vanilla keys:
key.jump,key.sneak - Mod keys:
epicfight:key.epicfight.attack(modId:keyName; the key name carries nomodid:prefix)
IInputProvider · IControllerState · ICapabilities
// IInputProvider
boolean isConnected()
IControllerState getControllerState() // null when disconnected
IControllerCapabilities getCapabilities() // null when disconnected
String getGamepadName() // null when disconnected
int getGamepadIndex() // -1 when disconnected
// IControllerState — live view; sticks -1..1, triggers 0..1, +Y points down
float getLeftStickX() / getLeftStickY()
float getRightStickX() / getRightStickY()
float getLeftTrigger() / getRightTrigger()
boolean isButtonAPressed() ... isDpadUpPressed() ...
boolean isButtonPressed(String buttonName) // prefer ButtonName constants
float getAxisValue(String axisName)
boolean isShiftLayerActive()
// IControllerCapabilities
ControllerType getControllerType() // XBOX / PLAYSTATION / NINTENDO_SWITCH / ...
boolean hasPaddles() / int getPaddleCount()
boolean hasTouchpad() / hasGyro() / hasRumble() / hasAnalogTriggers()
boolean isNintendoLayout() // A/B swapped
ButtonName gives three groups: buttons (A…Y, DPAD_UP, LEFT_BUMPER, LEFT_TRIGGER, LEFT_STICK_CLICK, BACK, START, GUIDE, PADDLE_1…PADDLE_4, TOUCHPAD), stick directions (LEFT_STICK_UP …) and axes (AXIS_LEFT_X, AXIS_RIGHT_TRIGGER …).
IPlayerStateRegistry
void setState(String stateKey, boolean active) // thread-safe, callable from any thread
boolean getState(String stateKey) // client thread
void clearState(String stateKey) // drop the registration
stateKey is modId:stateName (e.g. epicfight:battle_mode) — exactly the string compat JSON reads in itemSuppressKeys[].playerState.
ICameraLookConsumer (0.8.8+)
boolean consumeLook(float yaw, float pitch)
// true = this frame's look is consumed: Control Flex must not write player rotation
// false = not consumed: Control Flex keeps its normal path
- Why: a mod has taken over the rendered camera (Epic Fight's TPS combat camera, lock-on, …), so the player's
yRot/xRotis no longer what you see; the look delta has to be handed to that mod. - Called at most once per frame; the arguments are deltas calibrated before turning, the same scale the vanilla mouse pipeline hands to the mod that took over.
- Override
cameraLookConsumer()in your plugin and return an implementation; returningnull(the default) means no takeover.
IInteractiveContextRegistrar
void notifyOverlayForeground(String className) // overlay entered the foreground
void notifyOverlayBackground(String className) // overlay went back (pairs with foreground)
void clearAll() // fallback: world unload / mod shutdown
className is the fully qualified class name — Control Flex looks it up in the compat JSON overlay table to resolve stick and cursor behavior. Null-check first: getInteractiveContextRegistrar() may be null.
ICompatAssetInstaller
boolean install(String resourcePath, String fileName)
// resourcePath: classpath path inside your jar, e.g. "/assets/mymod/compat/targetmod_keys.json"
// fileName: target file name inside compat/mods/ or guides/mods/
// returns: true when installed