tModLoader v2024.04
A mod to make and play Terraria mods
ContentSamples Class Reference

This class stores instances of various content types in a number of dictionaries. These instances serve as references that can be queried for information. For example, a modder could check ItemsByType[ItemID.Gel].value to check the value of the Gel item rather than creating a new Item instance and then checking. Care must be taken by modders to not use these instances for anything other than as a reference. Modders should not edit the instances in any way.
ContentSamples should only be accessed in code that runs during Mod.PostSetupContent or later, as the entries are not filled in until then.
More...

Classes

class  BestiaryHelper
 
class  CommonlyUsedContentSamples
 
class  CreativeHelper
 

Static Public Member Functions

static void FixItemsAfterRecipesAreAdded ()
 
static void Initialize ()
 
static void RebuildBestiarySortingIDsByBestiaryDatabaseContents (BestiaryDatabase database)
 
static void RebuildItemCreativeSortingIDsAfterRecipesAreSetUp ()
 

Static Public Attributes

static Dictionary< int, int > CreativeResearchItemPersistentIdOverride = new Dictionary<int, int>()
 Associates an item type (Item.type) with the item type it shares research values with.
 
static Dictionary< int, CreativeHelper.ItemGroupAndOrderInGroupItemCreativeSortingId = new Dictionary<int, CreativeHelper.ItemGroupAndOrderInGroup>()
 Associates an item type (Item.type) with its CreativeHelper.ItemGroup and sorting order in the Research menu.
 
static Dictionary< string, int > ItemNetIdsByPersistentIds = new Dictionary<string, int>()
 The item type (Item.type) for a given persistent ID.
Vanilla persistent IDs are the names in ItemID. Modded persistent IDs are the value of ModType.FullName. More...
 
static Dictionary< int, string > ItemPersistentIdsByNetIds = new Dictionary<int, string>()
 The persistent ID for a given item type (Item.type).
 
static Dictionary< int, ItemItemsByType = new Dictionary<int, Item>()
 The default Item for a given item type (Item.type).
 
static Dictionary< int, string > NpcBestiaryCreditIdsByNpcNetIds = new Dictionary<int, string>()
 Associates an NPC type (NPC.type) with the persistent ID used for the Bestiary.
 
static Dictionary< int, int > NpcBestiaryRarityStars = new Dictionary<int, int>()
 The number of stars a given NPC type (NPC.type) shows in the Bestiary.
Set in ModNPC.SetBestiary(BestiaryDatabase, BestiaryEntry) or GlobalNPC.SetBestiary(NPC, BestiaryDatabase, BestiaryEntry).
 
static Dictionary< int, int > NpcBestiarySortingId = new Dictionary<int, int>()
 The entry number in the Bestiary for a given NPC type (NPC.type).
 
static Dictionary< string, int > NpcNetIdsByPersistentIds = new Dictionary<string, int>()
 The NPC type (NPC.type) for a given persistent ID.
Vanilla persistent IDs are the names in NPCID. Modded persistent IDs are the value of ModType.FullName. More...
 
static Dictionary< int, string > NpcPersistentIdsByNetIds = new Dictionary<int, string>()
 The persistent ID for a given NPC type (NPC.type).
 
static Dictionary< int, NPCNpcsByNetId = new Dictionary<int, NPC>()
 The default NPC for a given NPC type (NPC.type).
Note that these entries do not take into account game mode specific changes so they shouldn't be used for querying that data.

 
static Dictionary< int, ProjectileProjectilesByType = new Dictionary<int, Projectile>()
 The default Projectile for a given projectile type (Projectile.type).
 

Detailed Description

This class stores instances of various content types in a number of dictionaries. These instances serve as references that can be queried for information. For example, a modder could check ItemsByType[ItemID.Gel].value to check the value of the Gel item rather than creating a new Item instance and then checking. Care must be taken by modders to not use these instances for anything other than as a reference. Modders should not edit the instances in any way.
ContentSamples should only be accessed in code that runs during Mod.PostSetupContent or later, as the entries are not filled in until then.

Member Data Documentation

◆ ItemNetIdsByPersistentIds

Dictionary<string, int> ContentSamples.ItemNetIdsByPersistentIds = new Dictionary<string, int>()
static

The item type (Item.type) for a given persistent ID.
Vanilla persistent IDs are the names in ItemID. Modded persistent IDs are the value of ModType.FullName.

You can get the persistent ID of a given item type using either ItemPersistentIdsByNetIds or ItemID.Search.

◆ NpcNetIdsByPersistentIds

Dictionary<string, int> ContentSamples.NpcNetIdsByPersistentIds = new Dictionary<string, int>()
static

The NPC type (NPC.type) for a given persistent ID.
Vanilla persistent IDs are the names in NPCID. Modded persistent IDs are the value of ModType.FullName.

You can get the persistent ID of a given NPC type using either NpcPersistentIdsByNetIds or NPCID.Search.