Terraria ModLoader  0.11.4
A framework for Terraria mods
Terraria.ModLoader.Config.EntityDefinition Class Reference

Classes implementing EntityDefinition serve to function as a way to save and load the identities of various Terraria objects. Only the identity is preserved, no other data such as stack size, damage, etc. These classes are well suited for ModConfig, but can be saved and loaded in a TagCompound as well. More...

+ Inheritance diagram for Terraria.ModLoader.Config.EntityDefinition:
+ Collaboration diagram for Terraria.ModLoader.Config.EntityDefinition:

Public Member Functions

 EntityDefinition ()
 
 EntityDefinition (string mod, string name)
 
 EntityDefinition (string key)
 
override bool Equals (object obj)
 
override int GetHashCode ()
 
TagCompound SerializeData ()
 
override string ToString ()
 

Public Attributes

bool IsUnloaded => Type == 0 && !(mod == "Terraria" && name == "None" || mod == "" && name == "")
 
string mod
 
string name
 

Properties

abstract int Type [get]
 

Detailed Description

Classes implementing EntityDefinition serve to function as a way to save and load the identities of various Terraria objects. Only the identity is preserved, no other data such as stack size, damage, etc. These classes are well suited for ModConfig, but can be saved and loaded in a TagCompound as well.

Definition at line 14 of file EntityDefinition.cs.

Constructor & Destructor Documentation

Terraria.ModLoader.Config.EntityDefinition.EntityDefinition ( )

Definition at line 21 of file EntityDefinition.cs.

21  {
22  mod = "Terraria";
23  name = "None";
24  }
Terraria.ModLoader.Config.EntityDefinition.EntityDefinition ( string  mod,
string  name 
)

Definition at line 26 of file EntityDefinition.cs.

Terraria.ModLoader.Config.EntityDefinition.EntityDefinition ( string  key)

Definition at line 31 of file EntityDefinition.cs.

31  {
32  this.mod = "";
33  this.name = "";
34  string[] parts = key.Split(new char[] { ' ' }, 2);
35  if (parts.Length == 2) {
36  mod = parts[0];
37  name = parts[1];
38  }
39  }

Member Function Documentation

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

Definition at line 41 of file EntityDefinition.cs.

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

41  {
43  if (p == null) {
44  return false;
45  }
46  return (mod == p.mod) && (name == p.name);
47  }
override int Terraria.ModLoader.Config.EntityDefinition.GetHashCode ( )

Definition at line 51 of file EntityDefinition.cs.

51  {
52  return new { mod, name }.GetHashCode();
53  }
TagCompound Terraria.ModLoader.Config.EntityDefinition.SerializeData ( )

Implements Terraria.ModLoader.IO.TagSerializable.

Definition at line 60 of file EntityDefinition.cs.

override string Terraria.ModLoader.Config.EntityDefinition.ToString ( )

Member Data Documentation

bool Terraria.ModLoader.Config.EntityDefinition.IsUnloaded => Type == 0 && !(mod == "Terraria" && name == "None" || mod == "" && name == "")

Definition at line 55 of file EntityDefinition.cs.

string Terraria.ModLoader.Config.EntityDefinition.mod
string Terraria.ModLoader.Config.EntityDefinition.name

Property Documentation

abstract int Terraria.ModLoader.Config.EntityDefinition.Type
get

Definition at line 58 of file EntityDefinition.cs.