2 using System.Collections.Generic;
15 public static readonly
int vanillaHeadCount = Main.npcHeadTexture.Length;
19 public static readonly
int vanillaBossHeadCount = Main.npcHeadBossTexture.Length;
20 private static int nextHead = vanillaHeadCount;
21 private static int nextBossHead = vanillaBossHeadCount;
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() {
29 int reserve = nextHead;
34 internal static int ReserveBossHeadSlot(
string texture) {
35 if (bossHeads.TryGetValue(texture, out
int existing)) {
38 int reserve = nextBossHead;
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);
59 Array.Resize(ref Main.npcHeadBossTexture, nextBossHead);
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() {
72 nextHead = vanillaHeadCount;
73 nextBossHead = vanillaBossHeadCount;
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;
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...
Manages content added by mods. Liasons between mod content and Terraria's arrays and oversees the Loa...