Modding Callbacks

From Binding of Isaac: Rebirth Wiki
Jump to: navigation, search

Callbacks are how modders hook in to Afterbirth+ and make different functions execute. Without callbacks, there's no way to execute user code.

To add a callback, call modname:AddCallback(ModCallbacks.ENUM, fn, params)

where ENUM corresponds to the callback you'd like to hook into, fn is your function name, and params are optional extra parameters for this callback. Any name can be used for your callback function.

MC_NPC_UPDATE[edit | edit source]

Triggers when an NPC is updated. Passing an EntityType as a parameter will cause the callback to trigger only when entities of that type are updated.

The format of this callback function is: Template:ModCallback

MC_POST_UPDATE[edit | edit source]

Triggers when the game updates.

The format of this callback function is: Template:ModCallback

MC_POST_RENDER[edit | edit source]

Triggers every frame.

The format of this callback function is: Template:ModCallback

MC_USE_ITEM[edit | edit source]

Triggers when an active item is used. Passing an item ID as a parameter will cause the callback to trigger only when an item with that ID is used.

The format of this callback function is: Template:ModCallback

MC_POST_PEFFECT_UPDATE[edit | edit source]

Triggers every frame, for every player.

The format of this callback function is: Template:ModCallback

MC_USE_CARD[edit | edit source]

Triggers when a card is used. Passing a card ID as a parameter will cause the callback to trigger only when the used card has that card ID.

The format of this callback function is: Template:ModCallback

MC_FAMILIAR_UPDATE[edit | edit source]

Triggers every frame for each familiar. Passing a familiar variant will cause the callback to trigger only when that familiar updates.

The format of this callback function is: Template:ModCallback

MC_ENTITY_TAKE_DAMAGE[edit | edit source]

Triggers when an entity takes damage. Passing an entity as a parameter will cause the callback to trigger only when that entity is damaged. If an attacked entity is immune to damage, this callback will not trigger.

The format of this callback function is: Template:ModCallback