Skip to content

ModLoaderHookChain🔗

Inherits: RefCounted

Small class to keep the state of hook execution chains and move between mod hook calls.
For examples, see ModLoaderMod.add_hook().


Constants🔗

• LOG_NAME: "ModLoaderHookChain"🔗


Properties🔗

• reference_object🔗


Method Descriptions🔗

• Variant execute_next(args: Array)🔗

Description:🔗

Will execute the next mod hook callable or vanilla method and return the result.

Parameters:🔗

  • args (Array): An array of all arguments passed into the vanilla function.

Returns:

  • Variant: Return value of the next function in the chain.

Make sure to call this method once somewhere in the mod_callable you pass to ModLoaderMod.add_hook().


• Variant execute_next_async(args: Array)🔗

Description:🔗

Same as execute_next(), but asynchronous - it can be used if a method uses await.

Parameters:🔗

  • args (Array): An array of all arguments passed into the vanilla function.

Returns:

  • Variant: Return value of the next function in the chain.

This hook needs to be used if the vanilla method uses await somewhere.
Make sure to call this method once somewhere in the mod_callable you pass to ModLoaderMod.add_hook().