Terraria ModLoader  0.11.1
A framework for Terraria mods
Terraria.ModLoader.Config.ItemDefinition Class Reference
+ Collaboration diagram for Terraria.ModLoader.Config.ItemDefinition:

Public Member Functions

 ItemDefinition ()
 
 ItemDefinition (string mod, string name)
 
override bool Equals (object obj)
 
override int GetHashCode ()
 
int GetID ()
 

Public Attributes

bool IsUnloaded => GetID() == 0 && !(name == "" && mod == "")
 
string mod
 
string name
 

Detailed Description

Definition at line 11 of file ItemDefinition.cs.

Constructor & Destructor Documentation

◆ ItemDefinition() [1/2]

Terraria.ModLoader.Config.ItemDefinition.ItemDefinition ( )

Definition at line 16 of file ItemDefinition.cs.

◆ ItemDefinition() [2/2]

Terraria.ModLoader.Config.ItemDefinition.ItemDefinition ( string  mod,
string  name 
)

Definition at line 22 of file ItemDefinition.cs.

Member Function Documentation

◆ Equals()

override bool Terraria.ModLoader.Config.ItemDefinition.Equals ( object  obj)

Definition at line 30 of file ItemDefinition.cs.

References Terraria.ModLoader.Config.ItemDefinition.mod, and Terraria.ModLoader.Config.ItemDefinition.name.

31  {
32  ItemDefinition p = obj as ItemDefinition;
33  if (p == null)
34  {
35  return false;
36  }
37  return (mod == p.mod) && (name == p.name);
38  }

◆ GetHashCode()

override int Terraria.ModLoader.Config.ItemDefinition.GetHashCode ( )

Definition at line 40 of file ItemDefinition.cs.

41  {
42  return new { mod, name }.GetHashCode();
43  }

◆ GetID()

int Terraria.ModLoader.Config.ItemDefinition.GetID ( )

Definition at line 45 of file ItemDefinition.cs.

References Terraria.ModLoader.Mod.GetItem(), Terraria.ModLoader.ModLoader.GetMod(), and Terraria.ModLoader.ModItem.item.

46  {
47  if (mod == "Terraria")
48  {
49  if (!ItemID.Search.ContainsName(name))
50  return 0;
51  return ItemID.Search.GetId(name);
52  }
53  return ModLoader.GetMod(this.mod)?.GetItem(this.name)?.item.type ?? 0;
54  }
+ Here is the call graph for this function:

Member Data Documentation

◆ IsUnloaded

bool Terraria.ModLoader.Config.ItemDefinition.IsUnloaded => GetID() == 0 && !(name == "" && mod == "")

Definition at line 28 of file ItemDefinition.cs.

◆ mod

string Terraria.ModLoader.Config.ItemDefinition.mod

Definition at line 13 of file ItemDefinition.cs.

Referenced by Terraria.ModLoader.Config.ItemDefinition.Equals().

◆ name

string Terraria.ModLoader.Config.ItemDefinition.name

Definition at line 14 of file ItemDefinition.cs.

Referenced by Terraria.ModLoader.Config.ItemDefinition.Equals().