TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ GetModPlayer< T >() [2/2]

T Terraria.Player.GetModPlayer< T > ( T baseInstance)
inline

Gets the local instance of the type of the specified ModPlayer instance. This will throw exceptions on failure.

Exceptions
T:System.Collections.Generic.KeyNotFoundException
Exceptions
T:System.IndexOutOfRangeException
Exceptions
T:System.NullReferenceException
Type Constraints
T :ModPlayer 

Definition at line 58183 of file Player.cs.

58183 : ModPlayer
58184 {
58185 return (modPlayers[baseInstance.Index] as T) ?? throw new KeyNotFoundException("Instance of '" + typeof(T).Name + "' does not exist on the current player.");
58186 }
A ModPlayer instance represents an extension of a Player instance. You can store fields in the ModPla...
Definition ModPlayer.cs:16
ModPlayer[] modPlayers
Definition Player.cs:3318

References Terraria.Player.modPlayers.