2using System.Collections.Generic;
22 internal static IDictionary<string, int> heads =
new Dictionary<string, int>();
23 internal static IDictionary<string, int> bossHeads =
new Dictionary<string, int>();
24 internal static IDictionary<int, int> npcToHead =
new Dictionary<int, int>();
25 internal static IDictionary<int, int> headToNPC =
new Dictionary<int, int>();
26 internal static IDictionary<int, int> npcToBossHead =
new Dictionary<int, int>();
28 internal static int ReserveHeadSlot() {
34 internal static int ReserveBossHeadSlot(
string texture) {
35 if (bossHeads.TryGetValue(texture, out
int existing)) {
48 public static int GetHeadSlot(
string texture) => heads.TryGetValue(texture, out
int slot) ? slot : -1;
55 public static int GetBossHeadSlot(
string texture) => bossHeads.TryGetValue(texture, out
int slot) ? slot : -1;
57 internal static void ResizeAndFillArrays() {
58 Array.Resize(ref Main.npcHeadTexture,
nextHead);
60 foreach (
string texture
in heads.Keys) {
63 foreach (
string texture
in bossHeads.Keys) {
66 foreach (
int npc
in npcToBossHead.Keys) {
67 NPCID.Sets.BossHeadTextures[npc] = npcToBossHead[npc];
71 internal static void Unload() {
78 npcToBossHead.Clear();
81 internal static int GetNPCHeadSlot(
int type) => npcToHead.TryGetValue(type, out
int slot) ? slot : -1;
84 internal static int GetNPCFromHeadSlot(
int slot) => headToNPC.TryGetValue(slot, out
int type) ? type : -1;
Manages content added by mods. Liasons between mod content and Terraria's arrays and oversees the Loa...
static Texture2D GetTexture(string name)
Gets the texture with the specified name. The name is in the format of "ModFolder/OtherFolders/FileNa...
This class serves as a central place from which NPC head slots are stored and NPC head textures are a...
static readonly int vanillaBossHeadCount
The number of vanilla boss head textures that exist.
static readonly int vanillaHeadCount
The number of vanilla town NPC head textures that exist.
static int GetBossHeadSlot(string texture)
Gets the index of the boss head texture corresponding to the given texture path.
static int GetHeadSlot(string texture)
Gets the index of the head texture corresponding to the given texture path.