Compatibility Handler - LambdAurora/LambdaControls GitHub Wiki

A compatibility handler lets other mods adds compatibility in an easy manner without needing mixins.

The main purpose of this is to be an entrypoint to add the button bindings but is not limited to.

Implementation

To implements a compatibility handler you have to implements CompatHandler.

CompatHandler#handle(LambdaControlsClient)

This is the main entrypoint, it's where a mod can register button bindings.

CompatHandler#requireMouseOnScreen(Screen) (optional)

Returns whether the mouse is required on the specified screen.

Return value: true if the mouse is required on the specified screen, else false.

CompatHandler#isCreativeSlot(@NotNull HandledScreen, @NotNull Slot) (optional)

Returns whether the current slot is a creative slot or not.

Return value: true if the slot is a creative slot, else false.

CompatHandler#getAttackActionAt(@NotNull MinecraftClient, @Nullable BlockHitResult) (optional)

Returns a custom translation key to make custom attack action strings on the HUD.

Param placeResult - The last place block result.

Return value: null if untouched, else a translation key.

CompatHandler#getUseActionAt(@NotNull MinecraftClient, @Nullable BlockHitResult) (optional)

Returns a custom translation key to make custom use action strings on the HUD.

Param placeResult - The last place block result.

Return value: null if untouched, else a translation key.

CompatHandler#handleMenuBack(@NotNull MinecraftClient, @NotNull Screen) (optional)

Fired when the mod attempts to go back in a menu.

Return value: true if successful, else false.

Registering

To register your compatibility handler just do LambdaControlsCompat#registerCompatHandler. Might use the ModMenu's way in the future.