Skip to main content

Modded Element Detection

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.

Hierarchy

  • Feature

    ModdedElementDetection

Methods

getFirstModdedCollectibleType

getFirstModdedCollectibleType(): undefined | CollectibleType

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.

Returns

undefined | CollectibleType

Defined in

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


getLastCollectibleType

getLastCollectibleType(): CollectibleType

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.

Returns

CollectibleType

Defined in

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


getNumCollectibleTypes

getNumCollectibleTypes(): int

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.

Returns

int

Defined in

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


getNumModdedCollectibleTypes

getNumModdedCollectibleTypes(): int

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.

Returns

int

Defined in

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


getFirstModdedTrinketType

getFirstModdedTrinketType(): undefined | TrinketType

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.

Returns

undefined | TrinketType

Defined in

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


getLastTrinketType

getLastTrinketType(): TrinketType

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.

Returns

TrinketType

Defined in

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


getNumTrinketTypes

getNumTrinketTypes(): int

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.

Returns

int

Defined in

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


getNumModdedTrinketTypes

getNumModdedTrinketTypes(): int

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.

Returns

int

Defined in

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


getFirstModdedCardType

getFirstModdedCardType(): undefined | CardType

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.

Returns

undefined | CardType

Defined in

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


getLastCardType

getLastCardType(): CardType

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.

Returns

CardType

Defined in

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


getNumCardTypes

getNumCardTypes(): int

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.

Returns

int

Defined in

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


getNumModdedCardTypes

getNumModdedCardTypes(): int

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.

Returns

int

Defined in

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


getFirstModdedPillEffect

getFirstModdedPillEffect(): undefined | PillEffect

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.

Returns

undefined | PillEffect

Defined in

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


getLastPillEffect

getLastPillEffect(): PillEffect

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.

Returns

PillEffect

Defined in

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


getNumPillEffects

getNumPillEffects(): int

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.

Returns

int

Defined in

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


getNumModdedPillEffects

getNumModdedPillEffects(): int

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.

Returns

int

Defined in

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