Skip to content

Modded Element Detection

Defined in: packages/isaacscript-common/src/classes/features/other/ModdedElementDetection.ts:45

Mods can add extra things to the game (e.g. collectibles, trinkets, and so on). Since mods load in alphabetical order, the total number of things can’t be properly be known until at least one callback fires (which indicates that all mods have been loaded).

This feature gates all such functions behind a callback check. Subsequently, these functions will throw a runtime error if they are called in the menu, before any callbacks have occurred. This ensures that the proper values are always returned and allows you to get immediate feedback if you accidentally access them from the menu.

  • Feature

getFirstModdedCollectibleType(): CollectibleType | undefined

Defined in: packages/isaacscript-common/src/classes/features/other/ModdedElementDetection.ts:88

Returns the first modded collectible type, or undefined if there are no modded collectibles.

This function can only be called if at least one callback has been executed. This is because not all collectibles will necessarily be present when a mod first loads (due to mod load order).

In order to use this function, you must upgrade your mod with ISCFeature.MODDED_ELEMENT_DETECTION.

CollectibleType | undefined

getLastCollectibleType(): CollectibleType

Defined in: packages/isaacscript-common/src/classes/features/other/ModdedElementDetection.ts:119

Will change depending on how many modded collectibles there are.

Equal to itemConfig.GetCollectibles().Size - 1. (Size includes invalid collectibles, like 666. We subtract one to account for CollectibleType.NULL.)

If there are no mods present that add any custom collectibles, this function will return CollectibleType.MOMS_RING (732).

This function can only be called if at least one callback has been executed. This is because not all collectibles will necessarily be present when a mod first loads (due to mod load order).

In order to use this function, you must upgrade your mod with ISCFeature.MODDED_ELEMENT_DETECTION.

CollectibleType

getNumCollectibleTypes(): int

Defined in: packages/isaacscript-common/src/classes/features/other/ModdedElementDetection.ts:139

Returns the total number of collectibles in the item config, including both vanilla and modded collectibles. If you just need the number of vanilla collectible types, use the NUM_VANILLA_COLLECTIBLE_TYPES constant.

This function can only be called if at least one callback has been executed. This is because not all collectibles will necessarily be present when a mod first loads (due to mod load order).

In order to use this function, you must upgrade your mod with ISCFeature.MODDED_ELEMENT_DETECTION.

int

getNumModdedCollectibleTypes(): int

Defined in: packages/isaacscript-common/src/classes/features/other/ModdedElementDetection.ts:157

Unlike vanilla collectible types, modded collectible types are always contiguous.

This function can only be called if at least one callback has been executed. This is because not all collectibles will necessarily be present when a mod first loads (due to mod load order).

In order to use this function, you must upgrade your mod with ISCFeature.MODDED_ELEMENT_DETECTION.

int

getFirstModdedTrinketType(): TrinketType | undefined

Defined in: packages/isaacscript-common/src/classes/features/other/ModdedElementDetection.ts:178

Returns the first modded trinket type, or undefined if there are no modded trinkets.

This function can only be called if at least one callback has been executed. This is because not all trinkets will necessarily be present when a mod first loads (due to mod load order).

In order to use this function, you must upgrade your mod with ISCFeature.MODDED_ELEMENT_DETECTION.

TrinketType | undefined

getLastTrinketType(): TrinketType

Defined in: packages/isaacscript-common/src/classes/features/other/ModdedElementDetection.ts:203

Will change depending on how many modded trinkets there are.

Equal to itemConfig.GetTrinkets().Size - 1. (Size includes invalid trinkets, like 47. We subtract one to account for TrinketType.NULL.)

If there are no mods present that add any custom trinkets, this function will return TrinketType.SIGIL_OF_BAPHOMET (189).

This function can only be called if at least one callback has been executed. This is because not all trinkets will necessarily be present when a mod first loads (due to mod load order).

In order to use this function, you must upgrade your mod with ISCFeature.MODDED_ELEMENT_DETECTION.

TrinketType

getNumTrinketTypes(): int

Defined in: packages/isaacscript-common/src/classes/features/other/ModdedElementDetection.ts:222

Returns the total number of trinkets in the item config, including both vanilla and modded trinkets. If you just need the number of vanilla trinket types, use the NUM_VANILLA_TRINKET_TYPES constant.

This function can only be called if at least one callback has been executed. This is because not all trinkets will necessarily be present when a mod first loads (due to mod load order).

In order to use this function, you must upgrade your mod with ISCFeature.MODDED_ELEMENT_DETECTION.

int

getNumModdedTrinketTypes(): int

Defined in: packages/isaacscript-common/src/classes/features/other/ModdedElementDetection.ts:239

Unlike vanilla trinket types, modded trinket types are always contiguous.

This function can only be called if at least one callback has been executed. This is because not all trinkets will necessarily be present when a mod first loads (due to mod load order).

In order to use this function, you must upgrade your mod with ISCFeature.MODDED_ELEMENT_DETECTION.

int

getFirstModdedCardType(): CardType | undefined

Defined in: packages/isaacscript-common/src/classes/features/other/ModdedElementDetection.ts:260

Returns the first modded card sub-type, or undefined if there are no modded cards.

This function can only be called if at least one callback has been executed. This is because not all cards will necessarily be present when a mod first loads (due to mod load order).

In order to use this function, you must upgrade your mod with ISCFeature.MODDED_ELEMENT_DETECTION.

CardType | undefined

getLastCardType(): CardType

Defined in: packages/isaacscript-common/src/classes/features/other/ModdedElementDetection.ts:285

Will change depending on how many modded cards there are.

Equal to itemConfig.GetCards().Size - 1. (Size includes invalid cards, but since cards are contiguous, there are no invalid cards. We subtract one to account for CardType.NULL.)

If there are no mods present that add any custom cards, this function will return CardType.SOUL_OF_JACOB_AND_ESAU (97).

This function can only be called if at least one callback has been executed. This is because not all trinkets will necessarily be present when a mod first loads (due to mod load order).

In order to use this function, you must upgrade your mod with ISCFeature.MODDED_ELEMENT_DETECTION.

CardType

getNumCardTypes(): int

Defined in: packages/isaacscript-common/src/classes/features/other/ModdedElementDetection.ts:303

Returns the total number of cards in the item config, including both vanilla and modded cards. If you just need the number of vanilla card types, use the NUM_VANILLA_CARD_TYPES constant.

This function can only be called if at least one callback has been executed. This is because not all cards will necessarily be present when a mod first loads (due to mod load order).

In order to use this function, you must upgrade your mod with ISCFeature.MODDED_ELEMENT_DETECTION.

int

getNumModdedCardTypes(): int

Defined in: packages/isaacscript-common/src/classes/features/other/ModdedElementDetection.ts:320

Like vanilla card types, modded card types are always contiguous.

This function can only be called if at least one callback has been executed. This is because not all cards will necessarily be present when a mod first loads (due to mod load order).

In order to use this function, you must upgrade your mod with ISCFeature.MODDED_ELEMENT_DETECTION.

int

getFirstModdedPillEffect(): PillEffect | undefined

Defined in: packages/isaacscript-common/src/classes/features/other/ModdedElementDetection.ts:342

Returns the first modded pill effect, or undefined if there are no modded pill effects.

This function can only be called if at least one callback has been executed. This is because not all pill effects will necessarily be present when a mod first loads (due to mod load order).

In order to use this function, you must upgrade your mod with ISCFeature.MODDED_ELEMENT_DETECTION.

PillEffect | undefined

getLastPillEffect(): PillEffect

Defined in: packages/isaacscript-common/src/classes/features/other/ModdedElementDetection.ts:374

Will change depending on how many modded pill effects there are.

Equal to itemConfig.GetPillEffects().Size - 1. (Size includes invalid pill effects, but since pill effects are contiguous, there are no invalid pill effects. We subtract one to account for the enum starting at 0 instead of 1.)

If there are no mods present that add any custom pill effects, this function will return PillEffect.EXPERIMENTAL (49).

This function can only be called if at least one callback has been executed. This is because not all pill effects will necessarily be present when a mod first loads (due to mod load order).

In order to use this function, you must upgrade your mod with ISCFeature.MODDED_ELEMENT_DETECTION.

PillEffect

getNumPillEffects(): int

Defined in: packages/isaacscript-common/src/classes/features/other/ModdedElementDetection.ts:393

Returns the total number of pill effects in the item config, including both vanilla and modded pill effects. If you just need the number of vanilla pill effects, use the NUM_VANILLA_PILL_EFFECTS constant.

This function can only be called if at least one callback has been executed. This is because not all cards will necessarily be present when a mod first loads (due to mod load order).

In order to use this function, you must upgrade your mod with ISCFeature.MODDED_ELEMENT_DETECTION.

int

getNumModdedPillEffects(): int

Defined in: packages/isaacscript-common/src/classes/features/other/ModdedElementDetection.ts:410

Like vanilla pill effects, modded pill effects are always contiguous.

This function can only be called if at least one callback has been executed. This is because not all cards will necessarily be present when a mod first loads (due to mod load order).

In order to use this function, you must upgrade your mod with ISCFeature.MODDED_ELEMENT_DETECTION.

int