tModLoader v2024.11
A mod to make and play Terraria mods
|
Inherited by Item, NPC, Player, and Projectile.
Public Member Functions | |
float | AngleFrom (Vector2 Source) |
float | AngleTo (Vector2 Destination) |
Vector2 | DirectionFrom (Vector2 Source) |
Vector2 | DirectionTo (Vector2 Destination) |
float | Distance (Vector2 Other) |
float | DistanceSQ (Vector2 Other) |
IEntitySource | GetSource_CatchEntity (Entity caughtEntity, string? context=null) |
IEntitySource | GetSource_Death (string? context=null) |
IEntitySource | GetSource_DropAsItem (string? context=null) |
IEntitySource | GetSource_FromAI (string? context=null) |
IEntitySource | GetSource_FromThis (string? context=null) |
IEntitySource | GetSource_GiftOrReward (string? context=null) |
IEntitySource | GetSource_Loot (string? context=null) |
IEntitySource | GetSource_Misc (string context) |
IEntitySource | GetSource_OnHit (Entity victim, string? context=null) |
IEntitySource | GetSource_OnHurt (Entity? attacker, string? context=null) |
IEntitySource | GetSource_ReleaseEntity (string? context=null) |
IEntitySource | GetSource_TileInteraction (int tileCoordsX, int tileCoordsY, string? context=null) |
bool | WithinRange (Vector2 Target, float MaxRange) |
Static Public Member Functions | |
static IEntitySource | GetSource_NaturalSpawn () |
static ? IEntitySource | GetSource_None () |
static IEntitySource | GetSource_TownSpawn () |
static ? IEntitySource | InheritSource (Entity entity) |
Public Attributes | |
bool | active |
If true, the Entity actually exists within the game world. Within the specific entity array, if active is false, the entity is junk data. Always check active if iterating over the entity array. Another option for iterating is to use Main.ActivePlayers, Main.ActiveNPCs, Main.ActiveProjectiles, or Main.ActiveItems instead for simpler code. | |
int | direction = 1 |
The direction this entity is facing. A value of 1 means the entity is facing to the right. -1 means facing to the left. | |
int | height |
The height of this Entity's hitbox, in pixels. | |
bool | honeyWet |
bool | lavaWet |
int | oldDirection |
The direction of this Entity during the previous tick. For projectiles with Projectile.extraUpdates, this will be the direction during the previous extra update, not necessarily the direction during the previous tick. | |
Vector2 | oldPosition |
The position of this Entity during the previous tick. For projectiles with Projectile.extraUpdates, this will be the position during the previous extra update, not necessarily the position during the previous tick. | |
Vector2 | oldVelocity |
The velocity of this Entity during the previous tick. For projectiles with Projectile.extraUpdates, this will be the velocity during the previous extra update, not necessarily the velocity during the previous tick. | |
Vector2 | position |
The position of this Entity in world coordinates. Note that this corresponds to the top left corner of the entity. Use Center instead for logic that needs the position at the center of the entity. | |
bool | shimmerWet |
Vector2 | velocity |
The velocity of this Entity in world coordinates per tick. | |
bool | wet |
The Entity is currently in water. Projectile: Affects movement speed and some projectiles die when wet. Projectile.ignoreWater prevents this. | |
byte | wetCount |
int | whoAmI |
The index of this Entity within its specific array. These arrays track the entities in the world. Item: unused Projectile: Main.projectile NPC: Main.npc Player: Main.player Note that Projectile.whoAmI is not consistent between clients in multiplayer for the same projectile. | |
int | width |
The width of this Entity's hitbox, in pixels. | |
Properties | |
Vector2 | Bottom [get, set] |
Vector2 | BottomLeft [get, set] |
Vector2 | BottomRight [get, set] |
Vector2 | Center [get, set] |
The center position of this entity in world coordinates. Calculated from position, width, and height. | |
Rectangle | Hitbox [get, set] |
Vector2 | Left [get, set] |
Vector2 | Right [get, set] |
Vector2 | Size [get, set] |
Vector2 | Top [get, set] |
Vector2 | TopLeft [get, set] |
Vector2 | TopRight [get, set] |
virtual Vector2 | VisualPosition [get] |