Skip to content

Enum "ModCallbacks"⚓︎

Execution order diagram: callback diagram

MC_NPC_UPDATE⚓︎

Called after an NPC is updated.

Returning any value will have no effect on later callback executions.

Warning

This callback will NOT fire when the NPC is playing the "Appear" animation. For example, when a Gaper spawns, it will fire on frame 1, then on frame 31 and onwards.

Example Code

This code will print "Hello World!" for every NPC Update. If the NPC is of the type "ENTITY_GAPER", it will also print "Gaper found".

1
2
3
4
5
6
7
8
9
function mod:myFunction(entity) -- 'entity' contains a reference to the NPC
    print("Hello World!")
end
mod:AddCallback(ModCallbacks.MC_NPC_UPDATE, mod.myFunction)

function mod:myFunction2(entity) -- 'entity' contains a reference to the NPC
    print("Gaper found!")
end
mod:AddCallback(ModCallbacks.MC_NPC_UPDATE, mod.myFunction2, EntityType.ENTITY_GAPER)

DLC Value Name Function Args Optional Args
0 MC_NPC_UPDATE (EntityNPC) EntityType

MC_POST_UPDATE⚓︎

Called after every game update.

Returning any value will have no effect on later callback executions.

Execution informations

This callback is called 30 times per second. It will not be called, when its paused (for example on screentransitions or on the pause menu).

DLC Value Name Function Args Optional Args
1 MC_POST_UPDATE - -

MC_POST_RENDER⚓︎

Called after every game render (60 times per second).

Returning any value will have no effect on later callback executions.

Execution informations

It is highly recommended to only use this function when you want to render something. Its not recommended to use this function for things which are not frequently used or need constant recalculation.

DLC Value Name Function Args Optional Args
2 MC_POST_RENDER - -

MC_USE_ITEM⚓︎

Called when a custom active item is used, after discharging it.

The item RNG allows for the item's random events to be seeded.

Return true to show the "use item" animation, otherwise false.Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
3 MC_USE_ITEM (CollectibleType,
RNG)
CollectibleType

MC_POST_PEFFECT_UPDATE⚓︎

Called for each player, each frame, after the player evaluates the effects of items that must be constantly evaluated.

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
4 MC_POST_PEFFECT_UPDATE (EntityPlayer) PlayerType

MC_USE_CARD⚓︎

Called when a card/rune is used.

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
5 MC_USE_CARD (Card) Card

MC_FAMILIAR_UPDATE⚓︎

Called every frame for each familiar.

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
6 MC_FAMILIAR_UPDATE (EntityFamiliar) FamiliarVariant

MC_FAMILIAR_INIT⚓︎

Called just after a familiar is initialized.

Returning any value will have no effect on later callback executions.

Bug

This Callback provides incomplete data in the EntityFamiliar attribute. For example, the Position is always equal to Vector(0,0).

DLC Value Name Function Args Optional Args
7 MC_FAMILIAR_INIT (EntityFamiliar) FamiliarVariant

MC_EVALUATE_CACHE⚓︎

Called one or more times when a player's stats must be re-evaluated, such as after picking up an item, using certain pills or manually calling EvaluateItems() on an EntityPlayer.

Returning any value will have no effect on later callback executions.

Hint

Use this to let custom items change the player's stats, familiars, flying, weapons, etc. Items tell the game which stats they affect using cache values in items.xml. Then the callback should respond to the CacheFlag by setting the corresponding player stat. Other items' stat modifiers, multipliers, etc are applied before this callback is called.

DLC Value Name Function Args Optional Args
8 MC_EVALUATE_CACHE (EntityPlayer,
CacheFlag)
CacheFlag

MC_POST_PLAYER_INIT⚓︎

Called after a Player Entity is initialized.

The optional parameter can be used to specify a Player Variant. 0 = Player, 1 = Co-Op-Baby

Returning any value will have no effect on later callback executions.

Bug

This Callback provides incomplete data in the EntityPlayer attribute. For example, the Position is always equal to Vector(0,0).

DLC Value Name Function Args Optional Args
9 MC_POST_PLAYER_INIT (EntityPlayer) PlayerVariant*

MC_USE_PILL⚓︎

Called when a pill is used.

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
10 MC_USE_PILL (PillEffect) PillEffect

MC_ENTITY_TAKE_DMG⚓︎

Called before new damage is applied.

If the entity has a DAMAGE_COUNTDOWN flag, it will ignore any other DAMAGE_COUNTDOWN hits for the duration specified.

Return true or nil if the entity or player should sustain the damage, otherwise false to ignore it. If the entity is an EntityPlayer, the DamageAmount is the integer number of half-hearts of damage that the player will take. Otherwise, DamageAmount is a number of hit points.

Bug

Returning any value besides nil will prevent later callbacks from being executed.

DLC Value Name Function Args Optional Args
11 MC_ENTITY_TAKE_DMG (TookDamage [Entity],
DamageAmount [float],
DamageFlags [int],
DamageSource [EntityRef],
DamageCountdownFrames [int])
EntityType

MC_POST_CURSE_EVAL⚓︎

Curses is a bitmask containing current curses. Called after the current Level applied it's curses. Returns the new curse bitmask. Use Isaac.GetCurseIdByName() to get the curseID.

If a number is returned, it will be the "Curses" arg for later executed callbacks.

Bug

Returning a value that is not an integer or nil will cause the game to crash.

Warning

The last callback to return a valid return value wins out and overwrites previous callbacks' return values

DLC Value Name Function Args Optional Args
12 MC_POST_CURSE_EVAL (Curses) -

MC_INPUT_ACTION⚓︎

It is called when game/game entities wants to read an action input.

Entity can be nil if the input is not read from an entity class.

The InputHook value can be used to determine if this callback was called through Input.IsActionTriggered(), Input.IsActionPressed(), or Input.GetActionValue()

Return nil if you don't want to overwrite the input or value.

The return value can be bool if it's a IS_ACTION_XXX hook or float if it's an GET_ACTION_VALUE hook. Float values should be in range of 0.0 and 1.0

Returning any value will have no effect on later callback executions.

Execution informations

This callback is called roughly 1470 times a second.

DLC Value Name Function Args Optional Args
13 MC_INPUT_ACTION (Entity,
InputHook,
ButtonAction)
InputHook

MC_LEVEL_GENERATOR⚓︎

Bug

This callback doesn't work right now and will never be called by the game!

DLC Value Name Function Args Optional Args
14 MC_LEVEL_GENERATOR - -

MC_POST_GAME_STARTED⚓︎

This function gets called when you start a game. The boolean value is true when you continue a run, false when you start a new one.

This callback will be called after MC_POST_NEW_ROOM and after MC_POST_NEW_LEVEL.

Returning any value will have no effect on later callback executions.

Example code
1
2
3
4
local function onStart(_,bool)
    print(bool)
end
mod:AddCallback(ModCallbacks.MC_POST_GAME_STARTED, onStart) 
DLC Value Name Function Args Optional Args
15 MC_POST_GAME_STARTED (IsContinued [bool]) -

MC_POST_GAME_END⚓︎

This function gets called when the game over screen appears, or when the an ending starts playing. The boolean value is true when you died and got a game over, false when you won and got an ending.

Returning any value will have no effect on later callback executions.

Example code
1
2
3
4
local function onEnd(_,bool)
    print(bool)
end
mod:AddCallback(ModCallbacks.MC_POST_GAME_END, onEnd)
DLC Value Name Function Args Optional Args
16 MC_POST_GAME_END (IsGameOver [bool]) -

MC_PRE_GAME_EXIT⚓︎

This function gets called when you quit a run. The boolean value is true when the game would normally create a continuable save, false when it wouldn't. Called twice when the game plays an ending.

Returning any value will have no effect on later callback executions.

Example code
1
2
3
4
local function onExit(_,bool)
    print(bool)
end
mod:AddCallback(ModCallbacks.MC_PRE_GAME_EXIT, onExit) 
DLC Value Name Function Args Optional Args
17 MC_PRE_GAME_EXIT (ShouldSave [bool]) -

MC_POST_NEW_LEVEL⚓︎

This triggers after transitioning a level or stage.

Its always called after MC_POST_NEW_ROOM.

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
18 MC_POST_NEW_LEVEL - -

MC_POST_NEW_ROOM⚓︎

This triggers after entering a room.

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
19 MC_POST_NEW_ROOM - -

MC_GET_CARD⚓︎

This callback is used for handling Card Pools.

Because not all cards have the same chance to spawn, use RNG for a seeded random selection.

You can use the boolean values as a filter for the selection.

The return value determines, what Card will be spawned. Return nil to not replace the spawned card.

Returned values will not update the "Card" arg of later executed callbacks.

Bug

Returning a value that is not an integer or nil will cause the game to crash.

Warning

The last callback to return a valid return value wins out and overwrites previous callbacks' return values

DLC Value Name Function Args Optional Args
20 MC_GET_CARD (RNG,
Card,
IncludePlayingCards [bool],
IncludeRunes [bool],
OnlyRunes [bool])
-

MC_GET_SHADER_PARAMS⚓︎

Returns a table containing a key -> value pair for custom shader parameters.

DLC Value Name Function Args Optional Args
21 MC_GET_SHADER_PARAMS (ShaderName [string]) -

MC_EXECUTE_CMD⚓︎

Returns a string separated by <br /> (newline) per output line CMD is the first word of the Console input.

The parameters are the rest of the Input.

Important

This function is NOT called for default game commands like Spawn or Debug.

Returning a string will print it to the console.

Returning any value will have no effect on later callback executions.

Example code
1
2
3
4
5
6
7
8
function mod.oncmd(_, command, args)
    print(command)
    print(args)
end
mod:AddCallback(ModCallbacks.MC_EXECUTE_CMD, mod.oncmd)
-- executing command "Test apple 1 Pear test" prints
-- Test
-- apple 1 Pear test 
DLC Value Name Function Args Optional Args
22 MC_EXECUTE_CMD (CMD [string],
Parameters [string])
-

MC_PRE_USE_ITEM⚓︎

Called before an item is used.

Return true to prevent the default code of an item to be triggered. This will still discharge the item.

Bug

Returning any value besides nil will also prevent later callbacks from being executed.

DLC Value Name Function Args Optional Args
23 MC_PRE_USE_ITEM (CollectibleType,
RNG)
CollectibleType

MC_PRE_ENTITY_SPAWN⚓︎

Called right before an entity is spawned.

Optional: Return a table with new values { Type, Variant, Subtype, Seed } to override these values of the spawned entity.

Bug

Returning a value that is not a table or nil will cause the game to crash.

Warning

The last callback to return a valid return value wins out and overwrites previous callbacks' return values

DLC Value Name Function Args Optional Args
24 MC_PRE_ENTITY_SPAWN (EntityType,
Variant [int],
SubType [int],
Position [Vector],
Velocity [Vector],
Spawner [Entity],
Seed [int])
-

MC_POST_FAMILIAR_RENDER⚓︎

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
25 MC_POST_FAMILIAR_RENDER (EntityFamiliar,
RenderOffset [Vector])
FamiliarVariant

MC_PRE_FAMILIAR_COLLISION⚓︎

The Low value is true, when the entity collided with the collider first. Its false if the collider collides first.

Return true to ignore collision, false to collide but not execute internal code and nil to continue with internal code (example: taking damage on contact).

Bug

This Callback can only be used ONCE across all mods! It is highly recommended to not use this Callback without defining a FamiliarVariant unless its absolutely nessesary!

DLC Value Name Function Args Optional Args
26 MC_PRE_FAMILIAR_COLLISION (EntityFamiliar,
Collider [Entity],
Low [bool])
FamiliarVariant

MC_POST_NPC_INIT⚓︎

Returning any value will have no effect on later callback executions.

Bug

This Callback provides incomplete data in the EntityNPC attribute. For example, the Position is always equal to Vector(0,0).

DLC Value Name Function Args Optional Args
27 MC_POST_NPC_INIT (EntityNPC) EntityType

MC_POST_NPC_RENDER⚓︎

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
28 MC_POST_NPC_RENDER (EntityNPC,
RenderOffset [Vector])
EntityType

MC_POST_NPC_DEATH⚓︎

Gets called after the Death animation is played.

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
29 MC_POST_NPC_DEATH (EntityNPC) EntityType

MC_PRE_NPC_COLLISION⚓︎

The Low value is true, when the entity collided with the collider first. Its false if the collider collides first.

Return true to ignore collision, false to collide but not execute internal code and nil to continue with internal code (example: taking damage on contact).

Bug

This Callback can only be used ONCE across all mods! It is highly recommended to not use this Callback without defining an EntityType unless its absolutely nessesary!

DLC Value Name Function Args Optional Args
30 MC_PRE_NPC_COLLISION (EntityNPC,
Collider [Entity],
Low [bool])
EntityType

MC_POST_PLAYER_UPDATE⚓︎

The optional parameter can be used to specify a Player Variant. 0 = Player, 1 = Co-Op-Baby

Returning any value will have no effect on later callback executions.

Execution informations

This callback is called 60 times per second

DLC Value Name Function Args Optional Args
31 MC_POST_PLAYER_UPDATE (EntityPlayer) PlayerVariant*

MC_POST_PLAYER_RENDER⚓︎

The optional parameter can be used to specify a Player Variant. 0 = Player, 1 = Co-Op-Baby

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
32 MC_POST_PLAYER_RENDER (EntityPlayer,
RenderOffset [Vector])
PlayerVariant*

MC_PRE_PLAYER_COLLISION⚓︎

The Low value is true, when the entity collided with the collider first. Its false if the collider collides first.

Return true to ignore collision, false to collide but not execute internal code and nil to continue with internal code (example: taking damage on contact).

The optional parameter can be used to specify a Player Variant. 0 = Player, 1 = Co-Op-Baby

Bug

This Callback can only be used ONCE across all mods! It is highly recommended to not use this Callback unless its absolutely nessesary!

DLC Value Name Function Args Optional Args
33 MC_PRE_PLAYER_COLLISION (EntityPlayer,
Collider [Entity],
Low [bool])
PlayerVariant*

MC_POST_PICKUP_INIT⚓︎

Returning any value will have no effect on later callback executions.

Bug

This Callback provides incomplete data in the EntityPickup attribute. For example, the Position is always equal to Vector(0,0).

DLC Value Name Function Args Optional Args
34 MC_POST_PICKUP_INIT (EntityPickup) PickupVariant

MC_POST_PICKUP_UPDATE⚓︎

Returning any value will have no effect on later callback executions.

Execution informations

This callback will be called on the 1st frame that the entity exists. It will only be called on the 0th frame, when you enter a room that already contains a spawned pickup.

DLC Value Name Function Args Optional Args
35 MC_POST_PICKUP_UPDATE (EntityPickup) PickupVariant

MC_POST_PICKUP_RENDER⚓︎

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
36 MC_POST_PICKUP_RENDER (EntityPickup,
RenderOffset [Vector])
PickupVariant

MC_POST_PICKUP_SELECTION⚓︎

Called after a Pickup was choosen from a list of random pickups to be spawned.Return nil to continue with default game code.

Return a table { Variant, Subtype } to override the specified values. This does also affect later executed callbacks.

Bug

Returning a value that is not a table or nil will cause the game to crash.

Warning

The last callback to return a valid return value wins out and overwrites previous callbacks' return values

Bug

EntityPickup does contain the Type/variant of the pickup to spawn, but is otherwise an empty class with empty / zeroed values.

This Callback is also called when entering a room that contains pickups that are already selected. It is also called when the player drops a card. Those facts make this callback useless to use for handling pickup pools.

DLC Value Name Function Args Optional Args
37 MC_POST_PICKUP_SELECTION (EntityPickup,
Variant [int],
Subtype [int])
-

MC_PRE_PICKUP_COLLISION⚓︎

The Low value is true, when the entity collided with the collider first. Its false if the collider collides first.

Return true to ignore collision, false to collide but not execute internal code and nil to continue with internal code (example: taking damage on contact).

Bug

This Callback can only be used ONCE across all mods! It is highly recommended to not use this Callback without defining an PickupVariant unless its absolutely nessesary!

DLC Value Name Function Args Optional Args
38 MC_PRE_PICKUP_COLLISION (EntityPickup,
Collider [Entity],
Low [bool])
PickupVariant

MC_POST_TEAR_INIT⚓︎

Returning any value will have no effect on later callback executions.

Bug

This Callback provides incomplete data in the EntityTear attribute. For example, the Position is always equal to Vector(0,0).

DLC Value Name Function Args Optional Args
39 MC_POST_TEAR_INIT (EntityTear) TearVariant

MC_POST_TEAR_UPDATE⚓︎

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
40 MC_POST_TEAR_UPDATE (EntityTear) TearVariant

MC_POST_TEAR_RENDER⚓︎

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
41 MC_POST_TEAR_RENDER (EntityTear,
RenderOffset [Vector])
TearVariant

MC_PRE_TEAR_COLLISION⚓︎

The Low value is true, when the entity collided with the collider first. Its false if the collider collides first.

Return true to ignore collision, false to collide but not execute internal code and nil to continue with internal code (example: taking damage on contact).

Bug

This Callback can only be used ONCE across all mods! It is highly recommended to not use this Callback without defining an PickupVariant unless its absolutely nessesary!

DLC Value Name Function Args Optional Args
42 MC_PRE_TEAR_COLLISION (EntityTear,
Collider [Entity],
Low [bool])
TearVariant

MC_POST_PROJECTILE_INIT⚓︎

Returning any value will have no effect on later callback executions.

Bug

This Callback provides incomplete data in the EntityProjectile attribute. For example, the Position is always equal to Vector(0,0).

DLC Value Name Function Args Optional Args
43 MC_POST_PROJECTILE_INIT (EntityProjectile) ProjectileVariant

MC_POST_PROJECTILE_UPDATE⚓︎

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
44 MC_POST_PROJECTILE_UPDATE (EntityProjectile) ProjectileVariant

MC_POST_PROJECTILE_RENDER⚓︎

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
45 MC_POST_PROJECTILE_RENDER (EntityProjectile,
RenderOffset [Vector])
ProjectileVariant

MC_PRE_PROJECTILE_COLLISION⚓︎

The Low value is true, when the entity collided with the collider first. Its false if the collider collides first.

Return true to ignore collision, false to collide but not execute internal code and nil to continue with internal code (example: taking damage on contact).

Bug

This Callback can only be used ONCE across all mods! It is highly recommended to not use this Callback without defining an ProjectileVariant unless its absolutely nessesary!

DLC Value Name Function Args Optional Args
46 MC_PRE_PROJECTILE_COLLISION (EntityProjectile,
Collider [Entity],
Low [bool])
ProjectileVariant

MC_POST_LASER_INIT⚓︎

Returning any value will have no effect on later callback executions.

Bug

This Callback provides incomplete data in the EntityLaser attribute. For example, the Position is always equal to Vector(0,0).

DLC Value Name Function Args Optional Args
47 MC_POST_LASER_INIT (EntityLaser) LaserVariant

MC_POST_LASER_UPDATE⚓︎

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
48 MC_POST_LASER_UPDATE (EntityLaser) LaserVariant

MC_POST_LASER_RENDER⚓︎

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
49 MC_POST_LASER_RENDER (EntityLaser,
RenderOffset [Vector])
LaserVariant

MC_POST_KNIFE_INIT⚓︎

Returning any value will have no effect on later callback executions.

Note

The optional parameter is a SubType and NOT a Variant!

Bug

This Callback provides incomplete data in the EntityKnife attribute. For example, the Position is always equal to Vector(0,0).

DLC Value Name Function Args Optional Args
50 MC_POST_KNIFE_INIT (EntityKnife) KnifeSubType *

MC_POST_KNIFE_UPDATE⚓︎

Returning any value will have no effect on later callback executions.

Note

The optional parameter is a SubType and NOT a Variant!

DLC Value Name Function Args Optional Args
51 MC_POST_KNIFE_UPDATE (EntityKnife) KnifeSubType *

MC_POST_KNIFE_RENDER⚓︎

Returning any value will have no effect on later callback executions.

Note

The optional parameter is a SubType and NOT a Variant!

DLC Value Name Function Args Optional Args
52 MC_POST_KNIFE_RENDER (EntityKnife,
RenderOffset [Vector])
KnifeSubType *

MC_PRE_KNIFE_COLLISION⚓︎

The Low value is true, when the entity collided with the collider first. Its false if the collider collides first.

Return true to ignore collision, false to collide but not execute internal code and nil to continue with internal code (example: taking damage on contact).

Note

The optional parameter is a SubType and NOT a Variant!

Bug

This Callback can only be used ONCE across all mods! It is highly recommended to not use this Callback without defining an KnifeSubType unless its absolutely nessesary!

DLC Value Name Function Args Optional Args
53 MC_PRE_KNIFE_COLLISION (EntityKnife,
Collider [Entity],
Low [bool])
KnifeSubType *

MC_POST_EFFECT_INIT⚓︎

Returning any value will have no effect on later callback executions.

Bug

This Callback provides incomplete data in the EntityEffect attribute. For example, the Position is always equal to Vector(0,0).

DLC Value Name Function Args Optional Args
54 MC_POST_EFFECT_INIT (EntityEffect) EffectVariant

MC_POST_EFFECT_UPDATE⚓︎

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
55 MC_POST_EFFECT_UPDATE (EntityEffect) EffectVariant

MC_POST_EFFECT_RENDER⚓︎

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
56 MC_POST_EFFECT_RENDER (EntityEffect,
RenderOffset [Vector])
EffectVariant

MC_POST_BOMB_INIT⚓︎

Returning any value will have no effect on later callback executions.

Bug

This Callback provides incomplete data in the EntityBomb attribute. For example, the Position is always equal to Vector(0,0).

DLC Value Name Function Args Optional Args
57 MC_POST_BOMB_INIT (EntityBomb) BombVariant

MC_POST_BOMB_UPDATE⚓︎

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
58 MC_POST_BOMB_UPDATE (EntityBomb) BombVariant

MC_POST_BOMB_RENDER⚓︎

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
59 MC_POST_BOMB_RENDER (EntityBomb,
Offset [Vector])
BombVariant

MC_PRE_BOMB_COLLISION⚓︎

The Low value is true, when the entity collided with the collider first. Its false if the collider collides first.

Return true to ignore collision, false to collide but not execute internal code and nil to continue with internal code (example: taking damage on contact).

Bug

This Callback can only be used ONCE across all mods! It is highly recommended to not use this Callback unless its absolutely nessesary!

DLC Value Name Function Args Optional Args
60 MC_PRE_BOMB_COLLISION (EntityBomb,
Collider [Entity],
Low [bool])
BombVariant

MC_POST_FIRE_TEAR⚓︎

Called when the player fires a tear.

It is not called for other weapons or tears fired with Incubus.

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
61 MC_POST_FIRE_TEAR (EntityTear) -

MC_PRE_GET_COLLECTIBLE⚓︎

This callback is called when the game needs to get a new random item from an item pool.

You can return an integer from this callback in order to change the returned collectible type.

It is not called for "scripted" drops (like Mr. Boom from Wrath) and manually spawned items.

Returned values will not alter args of later executed callbacks.

Bug

Returning a value that is not a table or nil will cause the game to crash.

Warning

The last callback to return a valid return value wins out and overwrites previous callbacks' return values

DLC Value Name Function Args Optional Args
62 MC_PRE_GET_COLLECTIBLE (ItemPoolType,
Decrease [bool],
Seed [int])
-

MC_POST_GET_COLLECTIBLE⚓︎

This function is called right after MC_PRE_GET_COLLECTIBLE and determines the Collectible that will be spawned from the given ItemPoolType.

You can return an integer from this callback in order to change the returned collectible type.

Returned values will not update the "SelectedCollectible" arg of later executed callbacks.

Bug

Returning a value that is not a table or nil will cause the game to crash.

Warning

The last callback to return a valid return value wins out and overwrites previous callbacks' return values

DLC Value Name Function Args Optional Args
63 MC_POST_GET_COLLECTIBLE (SelectedCollectible [CollectibleType],
ItemPoolType,
Decrease [bool],
Seed [int])
-

MC_GET_PILL_COLOR⚓︎

This function is called, when the game is spawning a pill and needs to determine its PillColor.

Return a PillColor to specify a Pillcolor that needs to be choosen. Return nothing to let it be handled by the game.

Returned values will not alter the args of later executed callbacks.

Bug

Returning a value that is not a table or nil will cause the game to crash.

Warning

The last callback to return a valid return value wins out and overwrites previous callbacks' return values

DLC Value Name Function Args Optional Args
64 MC_GET_PILL_COLOR (Seed [int]) -

MC_GET_PILL_EFFECT⚓︎

Called every frames when the game get the PillEffect of a pill. The effect of the pill can be choosed by returning the chosen PillEffect.

The effect is applied to every pill of the same PillColor, not to a single pill.

Returned values will not update the "SelectedPillEffect" arg of later executed callbacks.

Bug

Returning a value that is not a table or nil will cause the game to crash.

Warning

The last callback to return a valid return value wins out and overwrites previous callbacks' return values

Example code

This code turn "Bad Trip" pills into "Balls of Steel" pills.

1
2
3
4
5
6
function mod:getPillEffect(pillEffect, pillColor)
    if pillEffect == PillEffect.PILLEFFECT_BAD_TRIP then
    return PillEffect.PILLEFFECT_BALLS_OF_STEEL
    end
end
mod:AddCallback(ModCallbacks.MC_GET_PILL_EFFECT, mod.getPillEffect) 

DLC Value Name Function Args Optional Args
65 MC_GET_PILL_EFFECT (SelectedPillEffect [PillEffect],
PillColor)
-

MC_GET_TRINKET⚓︎

Called when a TrinketType of a Trinket needs to be determined.

A TrinketType can be returned to change the SelectedTrinket.

Returned values will not update the "SelectedTrinket" arg of later executed callbacks.

Bug

Returning a value that is not a table or nil will cause the game to crash.

Warning

The last callback to return a valid return value wins out and overwrites previous callbacks' return values

DLC Value Name Function Args Optional Args
66 MC_GET_TRINKET (SelectedTrinket [TrinketType],
RNG)
-

MC_POST_ENTITY_REMOVE⚓︎

Called whenever an Entity gets removed by the game. This includes deaths, kills, removals and even unloading an entity on room transition or ending a run.

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
67 MC_POST_ENTITY_REMOVE (Entity) EntityType

MC_POST_ENTITY_KILL⚓︎

Called right before a death animation is triggered for an Entity.

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
68 MC_POST_ENTITY_KILL (Entity) EntityType

MC_PRE_NPC_UPDATE⚓︎

Return true if the internal AI of an NPC should be ignored, false or nil/nothing otherwise.

Bug

This Callback can only be used ONCE across all mods! It is highly recommended to not use this Callback unless its absolutely nessesary!

DLC Value Name Function Args Optional Args
69 MC_PRE_NPC_UPDATE (EntityNPC) EntityType

MC_PRE_SPAWN_CLEAN_AWARD⚓︎

This function is triggered in every room that can be cleared, including boss and angel rooms, and even when it normally would not spawn a reward.

This Callback also handles special spawns like the spawning of Trapdoors after a boss is killed, therefore returning true here will also cancel those events.

Return true if the spawn routine should be ignored, false or nil/nothing otherwise.

Bug

This Callback can only be used ONCE across all mods! It is highly recommended to not use this Callback unless its absolutely nessesary!

DLC Value Name Function Args Optional Args
70 MC_PRE_SPAWN_CLEAN_AWARD (RNG,
SpawnPosition [Vector])
-

MC_PRE_ROOM_ENTITY_SPAWN⚓︎

This is called when entering a new room, before spawning entities which are part of its layout. Grid entities will also trigger this callback and their type will the same as the type used by the gridspawn command. Because of this, effects are assigned the type 999 instead of 1000 in this callback.

Optional: Return a table with new values { Type, Variant, Subtype }. Returning such a table will override any replacements that might naturally occur i.e. enemy variants.

Returning any value will have no effect on later callback executions.

DLC Value Name Function Args Optional Args
71 MC_PRE_ROOM_ENTITY_SPAWN (EntityType,
Variant [int],
SubType [int],
GridIndex [int],
Seed [int])
-

Last update: June 9, 2021