Terraria.ModLoader.NPCLoader.GetNPC C# (CSharp) Method

GetNPC() public static method

public static GetNPC ( int type ) : ModNPC
type int
return ModNPC
        public static ModNPC GetNPC(int type)
        {
            return type >= NPCID.Count && type < NPCCount ? npcs[type - NPCID.Count] : null;
        }

Usage Example

Example #1
0
 /// <summary>
 /// Gets the ModNPC instance corresponding to the specified type.
 /// </summary>
 /// <param name="type">The type of the npc</param>
 /// <returns>The ModNPC instance in the npcs array, null if not found.</returns>
 public static ModNPC GetModNPC(int type) => NPCLoader.GetNPC(type);