Skip to content

ModCallback

Defined in: ModCallback.ts:1

POST_NPC_UPDATE: 0

Defined in: ModCallback.ts:11

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the EntityType provided.
function postNPCUpdate(npc: EntityNPC): void {}

POST_UPDATE: 1

Defined in: ModCallback.ts:20

You cannot filter this callback.

function postUpdate(): void {}

POST_RENDER: 2

Defined in: ModCallback.ts:29

You cannot filter this callback.

function postRender(): void {}

POST_USE_ITEM: 3

Defined in: ModCallback.ts:50

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the CollectibleType provided.
function useItem(
collectibleType: CollectibleType,
rng: RNG,
player: EntityPlayer,
useFlags: BitFlags<UseFlag>,
activeSlot: int,
customVarData: int,
):
| boolean
| { Discharge: boolean; Remove: boolean; ShowAnim: boolean }
| undefined;

POST_PEFFECT_UPDATE: 4

Defined in: ModCallback.ts:65

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the PlayerType provided.
function postPEffectUpdate(player: EntityPlayer): void {}

POST_USE_CARD: 5

Defined in: ModCallback.ts:80

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the CardType provided.
function postUseCard(
cardType: CardType,
player: EntityPlayer,
useFlags: BitFlags<UseFlag>,
): void {}

POST_FAMILIAR_UPDATE: 6

Defined in: ModCallback.ts:91

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the FamiliarVariant provided.
function postFamiliarUpdate(familiar: EntityFamiliar): void {}

POST_FAMILIAR_INIT: 7

Defined in: ModCallback.ts:110

Unlike in Afterbirth+, in Repentance this callback properly populates the following fields:

  • Position
  • SpawnerEntity
  • SpawnerType
  • SpawnerVariant
  • Velocity

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the FamiliarVariant provided.
function postFamiliarInit(familiar: EntityFamiliar): void {}

EVALUATE_CACHE: 8

Defined in: ModCallback.ts:124

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the CacheFlag provided.

Note that you can only use single CacheFlag values as a third argument. (You cannot use a combination of two or more CacheFlag.)

function evaluateCache(player: EntityPlayer, cacheFlag: CacheFlag): void {}

POST_PLAYER_INIT: 9

Defined in: ModCallback.ts:152

This will fire at the beginning of a run, upon continuing a saved run, and when a player enters a Genesis room.

For most cases of general purpose player initialization, you should use the POST_PLAYER_INIT_FIRST custom callback instead (in order to exclude the case of a player continuing a saved run).

This callback has a special property where most EntityPlayer methods (such as e.g. EntityPlayer.AddCollectible) will silently fail if the player is continuing a saved run. (This behavior was introduced in Repentance.) See the docs for more details about which specific methods are affected.

The isChildPlayer helper function does not work in this callback (because EntityPlayer.Parent is not initialized yet at this point). If you want to exclude non-real players, use the POST_PLAYER_INIT_FIRST or the POST_PLAYER_INIT_LATE custom callbacks instead.

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the PlayerVariant provided.
function postPlayerInit(player: EntityPlayer): void {}

POST_USE_PILL: 10

Defined in: ModCallback.ts:167

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the PillEffect provided.
function postUsePill(
pillEffect: PillEffect,
player: EntityPlayer,
useFlags: BitFlags<UseFlag>,
): void {}

ENTITY_TAKE_DMG: 11

Defined in: ModCallback.ts:184

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the EntityType provided.
function entityTakeDmg(
entity: Entity,
amount: float,
damageFlags: BitFlags<DamageFlag>,
source: EntityRef,
countdownFrames: int,
): boolean | undefined {}

POST_CURSE_EVAL: 12

Defined in: ModCallback.ts:193

You cannot filter this callback.

function postCurseEval(curses: BitFlags<LevelCurse>): BitFlags<LevelCurse> | undefined {}

INPUT_ACTION: 13

Defined in: ModCallback.ts:208

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the InputHook provided.
function inputAction(
entity: Entity | undefined,
inputHook: InputHook,
buttonAction: ButtonAction,
): boolean | float | undefined {}

POST_GAME_STARTED: 15

Defined in: ModCallback.ts:221

You cannot filter this callback.

function postGameStarted(isContinued: boolean): void {}

POST_GAME_END: 16

Defined in: ModCallback.ts:230

You cannot filter this callback.

function postGameEnd(isGameOver: boolean): void {}

PRE_GAME_EXIT: 17

Defined in: ModCallback.ts:239

You cannot filter this callback.

function preGameExit(shouldSave: boolean): void {}

POST_NEW_LEVEL: 18

Defined in: ModCallback.ts:254

Unlike the POST_GAME_STARTED callback, this callback does not fire when resuming a saved run.

You cannot filter this callback.

function postNewLevel(): void {}

POST_NEW_ROOM: 19

Defined in: ModCallback.ts:267

You cannot filter this callback.

function postNewRoom(): void {}

GET_CARD: 20

Defined in: ModCallback.ts:282

You cannot filter this callback.

function getCard(
rng: RNG,
cardType: CardType,
includePlayingCards: boolean,
includeRunes: boolean,
onlyRunes: boolean,
): CardType | undefined {}

GET_SHADER_PARAMS: 21

Defined in: ModCallback.ts:291

You cannot filter this callback.

function getShaderParams(shaderName: string): Record<string, unknown> {}

EXECUTE_CMD: 22

Defined in: ModCallback.ts:304

You cannot filter this callback.

function executeCmd(
command: string,
parameters: string,
player: EntityPlayer,
): void {}

PRE_USE_ITEM: 23

Defined in: ModCallback.ts:322

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the CollectibleType provided.
function preUseItem(
collectibleType: CollectibleType,
rng: RNG,
player: EntityPlayer,
useFlags: BitFlags<UseFlag>,
activeSlot: ActiveSlot,
customVarData: int,
): boolean | undefined {}

PRE_ENTITY_SPAWN: 24

Defined in: ModCallback.ts:345

If you want to prevent an entity from spawning, you cannot return an EntityType of 0, since that will cause the game to crash.

Sometimes, if you return a type other than the original type (e.g. replacing a pickup with an effect), the game will crash. Thus, you should replace a pickup with a new pickup, and so on.

You cannot filter this callback.

function preEntitySpawn(
entityType: EntityType,
variant: int,
subType: int,
position: Vector,
velocity: Vector,
spawner: Entity | undefined,
initSeed: Seed,
): [entityType: EntityType, variant: int, subType: int, initSeed: Seed] | undefined {}

POST_FAMILIAR_RENDER: 25

Defined in: ModCallback.ts:359

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the FamiliarVariant provided.
function postFamiliarRender(
entityFamiliar: EntityFamiliar,
renderOffset: Vector,
): void {}

PRE_FAMILIAR_COLLISION: 26

Defined in: ModCallback.ts:374

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the FamiliarVariant provided.
function preFamiliarCollision(
familiar: EntityFamiliar,
collider: Entity,
low: boolean,
): boolean | undefined {}

POST_NPC_INIT: 27

Defined in: ModCallback.ts:393

Unlike in Afterbirth+, in Repentance this callback properly populates the following fields:

  • Position
  • SpawnerEntity
  • SpawnerType
  • SpawnerVariant
  • Velocity

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the EntityType provided.
function postNPCInit(npc: EntityNPC): void {}

POST_NPC_RENDER: 28

Defined in: ModCallback.ts:404

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the EntityType provided.
function postNPCRender(npc: EntityNPC, renderOffset: Vector): void {}

POST_NPC_DEATH: 29

Defined in: ModCallback.ts:415

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the EntityType provided.
function postNPCDeath(npc: EntityNPC): void {}

PRE_NPC_COLLISION: 30

Defined in: ModCallback.ts:430

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the EntityType provided.
function preNPCCollision(
npc: EntityNPC,
collider: Entity,
low: boolean,
): boolean | undefined {}

POST_PLAYER_UPDATE: 31

Defined in: ModCallback.ts:445

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the PlayerVariant provided.
function postPlayerUpdate(player: EntityPlayer): void {}

POST_PLAYER_RENDER: 32

Defined in: ModCallback.ts:460

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the PlayerVariant provided.
function postPlayerRender(player: EntityPlayer, renderOffset: Vector): void {}

PRE_PLAYER_COLLISION: 33

Defined in: ModCallback.ts:475

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the PlayerVariant provided.
function prePlayerCollision(
player: EntityPlayer,
collider: Entity,
low: boolean,
): boolean | undefined {}

POST_PICKUP_INIT: 34

Defined in: ModCallback.ts:494

Unlike in Afterbirth+, in Repentance this callback properly populates the following fields:

  • Position
  • SpawnerEntity
  • SpawnerType
  • SpawnerVariant
  • Velocity

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the PickupVariant provided.
function postPickupInit(pickup: EntityPickup): void {}

POST_PICKUP_UPDATE: 35

Defined in: ModCallback.ts:505

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the PickupVariant provided.
function postPickupUpdate(pickup: EntityPickup): void {}

POST_PICKUP_RENDER: 36

Defined in: ModCallback.ts:516

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the PickupVariant provided.
function postPickupRender(pickup: EntityPickup, renderOffset: Vector): void {}

POST_PICKUP_SELECTION: 37

Defined in: ModCallback.ts:529

You cannot filter this callback.

function postPickupSelection(
pickup: EntityPickup,
variant: PickupVariant,
subType: int,
): [pickupVariant: PickupVariant, subType: int] | undefined {}

PRE_PICKUP_COLLISION: 38

Defined in: ModCallback.ts:544

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the PickupVariant provided.
function prePickupCollision(
pickup: EntityPickup,
collider: Entity,
low: boolean,
): boolean | undefined {}

POST_TEAR_INIT: 39

Defined in: ModCallback.ts:563

Unlike in Afterbirth+, in Repentance this callback properly populates the following fields:

  • Position
  • SpawnerEntity
  • SpawnerType
  • SpawnerVariant
  • Velocity

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the TearVariant provided.
function postTearInit(tear: EntityTear): void {}

POST_TEAR_UPDATE: 40

Defined in: ModCallback.ts:574

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the TearVariant provided.
function postTearUpdate(tear: EntityTear): void {}

POST_TEAR_RENDER: 41

Defined in: ModCallback.ts:585

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the TearVariant provided.
function postTearRender(tear: EntityTear, renderOffset: Vector): void {}

PRE_TEAR_COLLISION: 42

Defined in: ModCallback.ts:600

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the TearVariant provided.
function preTearCollision(
tear: EntityTear,
collider: Entity,
low: boolean,
): boolean | undefined {}

POST_PROJECTILE_INIT: 43

Defined in: ModCallback.ts:619

Unlike in Afterbirth+, in Repentance this callback properly populates the following fields:

  • Position
  • SpawnerEntity
  • SpawnerType
  • SpawnerVariant
  • Velocity

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the ProjectileVariant provided.
function postProjectileInit(projectile: EntityProjectile): void {}

POST_PROJECTILE_UPDATE: 44

Defined in: ModCallback.ts:630

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the ProjectileVariant provided.
function postProjectileUpdate(projectile: EntityProjectile): void {}

POST_PROJECTILE_RENDER: 45

Defined in: ModCallback.ts:644

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the ProjectileVariant provided.
function postProjectileRender(
projectile: EntityProjectile,
renderOffset: Vector,
): void {}

PRE_PROJECTILE_COLLISION: 46

Defined in: ModCallback.ts:659

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the ProjectileVariant provided.
function preProjectileCollision(
projectile: EntityProjectile,
collider: Entity,
low: boolean,
): boolean | undefined {}

POST_LASER_INIT: 47

Defined in: ModCallback.ts:678

Unlike in Afterbirth+, in Repentance this callback properly populates the following fields:

  • Position
  • SpawnerEntity
  • SpawnerType
  • SpawnerVariant
  • Velocity

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the LaserVariant provided.
function postLaserInit(laser: EntityLaser): void {}

POST_LASER_UPDATE: 48

Defined in: ModCallback.ts:689

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the LaserVariant provided.
function postLaserUpdate(laser: EntityLaser): void {}

POST_LASER_RENDER: 49

Defined in: ModCallback.ts:700

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the LaserVariant provided.
function postLaserRender(laser: EntityLaser, renderOffset: Vector): void {}

POST_KNIFE_INIT: 50

Defined in: ModCallback.ts:720

Unlike in Afterbirth+, in Repentance this callback properly populates the following fields:

  • Position
  • SpawnerEntity
  • SpawnerType
  • SpawnerVariant
  • Velocity

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the sub-type provided. (This is bugged and is NOT the KnifeVariant like you would expect!)
function postKnifeInit(knife: EntityKnife): void {}

POST_KNIFE_UPDATE: 51

Defined in: ModCallback.ts:732

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the sub-type provided. (This is bugged and is NOT the KnifeVariant like you would expect!)
function postKnifeUpdate(knife: EntityKnife): void {}

POST_KNIFE_RENDER: 52

Defined in: ModCallback.ts:744

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the sub-type provided. (This is bugged and is NOT the KnifeVariant like you would expect!)
function postKnifeRender(knife: EntityKnife, renderOffset: Vector): void {}

PRE_KNIFE_COLLISION: 53

Defined in: ModCallback.ts:760

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the sub-type provided. (This is bugged and is NOT the KnifeVariant like you would expect!)
function preKnifeCollision(
knife: EntityKnife,
collider: Entity,
low: boolean,
): boolean | undefined {}

POST_EFFECT_INIT: 54

Defined in: ModCallback.ts:779

Unlike in Afterbirth+, in Repentance this callback properly populates the following fields:

  • Position
  • SpawnerEntity
  • SpawnerType
  • SpawnerVariant
  • Velocity

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the EffectVariant provided.
function postEffectInit(effect: EntityEffect): void {}

POST_EFFECT_UPDATE: 55

Defined in: ModCallback.ts:790

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the EffectVariant provided.
function postEffectUpdate(effect: EntityEffect): void {}

POST_EFFECT_RENDER: 56

Defined in: ModCallback.ts:801

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the EffectVariant provided.
function postEffectRender(effect: EntityEffect, renderOffset: Vector): void {}

POST_BOMB_INIT: 57

Defined in: ModCallback.ts:820

Unlike in Afterbirth+, in Repentance this callback properly populates the following fields:

  • Position
  • SpawnerEntity
  • SpawnerType
  • SpawnerVariant
  • Velocity

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the BombVariant provided.
function postBombInit(bomb: EntityBomb): void {}

POST_BOMB_UPDATE: 58

Defined in: ModCallback.ts:831

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the BombVariant provided.
function postBombUpdate(bomb: EntityBomb): void {}

POST_BOMB_RENDER: 59

Defined in: ModCallback.ts:842

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the BombVariant provided.
function postBombRender(bomb: EntityBomb, renderOffset: Vector): void {}

PRE_BOMB_COLLISION: 60

Defined in: ModCallback.ts:857

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the BombVariant provided.
function preBombCollision(
bomb: EntityBomb,
collider: Entity,
low: boolean,
): boolean | undefined {}

POST_FIRE_TEAR: 61

Defined in: ModCallback.ts:866

You cannot filter this callback.

function postFireTear(tear: EntityTear): void {}

PRE_GET_COLLECTIBLE: 62

Defined in: ModCallback.ts:879

You cannot filter this callback.

function preGetCollectible(
itemPoolType: ItemPoolType,
decrease: boolean,
seed: Seed,
): CollectibleType | undefined {}

POST_GET_COLLECTIBLE: 63

Defined in: ModCallback.ts:893

You cannot filter this callback.

function postGetCollectible(
collectibleType: CollectibleType,
itemPoolType: ItemPoolType,
decrease: boolean,
seed: Seed,
): CollectibleType | undefined {}

GET_PILL_COLOR: 64

Defined in: ModCallback.ts:902

You cannot filter this callback.

function getPillColor(seed: Seed): PillColor | undefined {}

GET_PILL_EFFECT: 65

Defined in: ModCallback.ts:914

You cannot filter this callback.

function getPillEffect(
pillEffect: PillEffect,
pillColor: PillColor,
): PillEffect | undefined {}

GET_TRINKET: 66

Defined in: ModCallback.ts:926

You cannot filter this callback.

function getTrinket(
trinketType: TrinketType,
rng: RNG,
): TrinketType | undefined {}

POST_ENTITY_REMOVE: 67

Defined in: ModCallback.ts:937

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the EntityType provided.
function postEntityRemove(entity: Entity): void {}

POST_ENTITY_KILL: 68

Defined in: ModCallback.ts:948

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the EntityType provided.
function postEntityKill(entity: Entity): void {}

PRE_NPC_UPDATE: 69

Defined in: ModCallback.ts:959

When registering this callback with the Mod.AddCallback method:

  • You can provide an optional third argument that will make the callback only fire if it matches the EntityType provided.
function preNPCUpdate(entity: Entity): boolean | undefined {}

PRE_SPAWN_CLEAR_AWARD: 70

Defined in: ModCallback.ts:973

In vanilla, this is PRE_SPAWN_CLEAN_AWARD, which is a typo.

You cannot filter this callback.

function preSpawnClearAward(
rng: RNG,
spawnPosition: Vector,
): boolean | undefined {}

PRE_ROOM_ENTITY_SPAWN: 71

Defined in: ModCallback.ts:991

You can use the isGridEntityXMLType helper function to convert the entityTypeOrGridEntityXMLType argument to an EntityType or GridEntityXMLType, if needed.

You cannot filter this callback.

function preRoomEntitySpawn(
entityTypeOrGridEntityXMLType: EntityType | GridEntityXMLType,
variant: int,
subType: int,
gridIndex: int,
initSeed: Seed,
): [type: EntityType | GridEntityXMLType, variant: int, subType: int] | undefined {}

PRE_ENTITY_DEVOLVE: 72

Defined in: ModCallback.ts:1000

You cannot filter this callback.

function preEntityDevolve(entity: Entity): boolean | undefined {}

PRE_MOD_UNLOAD: 73

Defined in: ModCallback.ts:1009

You cannot filter this callback.

function preModUnload(mod: Mod): void {}