tModLoader v2024.02
A mod to make and play Terraria mods
Player Class Reference

Inherits Entity, IFixLoadedData, and IEntityWithInstances< ModPlayer >.

Classes

class  BuilderAccToggleIDs
 
struct  CompositeArmData
 
struct  DefenseStat
 
struct  DirectionalInputSyncCache
 
class  Hooks
 
struct  HurtInfo
 
struct  HurtModifiers
 
struct  ItemCheckContext
 
struct  ItemSpaceStatus
 
struct  OverheadMessage
 
struct  RabbitOrderFrameHelper
 
class  RandomTeleportationAttemptSettings
 
class  SavedPlayerDataWithAnnoyingRules
 
class  SelectionRadial
 
struct  SetMatchRequest
 
class  Settings
 
class  SmartCursorSettings
 

Public Types

enum  CompositeArmStretchAmount { Full , None , Quarter , ThreeQuarters }
 

Public Member Functions

void AccumulateGolfingScore (int score)
 
void AddBuff (int type, int timeToAdd, bool quiet=true, bool foodHack=false)
 Gives the player the provided buff. This accounts for if the player is immune to the buff. This also accounts for adjusting the buff time for different game modes. If the player already has the buff, the re-apply logic will happen. Vanilla buff types are found in BuffID and modded buffs are typically retrieved using ModContent.BuffType<T>. The quiet parameter will determine if the network sync message should happen. This should only be set to false in non-deterministic situations (such as random chance) and code that only runs locally. Other situations run on all clients so the buff should automatically be applied on all clients, keeping the player buff data in sync without burdening the network. When in doubt, consult vanilla source code examples or test your code.
If applying a buff to a player other than the local player in pvp, quiet should be false and the buff must be true in Main.pvpBuff to properly sync. More...
 
void AddCoinLuck (Vector2 coinPosition, int coinAmount)
 
void addDPS (int dmg)
 
void AddImmuneTime (int cooldownCounterId, int immuneTime)
 Adds to either Player.immuneTime or Player.hurtCooldowns based on the cooldownCounterId More...
 
void AdjTiles ()
 
bool AnyExtraJumpUsable ()
 Returns true if any extra jump is ExtraJumpState.Available and ExtraJump.CanStart.
Setting blockExtraJumps will cause this method to return false instead.
 
void ApplyArmorSoundAndDustChanges ()
 
void ApplyAttackCooldown ()
 
void ApplyAttackCooldown (int frames)
 
void ApplyBannerDefenseBuff (int bannerId, ref Player.HurtModifiers modifiers)
 
void ApplyBannerDefenseBuff (NPC npc, ref Player.HurtModifiers modifiers)
 
void ApplyBannerOffenseBuff (int bannerId, ref NPC.HitModifiers modifiers)
 
void ApplyBannerOffenseBuff (NPC npc, ref NPC.HitModifiers modifiers)
 
void ApplyDamageToNPC (NPC npc, int damage, float knockback, int direction, bool crit=false, DamageClass? damageType=null, bool damageVariation=false)
 Deals damage to an NPC (and syncs the hit in multiplayer).
The damage will be affected by modifiers, armor pen, enemy resistances etc.
Will not apply damage class modifiers/knockback. Use GetTotalDamage<T> to adjust the damage before calling if necessary.
Will apply damage class based armor penetration.
Will exit early with no effect if PlayerLoader.CanHitNPC returns false. More...
 
void ApplyEquipFunctional (Item currentItem, bool hideVisual)
 
void ApplyEquipVanity (Item currentItem)
 
void ApplyItemAnimation (Item sItem)
 
void ApplyItemAnimation (Item sItem, float multiplier, int? itemReuseDelay=null)
 
void ApplyItemTime (Item sItem, float multiplier=1, bool? callUseItem=null)
 
void ApplyMeleeScale (ref float scale)
 
Vector2 ApplyRangeCompensation (float rangeCompensation, Vector2 startPos, Vector2 targetPos)
 
int ArmorSetDye ()
 
void AutoFinchStaff ()
 
int beeDamage (int dmg)
 
float beeKB (float KB)
 
int beeType ()
 
int BiomeCampfireHoldStyle (int itemType)
 
int BiomeCampfirePlaceStyle (ref int type, ref int style)
 
int BiomeTorchHoldStyle (int style)
 
int BiomeTorchPlaceStyle (ref int type, ref int style)
 
void BordersMovement ()
 
void BrainOfConfusionDodge ()
 
void BuffHandle_SpawnPetIfNeeded (ref bool petBool, int petProjID, int buffIndex)
 
void BuffHandle_SpawnPetIfNeededAndSetTime (int buffIndex, ref bool petBool, int petProjID, int buffTimeToGive=18000)
 A helper method that handles code common to pet buffs. Can be used during the buff update code.
Sets the buff time to the value and spawns the corresponding pet projectile for the player if not yet spawned.
More...
 
bool BuyItem (long price, int customCurrency=-1)
 Attempts to "purchase" something that costs the given price .
Items will be taken from all of the player inventories and banks combined.
If customCurrency is provided, the price will be in terms of the custom currency instead of coins.
If the player has enough currency, the currency will be taken from the inventories.
More...
 
bool CanAcceptItemIntoInventory (Item item)
 
bool CanAfford (long price, int customCurrency=-1)
 
bool CanAutoReuseItem (Item sItem)
 
bool CanDemonHeartAccessoryBeShown ()
 
bool CanDoWireStuffHere (int x, int y)
 
bool CanFitSpace (int heightBoost)
 
bool CanGoIntoAmmoOnPickup (Item theSlot, Item theItemToAccept)
 
bool CanHit (Entity ent)
 
bool CanHitNPCWithMeleeHit (int npcIndex)
 
bool CanItemSlotAccept (Item theSlot, Item theItemToAccept)
 
bool CanMasterModeAccessoryBeShown ()
 
bool CanNPCBeHitByPlayerOrPlayerProjectile (NPC npc, Projectile projectile=null)
 
bool CanParryAgainst (Rectangle blockingPlayerRect, Rectangle enemyRect, Vector2 enemyVelocity)
 
bool CanPullItem (Item item, ItemSpaceStatus status)
 
bool CanSeeShimmerEffects ()
 
bool CanSnapToPosition (Vector2 offset)
 
bool CanVisuallyHoldItem (Item item)
 
void CarpetMovement ()
 
void ChangeDir (int dir)
 Changes the player's direction (Entity.direction) while adjusting arm and item rotations to be consistent. Will also account for pulley and pulleyDir. The player direction change will be prevented if the player is on a rope but there isn't space for the player to face the new direction. More...
 
void ChangeSpawn (int x, int y)
 
Color ChatColor ()
 
void CheckCrackedBrickBreak ()
 
void checkDPSTime ()
 
void CheckDrowning ()
 
Vector2 CheckForGoodTeleportationSpot (ref bool canSpawn, int teleportStartX, int teleportRangeX, int teleportStartY, int teleportRangeY, RandomTeleportationAttemptSettings settings)
 
void CheckIceBreak ()
 
bool CheckMana (int amount, bool pay=false, bool blockQuickMana=false)
 
bool CheckMana (Item item, int amount=-1, bool pay=false, bool blockQuickMana=false)
 Determines if this player has enough mana to use an item.
If the player doesn't have enough mana and blockQuickMana is false, the player will activate any missing mana effects they have and try again.
The pay parameter can be used to consume the mana amount. More...
 
Item ChooseAmmo (Item weapon)
 Attempts to select an ammo item stack from this player's inventory to shoot with the given weapon. More...
 
void ClearBuff (int type)
 Removes the provided buff type from the player and shuffles the remaining buff indexes down to fill the gap. Use Player.DelBuff(int) if you only know the buff index More...
 
void ClearGrapplingBlacklist ()
 
Player clientClone ()
 
object Clone ()
 
void CloseSign ()
 
void CollectTaxes ()
 
int CollideWithNPCs (Rectangle myRect, float Damage, float Knockback, int NPCImmuneTime, int PlayerImmuneTime, DamageClass? damageType=null)
 
void CommandForbiddenStorm ()
 
void ConsumeAllExtraJumps ()
 Sets the ExtraJumpState.Available flag for all extra jumps to false.
If you want to disable an extra jump, use ExtraJumpState.Disable instead.
If you want to disable all extra jumps, but not prevent them once the disabling factor is removed, use blockExtraJumps instead.
 
bool ConsumeItem (int type, bool reverseOrder=false, bool includeVoidBag=false)
 Use to consume a single item. The item does not have to be Item.consumable.
Attempts to reduce the Item.stack of the first Item found in the inventory by 1.
Respects ItemLoader.ConsumeItem(Item, Player), so the item won't necessarily be consumed.
To consume multiple of the item, first check Player.CountItem to ensure that there are enough of the item, then use a for loop to call this method many times.
More...
 
bool ConsumeSolarFlare ()
 
void CopyVisuals (Player other)
 
int CountBuffs ()
 
void Counterweight (Vector2 hitPos, int dmg, float kb)
 
int CountItem (int type, int stopCountingAt=0)
 Counts the total stack of the specified item type in this players inventory.
Does not check Void Bag.
Use Player.HasItem(int) to check if the player has the item at all.
More...
 
void DashMovement ()
 
delegate void DashStartAction (int dashDirection)
 
void DelBuff (int b)
 Removes the buff at the provided index in buffType and buffTime and shuffles the remaining buff indexes down to fill the gap. Use Player.ClearBuff(int) if you only know the BuffID. More...
 
void DemonConch ()
 
void DisplayDollUpdate ()
 
void DoBootsEffect (Utils.TileActionAttempt theEffectMethod)
 
bool DoBootsEffect_PlaceFlamesOnTile (int X, int Y)
 
bool DoBootsEffect_PlaceFlowersOnTile (int X, int Y)
 
void DoCoins (int i)
 
void DoPotionOfReturnReturnToOriginalUsePosition ()
 
void DoPotionOfReturnTeleportationAndSetTheComebackPoint ()
 
void DoQueenSlimeHookTeleport (Vector2 targetPosition)
 
void DoubleJumpVisuals ()
 
bool DropAnglerAccByMissing (List< int > itemIdsOfAccsWeWant, float totalChance, out bool botheredRollingForADrop, out int itemIdToDrop)
 
long DropCoins ()
 
void DropFromItem (int itemType)
 
void DropItem (IEntitySource source, Vector2 position, ref Item item)
 Drops the ref'd item from the player at the position, and than turns the ref'd Item to air.
 
void dropItemCheck ()
 
void DropItems ()
 
void DropSelectedItem ()
 
void DropSelectedItem (int slot, ref Item theItemWeDrop)
 
void DropTombstone (long coinsOwned, NetworkText deathText, int hitDirection)
 
void DryCollision (bool fallThrough, bool ignorePlats)
 
Item FillAmmo (int plr, Item newItem, GetItemSettings settings)
 
int FindBuffIndex (int type)
 
int FindItem (bool[] validtypes)
 
int FindItem (int netid)
 
int FindItem (int type, Item[] collection)
 
int FindItem (List< int > netids)
 
int FindItemInInventoryOrOpenVoidBag (int type, out bool inVoidBag)
 
Item FindPaintOrCoating ()
 
void FindPulley ()
 
void FindSentryRestingSpot (int checkProj, out int worldX, out int worldY, out int pushYUp)
 
void FindSpawn ()
 
void FixLoadedData ()
 
void FlipItemLocationAndRotationForGravity ()
 
void FloorVisuals (bool Falling)
 
void ForceUpdateBiomes ()
 
void GamepadEnableGrappleCooldown ()
 
float GetAdjustedItemScale (Item item)
 Used to determine what the overall scale of an item should be.
CombinedHooks.ModifyItemScale is called here. More...
 
EntityShadowInfo GetAdvancedShadow (int shadowIndex)
 
int GetAmountOfExtraAccessorySlotsToShow ()
 
void GetAnglerReward (NPC angler, int questItemType)
 
ref float GetArmorPenetration (DamageClass damageClass)
 Gets the armor penetration modifier for this damage type on this player. This returns a reference, and as such, you can freely modify this method's return value with operators. Note that armor penetration value are typically whole numbers. Adding 5, for example, would add 5 to the armor penetration stat, similar to the Shark Tooth Necklace accessory.
 
ref float GetArmorPenetration< T > ()
 Gets the armor penetration modifier for this damage type on this player. This returns a reference, and as such, you can freely modify this method's return value with operators. Note that armor penetration value are typically whole numbers. Adding 5, for example, would add 5 to the armor penetration stat, similar to the Shark Tooth Necklace accessory. More...
 
ref float GetAttackSpeed (DamageClass damageClass)
 Gets the attack speed modifier for this damage type on this player. This returns a reference, and as such, you can freely modify this method's return values with operators. Note that attack speed is a multiplier. Adding 0.15f, for example, would add 15% to the attack speed stat.
 
ref float GetAttackSpeed< T > ()
 Gets the attack speed modifier for this damage type on this player. This returns a reference, and as such, you can freely modify this method's return values with operators. Setting this such that it results in zero or a negative value will throw an exception. NOTE: Due to the nature of attack speed modifiers, modifications to Flat will do nothing for this modifier. Note that attack speed is a multiplier. Adding 0.15f, for example, would add 15% to the attack speed stat. More...
 
Vector2 GetBackHandPosition (CompositeArmStretchAmount stretch, float rotation)
 
Vector2 GetBeardDrawOffsetFromHelmet ()
 
Item GetBestPickaxe ()
 
ref float GetCritChance (DamageClass damageClass)
 Gets the crit chance modifier for this damage type on this player. This returns a reference, and as such, you can freely modify this method's return value with operators. Note that crit values are percentage values ranging from 0 to 100, unlike damage multipliers. Adding 4, for example, would add 4% to the crit chance.
 
ref float GetCritChance< T > ()
 Gets the crit chance modifier for this damage type on this player. This returns a reference, and as such, you can freely modify this method's return value with operators. Note that crit values are percentage values ranging from 0 to 100, unlike damage multipliers. Adding 4, for example, would add 4% to the crit chance. More...
 
ref StatModifier GetDamage (DamageClass damageClass)
 Gets the damage modifier for this damage type on this player. This returns a reference, and as such, you can freely modify this method's return value with operators.
 
ref StatModifier GetDamage< T > ()
 Gets the damage modifier for this damage type on this player. This returns a reference, and as such, you can freely modify this method's return value with operators. More...
 
Color GetDeathAlpha (Color newColor)
 
int getDPS ()
 
void GetDyeTraderReward (NPC dyeTrader)
 
Vector2 GetFaceHeadOffsetFromHelmet ()
 
Vector2 GetFarthestSpawnPositionOnLine (Vector2 startPos, float speedX, float speedY)
 
PlayerFishingConditions GetFishingConditions ()
 
Vector2 GetFrontHandPosition (CompositeArmStretchAmount stretch, float rotation)
 
Color GetHairColor (bool useLighting=true)
 
Vector2 GetHairDrawOffset (int hairID, bool hatHair)
 
void GetHairSettings (out bool fullHair, out bool hatHair, out bool hideHair, out bool backHairDraw, out bool drawsBackHairWithoutHeadgear)
 
int GetHealLife (Item item, bool quickHeal=false)
 
int GetHealMana (Item item, bool quickHeal=false)
 
Vector2 GetHelmetDrawOffset ()
 
Vector2 GetHelmetOffsetAddonFromFaceHead (Vector2 headOffset)
 
Color GetImmuneAlpha (Color newColor, float alphaReduction)
 
Color GetImmuneAlphaPure (Color newColor, float alphaReduction)
 
Item GetItem (int plr, Item newItem, GetItemSettings settings)
 
Rectangle GetItemDrawFrame (int type)
 
void GetItemExpectedPrice (Item item, out long calcForSelling, out long calcForBuying)
 
int GetItemGrabRange (Item item)
 Fetches the range at which the given item begins to gravitate towards the player.
This range, referred to as item grab range, is measured in pixels. More...
 
ref ExtraJumpState GetJumpState< T > ()
 
ref ExtraJumpState GetJumpState< T > (T baseInstance)
 
ref StatModifier GetKnockback (DamageClass damageClass)
 Gets the knockback modifier for this damage type on this player. This returns a reference, and as such, you can freely modify this method's return value with operators. Note that knockback values are multipliers. Adding 0.12f, for example, would add 12% to the knockback stat.
 
ref StatModifier GetKnockback< T > ()
 Gets the knockback modifier for this damage type on this player. This returns a reference, and as such, you can freely modify this method's return value with operators. Note that knockback values are multipliers. Adding 0.12f, for example, would add 12% to the knockback stat. More...
 
Vector2 GetLegsDrawOffset ()
 
List< int > GetListOfProjectilesToInteractWithHack ()
 
int GetManaCost (Item item)
 Calculates the mana needed to use the given item. More...
 
GetModPlayer< T > ()
 Gets the instance of the specified ModPlayer type. This will throw exceptions on failure. More...
 
GetModPlayer< T > (T baseInstance)
 Gets the local instance of the type of the specified ModPlayer instance. This will throw exceptions on failure. More...
 
List< int > GetNearbyContainerProjectilesList ()
 
void GetOtherPlayersPickTile (int x, int y, int pickDamage)
 
void GetPreferredGolfBallToUse (out int projType)
 
Rectangle getRect ()
 
IEntitySource GetSource_Accessory (Item item, string? context=null)
 
IEntitySource GetSource_Accessory_OnHurt (Item item, Entity? attacker, string? context=null)
 
IEntitySource GetSource_Accessory_OnHurt (Item item, PlayerDeathReason damageSource, string? context=null)
 
IEntitySource GetSource_Buff (int buffIndex)
 
IEntitySource GetSource_ItemUse (Item item, string? context=null)
 
IEntitySource GetSource_ItemUse_WithPotentialAmmo (Item item, int ammoItemId, string? context=null)
 
IEntitySource GetSource_OnHurt (PlayerDeathReason damageSource, string? context=null)
 
IEntitySource GetSource_OpenItem (int itemType, string? context=null)
 
bool[] GetTileCutIgnorance (bool allowRegrowth, bool fromTrap)
 
float GetTotalArmorPenetration (DamageClass damageClass)
 
float GetTotalArmorPenetration< T > ()
 
float GetTotalAttackSpeed (DamageClass damageClass)
 
float GetTotalAttackSpeed< T > ()
 
float GetTotalCritChance (DamageClass damageClass)
 
float GetTotalCritChance< T > ()
 
StatModifier GetTotalDamage (DamageClass damageClass)
 Calculates a total damage modifier for the player for the provided DamageClass.
Use in conjunction with StatModifier.ApplyTo(float) to calculate a final damage value for a given DamageClass and base damage: int finalDamage = (int)player.GetTotalDamage(item.DamageType).ApplyTo(30); More...
 
StatModifier GetTotalDamage< T > ()
 
StatModifier GetTotalKnockback (DamageClass damageClass)
 
StatModifier GetTotalKnockback< T > ()
 
int GetWeaponArmorPenetration (Item sItem)
 
float GetWeaponAttackSpeed (Item sItem)
 
int GetWeaponCrit (Item sItem)
 
int GetWeaponDamage (Item sItem, bool forTooltip=false)
 
float GetWeaponKnockback (Item sItem)
 
float GetWeaponKnockback (Item sItem, float baseKnockback)
 
WingStats GetWingStats (int wingID)
 
void Ghost ()
 
void GiveImmuneTimeForCollisionAttack (int time)
 
void GrantArmorBenefits (Item armorPiece)
 
void GrantPrefixBenefits (Item item)
 
void GrappleMovement ()
 
bool HasAmmo (Item sItem)
 Whether or not the player has ammunition available for the given weapon. More...
 
bool HasBuff (int type)
 Returns whether or not this Player currently has a (de)buff of the provided type.
 
bool HasBuff< T > ()
 
bool HasEnoughPickPowerToHurtTile (int x, int y)
 
bool HasItem (int type)
 Checks if the player has the specified item in their inventory.
Does not check Void Bag.
Use Player.CountItem(int, int) instead to count the total amount if needed.
More...
 
bool HasItem (int type, Item[] collection)
 Similar to HasItem(int), but checks the provided Item[] collection for items instead. Useful for checking other Item arrays, such as Player.armor or Player.bank.
 
bool HasItemInAnyInventory (int type)
 
bool HasItemInInventoryOrOpenVoidBag (int type)
 Similar to HasItem(int), but also checks the Void Bag.
 
bool HasLockedInventory ()
 
bool HasNPCBannerBuff (int bannerType)
 
bool HasUnityPotion ()
 
void Heal (int amount)
 Heals the player for a certain amount. More...
 
void HealEffect (int healAmount, bool broadcast=true)
 Spawns a CombatText indicating the player healed healAmount life and syncs it if broadcast is true.
Note that this doesn't actually heal the player, it only spawns the floating text. The Heal(int) method heals the player and calls this method and is more commonly used.
 
void HoneyCollision (bool fallThrough, bool ignorePlats)
 
void HorizontalMovement ()
 
void HorsemansBlade_SpawnPumpkin (int npcIndex, int dmg, float kb)
 
void Hurt (HurtInfo info, bool quiet=false)
 
double Hurt (PlayerDeathReason damageSource, int Damage, int hitDirection, bool pvp=false, bool quiet=false, int cooldownCounter=-1, bool dodgeable=true, float armorPenetration=0, float scalingArmorPenetration=0, float knockback=4.5f)
 
double Hurt (PlayerDeathReason damageSource, int Damage, int hitDirection, out HurtInfo info, bool pvp=false, bool quiet=false, int cooldownCounter=-1, bool dodgeable=true, float armorPenetration=0, float scalingArmorPenetration=0, float knockback=4.5f)
 
bool InInteractionRange (int interactX, int interactY, TileReachCheckSettings settings)
 
bool InModBiome (ModBiome baseInstance)
 Determines if the player is in specified ModBiome. This will throw exceptions on failure. More...
 
bool InModBiome< T > ()
 
bool InOpposingTeam (Player otherPlayer)
 
void InterruptItemUsageIfOverTile (int tileTypeToBeOver)
 
bool InZonePurity ()
 Calculates whether or not the player is in the purity/forest biome.
 
bool IsAmmoFreeThisShot (Item weapon, Item ammo, int projToShoot)
 Determines whether or not the given ammunition should be conserved, based on the given weapon as wielded by this player. More...
 
bool IsBlacklistedForGrappling (Point p)
 
bool IsColorfulDye (int dye)
 
bool IsInInteractionRangeToMultiTileHitbox (int chestPointX, int chestPointY)
 
bool IsInTileInteractionRange (int targetX, int targetY, TileReachCheckSettings settings)
 
bool IsItemSlotUnlockedAndUsable (int slot)
 
bool isNearFairy ()
 
bool isNearNPC (int type, float range=-1f)
 
bool IsProjectileInteractibleAndInInteractionRange (Projectile proj, ref Vector2 compareSpot)
 
bool IsStackingItems ()
 
bool IsTargetTileInItemRange (Item sItem)
 
bool IsTileTypeInInteractionRange (int targetTileType, TileReachCheckSettings settings)
 
bool IsWithinSnappngRangeToTile (int x, int y, int distanceInPixels)
 
void ItemCheck ()
 
void ItemCheck_ApplyUseStyle (float mountOffset, Item sItem, Rectangle heldItemFrame)
 
void ItemCheck_ManageRightClickFeatures ()
 
void ItemCheck_ManageRightClickFeatures_ShieldRaise (bool theGeneralCheck)
 
bool ItemFitsItemFrame (Item i)
 
bool ItemFitsWeaponRack (Item i)
 
bool ItemIsVisuallyIncompatible (Item item)
 
ItemSpaceStatus ItemSpace (Item newItem)
 
bool ItemSpaceForCofveve (Item newItem)
 
void JumpMovement ()
 
void KeyDoubleTap (int keyDir)
 
void KeyHoldDown (int keyDir, int holdTime)
 
void KillMe (PlayerDeathReason damageSource, double dmg, int hitDirection, bool pvp=false)
 
void KillMeForGood ()
 
void LimitPointToPlayerReachableArea (ref Vector2 pointPoisition)
 
void LockGamepadTileInteractions ()
 
void LookForTileInteractions ()
 
void MagicConch ()
 
void ManaEffect (int manaAmount)
 
void ManageSpecialBiomeVisuals (string biomeName, bool inZone, Vector2 activationSource=default(Vector2))
 
void MatchItemTimeToItemAnimation ()
 
void MinionNPCTargetAim (bool doNotDisableIfTheTargetIsTheSame)
 
void MinionRestTargetAim ()
 
void MoonLeechRope ()
 
void NebulaLevelup (int type)
 
void NinjaDodge ()
 
void OnHit (float x, float y, Entity victim)
 
void OnKillNPC (ref NPCKillAttempt attempt, object externalKillingBlowSource)
 
void OpenBossBag (int type)
 
void OpenCanofWorms (int sourceItemType)
 
void OpenChest (int x, int y, int newChest)
 Handles boilerplate for gamepad and UI when opening or closing a container.
Sets Player.chestX, and Player.chestY, and Player.chest to the given coordinates. More...
 
void OpenFishingCrate (int crateItemID)
 
void OpenGoodieBag (int itemType)
 
void OpenHerbBag (int bagType)
 
void OpenLegacyPresent (int itemType)
 
void OpenLockBox (int lockboxItemType)
 
void OpenOyster (int sourceItemType)
 
void OpenPresent (int itemType)
 
void OpenShadowLockbox (int boxType)
 
bool PayCurrency (long price, int customCurrency=-1)
 
void PetAnimal (int animalNpcIndex)
 
bool PickAmmo (Item weapon, out int projToShoot, out float speed, out int damage, out float knockBack, out int usedAmmoItemId, bool dontConsume=false)
 A more-convenient-to-call variant of the vanilla PickAmmo method, which handles most vanilla ammunition logic to decide various common stats related to ammunition-consuming weapons.
The stats output by this method take into account any extra stats which the ammunition it finds may provide (read: it accounts for ammo damage and knockback).
More...
 
void PickTile (int x, int y, int pickPower)
 
void PickWall (int x, int y, int damage)
 
void PlaceThing (ref ItemCheckContext context)
 
void PlaceThing_Tiles_PlaceIt_ConsumeFlexibleWandMaterial ()
 
void PlaceWeapon (int x, int y)
 
void PlayDroppedItemAnimation (int time)
 
void PlayDrums (float range)
 
void PlayerFrame ()
 
void PlayGuitarChord (float range)
 
void PutItemInInventoryFromItemUsage (int type, int theSelectedItem=-1)
 
void QuickBuff ()
 
void QuickGrapple ()
 
Item QuickGrapple_GetItemToUse ()
 
void QuickHeal ()
 
Item QuickHeal_GetItemToUse ()
 
void QuickMana ()
 
Item QuickMana_GetItemToUse ()
 
void QuickMount ()
 
Item QuickMount_GetItemToUse ()
 
int QuickSpawnClonedItem (IEntitySource source, Item item, int stack=1)
 Will spawn an item like Player.QuickSpawnItem(IEntitySource, int, int), but clones it (handy when you need to retain item infos) More...
 
Item QuickSpawnClonedItemDirect (IEntitySource source, Item item, int stack=1)
 
int QuickSpawnItem (IEntitySource source, int item, int stack=1)
 Spawns an item into the world at this players position. This is a simpler alternative to Item.NewItem(IEntitySource, int, int, int, int, int, int, bool, int, bool, bool). This method can be called from multiplayer client code without necessitating manually syncing the item.
Use QuickSpawnItem(IEntitySource, Item, int) if a specific instance of an Item needs to be spawned into the world to preserve modded data. More...
 
int QuickSpawnItem (IEntitySource source, Item item, int stack=1)
 
Item QuickSpawnItemDirect (IEntitySource source, int type, int stack=1)
 
Item QuickSpawnItemDirect (IEntitySource source, Item item, int stack=1)
 
void QuickStackAllChests ()
 
void RecalculateLuck ()
 
void RefreshExtraJumps ()
 For each extra jump that is ExtraJumpState.Enabled, its ExtraJumpState.Available property set to true, allowing the extra jump to be used again.
Vanilla calls this method when the player is grounded and when jumping off of a grappling hook.
 
void RefreshInfoAccs ()
 
void RefreshInfoAccsFromItemType (Item item)
 
void RefreshInfoAccsFromTeamPlayers ()
 
void RefreshItems (bool onlyIfVariantChanged=true)
 
void RefreshMechanicalAccsFromItemType (int accType)
 
void RefreshMovementAbilities (bool doubleJumps=true)
 
void RemoveAllFishingBobbers ()
 
void RemoveAllGrapplingHooks ()
 
void RemoveSpawn ()
 
void ResetAdvancedShadows ()
 
void ResetEffects ()
 
void ResetFloorFlags ()
 
void ResetMeleeHitCooldowns ()
 
void ResetVisibleAccessories ()
 
int RollLuck (int range)
 
Vector2 RotatedRelativePoint (Vector2 pos, bool reverseRotation=false, bool addGfxOffY=true)
 Takes an input position and returns the position adjusted to the players visual rotation and offset. This accounts for the player being shifted up or down and rotated while riding a mount, sitting in a chair, and sleeping.
More...
 
Vector2 RotatedRelativePointOld (Vector2 pos, bool rotateForward=true)
 
void RotateRelativePoint (ref float x, ref float y)
 
void ScrollHotbar (int Offset)
 
bool SellItem (Item item, int stack=-1)
 
Player SerializedClone ()
 
void SetArmorEffectVisuals (Player drawPlayer)
 
void SetCompositeArmBack (bool enabled, CompositeArmStretchAmount stretch, float rotation)
 
void SetCompositeArmFront (bool enabled, CompositeArmStretchAmount stretch, float rotation)
 
void SetDummyItemTime (int frames)
 
void SetImmuneTimeForAllTypes (int time)
 
void SetItemAnimation (int frames)
 
void SetItemTime (int frames)
 
void SetMeleeHitCooldown (int npcIndex, int timeInFrames)
 
void SetPlayerDataToOutOfClassFields ()
 
void SetTalkNPC (int npcIndex, bool fromNet=false)
 
void ShadowDodge ()
 
void Shellphone_Spawn ()
 
void ShimmerCollision (bool fallThrough, bool ignorePlats, bool noCollision)
 
bool ShouldDrawFootball ()
 
bool ShouldDrawWingsThatAreAlwaysAnimated ()
 
void SlopeDownMovement ()
 
void SlopingCollision (bool fallThrough, bool ignorePlats)
 
void SmartInteractLookup ()
 
void SmartSelectLookup ()
 
void Spawn (PlayerSpawnContext context)
 
bool Spawn_GetPositionAtWorldSpawn (ref int floorX, ref int floorY)
 
int SpawnMinionOnCursor (IEntitySource projectileSource, int ownerIndex, int minionProjectileId, int originalDamageNotScaledByMinionDamage, float KnockBack, Vector2 offsetFromCursor=default(Vector2), Vector2 velocityOnSpawn=default(Vector2))
 
void SporeSac (Item sourceItem)
 
void StartChanneling ()
 
void StartChanneling (Item item)
 
void StatusFromNPC (NPC npc)
 
void StatusToNPC (int type, int i)
 
void StatusToPlayerPvP (int type, int i)
 
void StickyMovement ()
 
void StopExtraJumpInProgress ()
 Cancels any extra jump in progress.
Sets all ExtraJumpState.Active flags to false and calls OnExtraJumpEnded hooks.
Also sets jump to 0 if a an extra jump was active.

More...
 
void StopVanityActions (bool multiplayerBroadcast=true)
 
void StrikeNPCDirect (NPC npc, NPC.HitInfo hit)
 Applies a hit to an NPC via NPC.StrikeNPC(NPC.HitInfo, bool, bool).
Also calls player based OnHit and OnKill hooks, tracks dps and net syncs the strike More...
 
bool SummonItemCheck (Item item)
 
void TakeDamageFromJellyfish (int npcIndex)
 
void TakeUnityPotion ()
 
bool TeamChangeAllowed ()
 
void Teleport (Vector2 newPos, int Style=0, int extraInfo=0)
 
void TeleportationPotion ()
 
void TileInteractionsCheck (int myX, int myY)
 
void ToggleCreativeMenu ()
 
void ToggleInv ()
 
void ToggleLight ()
 
void TogglePet ()
 
void TryCancelChannel (Projectile projectile)
 
void TryDroppingSingleItem (IEntitySource source, Item theItem)
 
bool TryGetModPlayer< T > (out T result)
 Gets the instance of the specified ModPlayer type. More...
 
bool TryGetModPlayer< T > (T baseInstance, out T result)
 Safely attempts to get the local instance of the type of the specified ModPlayer instance. More...
 
void TryGettingDevArmor (IEntitySource source)
 
void TryInterruptingItemUsage ()
 
void TryOpeningFullscreenMap ()
 
bool TryPlacingAGolfBallNearANearbyTee (Vector2 placePosition)
 
void TryPortalJumping ()
 
void TrySwitchingLoadout (int loadoutIndex)
 
void TryTogglingShield (bool shouldGuard)
 
void TryToResetHungerToNeutral ()
 
void TryUpdateChannel (Projectile projectile)
 
void UnityTeleport (Vector2 telePos)
 
void Update (int i)
 
void Update_NPCCollision ()
 
void UpdateAdvancedShadows ()
 
void UpdateArmorLights ()
 
void UpdateArmorSets (int i)
 
void UpdateBiomes ()
 
void UpdateBlacklistedTilesForGrappling ()
 
void UpdateBuffs (int i)
 
void UpdateDead ()
 
void UpdateDyes ()
 
void UpdateEquips (int i)
 
void UpdateForbiddenSetLock ()
 
void UpdateHairDyeDust ()
 
void UpdateHungerBuffs ()
 
void UpdateImmunity ()
 
void UpdateJumpHeight ()
 
void UpdateLifeRegen ()
 
void UpdateLuck ()
 
void UpdateLuckFactors ()
 
void UpdateManaRegen ()
 
void UpdateMaxTurrets ()
 Kills Projectile.sentry projectiles exceeding the players current maxTurrets. The oldest projectiles, determined by Projectile.timeLeft, are killed.
Call this method immediately after spawning a Projectile.sentry projectile.

 
void UpdateMeleeHitCooldowns ()
 
void UpdateMinionTarget ()
 
void UpdateMiscCounter ()
 
void UpdateNearbyInteractibleProjectilesList ()
 
void UpdatePermanentBoosters ()
 
void UpdatePet (int i)
 
void UpdatePetLight (int i)
 
void UpdateSocialShadow ()
 
void UpdateStarvingState (bool withEmote)
 
void UpdateTeleportVisuals ()
 
void UpdateTouchingTiles ()
 
void UpdateVisibleAccessories (Item item, bool invisible, int slot=-1, bool modded=false)
 Invoked in UpdateVisibleAccessories. Runs common code for both modded slots and vanilla slots based on provided Items.
 
void UpdateVisibleAccessory (int itemSlot, Item item, bool modded=false)
 
void UseHealthMaxIncreasingItem (int increase)
 
void UseManaMaxIncreasingItem (int increase)
 
bool useVoidBag ()
 
void VolatileGelatin (Item sourceItem)
 
void WallslideMovement ()
 
void WaterCollision (bool fallThrough, bool ignorePlats)
 
void WingFrame (bool wingFlap, bool isCustomWings=false)
 
void WingMovement ()
 
void WOFTongue ()
 
void Yoraiz0rEye ()
 
- Public Member Functions inherited from Entity
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 bool CanPlayerSmashWall (int X, int Y)
 
static bool CheckSpawn (int x, int y)
 
static void ClearPlayerTempInfo ()
 
static byte FindClosest (Vector2 Position, int Width, int Height)
 
static void FixLoadedData_EliminiateDuplicateAccessories (Item[] armorArray)
 
static float GetAnglerRewardRarityMultiplier (int questsDone)
 
static float GetClosestPlayersLuck (Point Position)
 
static float GetClosestPlayersLuck (Vector2 Position)
 
static float GetClosestRollLuck (int x, int y, int range)
 
static float GetClosestRollLuck (Vector2 position, int range)
 
static PlayerFileData GetFileData (string file, bool cloudSave)
 
static ? Tile GetFloorTile (int x, int y)
 
static int GetFloorTileType (int x, int y)
 
static int GetMouseScrollDelta ()
 
static void InternalSaveMap (bool isCloudSave)
 
static bool IsHoveringOverABottomSideOfABed (int myX, int myY)
 
static PlayerFileData LoadPlayer (string playerPath, bool cloudSave)
 
static PlayerFileData LoadPlayerFromStream (PlayerFileData playerFileData, byte[] plrData, byte[] tplrData)
 
static void SavePlayer (PlayerFileData playerFile, bool skipMapSave=false)
 
static byte[] SavePlayerFile_Vanilla (PlayerFileData playerFile)
 
static int SetMatch (SetMatchRequest request, ref bool somethingSpecial)
 
static bool WouldSpotOverlapWithSentry (int worldX, int worldY, bool lightningAura)
 
- Static Public Member Functions inherited from Entity
static IEntitySource GetSource_NaturalSpawn ()
 
static ? IEntitySource GetSource_None ()
 
static IEntitySource GetSource_TownSpawn ()
 
static ? IEntitySource InheritSource (Entity entity)
 

Public Attributes

int _framesLeftEligibleForDeadmansChestDeathAchievement
 
int _funkytownAchievementCheckCooldown
 
int _portalPhysicsTime
 
bool abigailMinion
 
bool accCalendar
 
int accCompass
 
bool accCritterGuide
 
byte accCritterGuideCounter
 
byte accCritterGuideNumber
 
int accDepthMeter
 
bool accDivingHelm
 
bool accDreamCatcher
 
bool accFishFinder
 
bool accFishingBobber
 
bool accFishingLine
 If true, this player's fishing line will never break.
 
bool accJarOfSouls
 
bool accLavaFishing
 
bool accMerman
 
bool accOreFinder
 
float accRunSpeed
 
bool accStopwatch
 
bool accTackleBox
 
bool accThirdEye
 
byte accThirdEyeCounter
 
byte accThirdEyeNumber
 
int accWatch
 
bool accWeatherRadio
 
bool ActuationRodLock
 
bool ActuationRodLockSetting
 
bool adjHoney
 
bool adjLava
 
bool adjShimmer
 
bool adjWater
 
int afkCounter
 
int aggro
 
bool alchemyTable
 
int altFunctionUse
 
bool ammoBox
 
bool ammoCost75
 
bool ammoCost80
 
bool ammoPotion
 
int anglerQuestsFinished
 
bool anglerSetSpawnReduction
 
bool archery
 
bool arcticDivingGear
 
Item[] armor = new Item[20]
 The player's armor and accessories. Indexes 0-2 hold head, chest, and legs armor while 10-12 hold the respective social armor items. Indexes 3-9 hold the accessories and 13-19 hold the social accessory items. Modded accessory slots are stored separately.

Generally speaking, modders should not be accessing this array to check for specific accessories, that is not how Terraria is designed and is not scalable, especially since modded accessory slots exist and each can have special logic. Modders should be using ModItem.UpdateAccessory(Player, bool) to set fields in a ModPlayer class, then use those values for gameplay effects. SimpleModPlayer.csshows the proper approach and explains this pattern.

The corresponding dye items are found in dye. The player's inventory is inventory. For equipment, see miscEquips and miscDyes. trashItem is the trash slot.


 
bool armorEffectDrawOutlines
 
bool armorEffectDrawOutlinesForbidden
 
bool armorEffectDrawShadow
 
bool armorEffectDrawShadowBasilisk
 
bool armorEffectDrawShadowEOCShield
 
bool armorEffectDrawShadowLokis
 
bool armorEffectDrawShadowSubtle
 
StatModifier arrowDamage = StatModifier.Default
 
bool ashWoodBonus
 
bool ateArtisanBread
 
int attackCD
 
bool autoActuator
 
bool autoJump
 
bool autoPaint
 
bool autoReuseAllWeapons
 
bool autoReuseGlove
 
int availableAdvancedShadowsCount
 
bool babyBird
 
bool babyFaceMonster
 
int back = -1
 
int backpack = -1
 
bool ballistaPanic
 
int balloon = -1
 
int balloonFront = -1
 
Chest bank = new Chest(bank: true)
 
Chest bank2 = new Chest(bank: true)
 
Chest bank3 = new Chest(bank: true)
 
Chest bank4 = new Chest(bank: true)
 
int bartenderQuestLog
 
float basiliskCharge
 
bool batsOfLight
 
int beard = -1
 
int beardGrowthTimer
 
bool beetleBuff
 
int beetleCountdown
 
float beetleCounter
 
bool beetleDefense
 
int beetleFrame
 
int beetleFrameCounter
 
bool beetleOffense
 
int beetleOrbs
 
Vector2[] beetlePos = new Vector2[3]
 
Vector2[] beetleVel = new Vector2[3]
 
bool behindBackWall
 
bool biomeSight
 
bool blackBelt
 
bool blackCat
 
bool blackout
 
bool bleed
 
bool blind
 
bool blockExtraJumps
 When true, all extra jumps will be blocked, including Flipper usage.
Setting this field to true will not stop any currently active extra jumps.
 
int blockRange
 
bool bloodMoonMonolithShader
 
bool blueFairy
 
int body = -1
 
Rectangle bodyFrame
 
double bodyFrameCounter
 
Vector2 bodyPosition
 
float bodyRotation
 
Vector2 bodyVelocity
 
bool boneArmor
 
Item boneGloveItem
 
int boneGloveTimer
 
int brainOfConfusionDodgeAnimationCounter
 
Item brainOfConfusionItem
 
int breath = 200
 
int breathCD
 
int breathMax = 200
 
bool brokenArmor
 
bool[] buffImmune = new bool[BuffID.Count]
 Indexed by BuffID. If true for a given BuffID, then this player cannot be inflicted with that buff.
Additionally, if the player is inflicted with that buff and becomes immune to it, the buff will be cleared.
Defaults to false.
 
int[] buffTime = new int[maxBuffs]
 The remaining durations in ticks of all buffs this player has active.
A value of 0 means that buff slot is empty.
Buff types are stored with the same index in buffType.
AddBuff(int, int, bool, bool), ClearBuff(int), and DelBuff(int) should be used to manipulate player buffs.
 
int[] buffType = new int[maxBuffs]
 The BuffIDs of all buffs this player has active.
A value of 0 means that buff slot is empty.
Buff times are stored with the same index in buffTime.
AddBuff(int, int, bool, bool), ClearBuff(int), and DelBuff(int) should be used to manipulate player buffs.
 
int[] builderAccStatus = new int[BuilderToggleLoader.BuilderToggleCount]
 
StatModifier bulletDamage = StatModifier.Default
 
bool bunny
 
bool burned
 
bool cactusThorns
 
bool calmed
 
bool canCarpet
 
bool canFloatInWater
 
int cAngelHalo
 
bool canRocket
 
bool CanSeeInvisibleBlocks
 
bool carpet
 
int carpetFrame = -1
 
float carpetFrameCounter
 
int carpetTime
 
bool cartFlip
 
int cartRampTime
 
int cBack
 
int cBackpack
 
int cBalloon
 
int cBalloonFront
 
int cBeard
 
int cBody
 The armor shader ID applied to the EquipType.Body equip texture by a dye item (Item.dye) in the dye slot.
 
int cCarpet
 
int cFace
 
int cFaceFlower
 
int cFaceHead
 
int cFlameWaker
 
int cFloatingTube
 
int cFront
 
int cGrapple
 The armor shader ID applied to the Hook equipment slot by a dye item (Item.dye) in the dye slot.
 
int cHandOff
 
int cHandOn
 
int changeItem = -1
 
bool channel
 
bool chaosState
 
OverheadMessage chatOverhead
 
int cHead
 The armor shader ID applied to the EquipType.Head equip texture by a dye item (Item.dye) in the dye slot.
 
int chest = -1
 Represents the chest the player currently has open. If -1, the player has no chest open.
Positive values indicate the index of the chest in Main.chest the player currently has open.
Negative values are used to indicate additional inventories: Piggy Bank (-2), Safe (-3), Defender's Forge (-4), Void Vault (-5)
 
int chestX
 
int chestY
 
bool chilled
 
bool chiselSpeed
 
bool chloroAmmoCost80
 
SelectionRadial CircularRadial = new SelectionRadial(SelectionRadial.SelectionMode.RadialCircular)
 
int cLegs
 The armor shader ID applied to the EquipType.Legs equip texture by a dye item (Item.dye) in the dye slot.
 
int cLeinShampoo
 
int cLight
 The armor shader ID applied to the Light Pet equipment slot by a dye item (Item.dye) in the dye slot.
 
int cMinecart
 The armor shader ID applied to the Minecart equipment slot by a dye item (Item.dye) in the dye slot.
 
int cMinion
 
int cMount
 The armor shader ID applied to the Mount equipment slot by a dye item (Item.dye) in the dye slot.
 
int cNeck
 
float coinLuck
 
bool coldDash
 
bool companionCube
 
CompositeArmData compositeBackArm
 
CompositeArmData compositeFrontArm
 
bool confused
 
bool controlCreativeMenu
 
bool controlDown
 
bool controlDownHold
 
bool controlHook
 
bool controlInv
 
bool controlJump
 
bool controlLeft
 
bool controlMap
 
bool controlMount
 
bool controlQuickHeal
 
bool controlQuickMana
 
bool controlRight
 
bool controlSmart
 
bool controlThrow
 
bool controlTorch
 
bool controlUp
 
bool controlUseItem
 
bool controlUseTile
 
bool coolWhipBuff
 
bool cordage
 
int counterWeight
 
int cPet
 The armor shader ID applied to the Pet equipment slot by a dye item (Item.dye) in the dye slot.
 
int cPortableStool
 
bool cratePotion
 
bool creativeGodMode
 
bool creativeInterface
 
CreativeUnlocksTracker creativeTracker
 
bool crimsonHeart
 
bool crimsonRegen
 
bool crystalLeaf
 
int crystalLeafCooldown
 
bool cSapling
 
int cShield
 
int cShieldFallback
 
int cShoe
 
int cTail
 
int cUnicornHorn
 
int CurrentLoadoutIndex
 
ShoppingSettings currentShoppingSettings = ShoppingSettings.NotInShop
 
bool cursed
 
bool cursorItemIconEnabled
 
int cursorItemIconID
 
int cursorItemIconPush
 
bool cursorItemIconReversed
 
string cursorItemIconText = ""
 
int cWaist
 
int cWings
 
int cYorai
 
bool dangerSense
 
int dash
 The current vanilla dash that the player is VISIBLY using.
Unlike dashType, this does not update if a dash cannot currently be input.

 
int dashDelay
 The amount of time that has to pass, in ticks, before a new dash input will be registered.
For the first frame of any given dash, this is set to -1. After that frame has passed, it is set to 20 ticks, or 1/3 of a second.
For the Tabi dash, and when dashing into an enemy with the Shield of Cthulhu, this is set to 30 ticks, or 1/2 of a second, instead.

 
int dashTime
 The amount of time this player has left, in ticks, to input the second keystroke of a standard dash input (double-tap left/right).
For vanilla dashes, this window is 15 ticks, or a quarter of a second, in total.

 
int dashType
 The current vanilla dash that the player is using.
The following values correspond to vanilla dashes:
1 => Tabi / Master Ninja Gear
2 => Shield of Cthulhu
3 => Solar Flare armor set bonus
4 => Unused, though a dash for this value DOES exist
5 => Crystal Assassin set bonus

 
bool dazed
 
bool dd2Accessory
 
bool dead
 
bool DeadlySphereMinion
 
bool defendedByPaladin
 
MultipliableFloat DefenseEffectiveness
 Determines how effective the player's statDefense is at reducing incoming damage.
The Defense wiki pageexplains the effect, shown in the wiki as "factor".

 
bool delayUseItem
 
bool desertBoots
 
bool desertDash
 
bool detectCreature
 
byte difficulty
 
bool dino
 
int disableVoidBag = -1
 
bool discountAvailable
 
bool discountEquipped
 
string displayedFishingInfo = ""
 
bool dontHurtCritters
 
bool dontHurtNature
 
bool dontStarveShader
 
DoorOpeningHelper doorHelper
 
int[] doubleTapCardinalTimer = new int[4]
 
bool downedDD2EventAnyDifficulty
 
SelectionRadial DpadRadial = new SelectionRadial()
 
int dpsDamage
 
DateTime dpsEnd
 
DateTime dpsLastHit
 
DateTime dpsStart
 
bool dpsStarted
 
float drainBoost
 
bool drawingFootball
 
bool dripping
 
bool drippingSlime
 
bool drippingSparkleSlime
 
bool dryadWard
 
Item[] dye = new Item[10]
 
bool eater
 
bool editedChestName
 
bool electrified
 
int emoteTime
 
bool empressBlade
 
bool empressBrooch
 
bool enabledSuperCart = true
 If true, then this player has the effects of the Super Cart enabled. See UsingSuperCart for more info.
 
float endurance
 The percent of damage this player should resist.
Has a soft cap of 1f. Cannot reduce taken damage below 1.
 
bool enemySpawns
 
int environmentBuffImmunityTimer
 
int eocDash
 
int eocHit
 
float equipmentBasedLuckBonus
 
bool equippedAnyTileRangeAcc
 
bool equippedAnyTileSpeedAcc
 
bool equippedAnyWallSpeedAcc
 
Item equippedWings = null
 
bool extraAccessory
 
int extraAccessorySlots = 2
 
int extraFall
 The number of extra tiles this player can fall before they start taking fall damage. More...
 
bool eyebrellaCloud
 
Color eyeColor = new Color(105, 90, 75)
 
PlayerEyeHelper eyeHelper
 
bool eyeSpring
 
int face = -1
 
int faceFlower = -1
 
int faceHead = -1
 
bool fairyBoots
 
int fallStart
 
int fallStart2
 
int fartKartCloudDelay
 
bool findTreasure
 
bool fireWalk
 
float firstFractalAfterImageOpacity
 
int fishingSkill
 
byte flameRingAlpha
 
byte flameRingFrame
 
float flameRingRot
 
float flameRingScale = 1f
 
bool flapSound
 
bool flinxMinion
 
bool flowerBoots
 
int forcedGravity
 
bool forceMerman
 
bool forceWerewolf
 
bool frogLegJumpBoost
 
int front = -1
 
bool frostArmor
 
bool frostBurn
 
bool frozen
 
float fullRotation
 
Vector2 fullRotationOrigin = Vector2.Zero
 
int gem = -1
 
int gemCount
 
float gfxOffY
 An offset from the actual position of the player that will be added to the draw position. Used to fake the effect of the player smoothly traveling up single block obstacles.
 
bool ghost
 
float ghostDir = 1f
 
float ghostDmg
 
float ghostFade
 
int ghostFrame
 
int ghostFrameCounter
 
bool ghostHeal
 
bool ghostHurt
 
bool gills
 
bool GoingDownWithGrapple
 
bool goldRing
 
int golferScoreAccumulated
 
int grapCount
 
int[] grappling = new int[20]
 
bool gravControl
 
bool gravControl2
 
float gravDir = 1f
 
float gravity = defaultGravity
 
bool greenFairy
 
bool grinch
 
bool gross
 
int hair
 
Color hairColor = new Color(215, 90, 55)
 
int hairDye
 
Color hairDyeColor = Color.Transparent
 
float hairDyeVar
 
Rectangle hairFrame
 
int handoff = -1
 
int handon = -1
 
bool happyFunTorchTime
 
bool hasAngelHalo
 
bool hasCreditsSceneMusicBox
 
bool hasFloatingTube
 
bool hasFootball
 
bool HasGardenGnomeNearby
 
bool hasGemRobe = false
 Set by any gem robe when worn by the player in the functional armor slot. Increases the spawn rate of NPCID.Tim.
 
bool hasLuck_LuckyCoin
 
bool hasLuck_LuckyHorseshoe
 
bool hasLuckyCoin
 
bool hasLucyTheAxe
 
bool hasMagiluminescence
 
bool hasMoltenQuiver
 
bool hasPaladinShield
 
bool hasRainbowCursor
 
bool hasRaisableShield
 
bool hasTitaniumStormBuff
 
bool hasUnicornHorn
 
bool hbLocked
 
int head = -1
 
bool headcovered
 
Rectangle headFrame
 
double headFrameCounter
 
Vector2 headPosition
 
float headRotation
 
Vector2 headVelocity
 
bool heartyMeal
 
int heldProj = -1
 
bool hellfireTreads
 
SoundPlaySet hermesStepSound = new SoundPlaySet()
 
bool[] hideInfo = new bool[InfoDisplayLoader.InfoDisplayCount]
 
bool hideMerman
 
BitsByte hideMisc = (byte)0
 
bool[] hideVisibleAccessory = new bool[10]
 
bool hideWolf
 
int highestAbigailCounterOriginalDamage
 
int highestStormTigerGemOriginalDamage
 
HitTile hitReplace
 
HitTile hitTile
 
int[] holdDownCardinalTimer = new int[4]
 
bool honey
 
Item honeyCombItem
 If not null, this player will create damaging bee projectiles when taking damage.
 
bool hornet
 
bool hornetMinion
 
bool hostile
 
int HotbarOffset
 
bool hungry
 
bool huntressAmmoCost90
 
int[] hurtCooldowns = new int[5]
 
bool iceBarrier
 
byte iceBarrierFrame
 
byte iceBarrierFrameCounter
 
bool iceSkate
 
bool ichor
 
bool ignoreWater
 
bool immune
 
int immuneAlpha
 
int immuneAlphaDirection
 
bool immuneNoBlink
 
int immuneTime
 
bool impMinion
 
bool inferno
 
int infernoCounter
 
bool InfoAccMechShowWires
 
int insanityShadowCooldown
 
Vector2 instantMovementAccumulatedThisFrame
 
Item[] inventory = new Item[59]
 The player's normal inventory. Indexes 0-9 hold the hotbar items, 10-49 the rest of the main inventory, 50-53 are coin slots, 54-57 are ammo slots. Index 58 is used to store the mouse item in some situations.
Additional inventories are found in bank (Piggy Bank), bank2 (Safe), bank3 (Defender's Forge), and bank4 (Void Vault). For armor and accessories, see armor and dye. For equipment, see miscEquips and miscDyes. trashItem is the trash slot.

 
bool[] inventoryChestStack = new bool[59]
 
bool invis
 
bool isControlledByFilm
 
bool isDisplayDollOrInanimate
 
bool isFirstFractalAfterImage
 
bool isFullbright
 
bool isHatRackDoll
 
bool isOperatingAnotherEntity
 
bool isPerformingPogostickTricks
 
bool isPettingAnimal
 
bool isTheAnimalBeingPetSmall
 
int itemAnimation
 
int itemAnimationMax
 
int itemFlameCount
 
Vector2[] itemFlamePos = new Vector2[7]
 
int itemHeight
 
Vector2 itemLocation
 
float itemRotation
 
int itemTime
 
int itemTimeMax
 
int itemWidth
 
int jump
 
bool jumpBoost
 
float jumpSpeedBoost
 How much to directly increase jumpSpeed, in pixels/tick.
 
bool JustDroppedAnItem
 
bool justJumped
 
bool kbBuff
 
bool kbGlove
 
bool killClothier
 
bool killGuide
 
double ladyBugLuckTimeLeft
 
Vector2 lastBoost = Vector2.Zero
 
int lastChest
 
int lastCreatureHit = -1
 
Vector2 lastDeathPostion
 
DateTime lastDeathTime
 
float lastEquipmentBasedLuckBonus
 
bool lastMouseInterface
 
int lastPortalColorIndex
 
bool lastStoned
 
int lastTeleportPylonStyleUsed
 
int lastTileRangeX
 
int lastTileRangeY
 
long lastTimePlayerWasSaved
 
Item lastVisualizedSelectedItem
 
int lavaCD
 
bool lavaImmune
 
int lavaMax
 
bool lavaRose
 
int lavaTime
 
int leftTimer
 
Rectangle legFrame
 
double legFrameCounter
 
Vector2 legPosition
 
float legRotation
 
int legs = -1
 
Vector2 legVelocity
 
bool leinforsHair
 
bool lifeForce
 
bool lifeMagnet
 
int lifeRegen
 The rate of this player's life regeneration in health per tick, divided by 120. To put it another way, it is health regeneration every 2 seconds. Used to implement the damage over time of debuffs and life regeneration accessories such as ItemID.BandofRegeneration.
For example, adding 10 to this value regenerates 10 / 120 = 1/6 health per tick, or 5 health per second.
Life regeneration is accumulated every tick in lifeRegenCount.
This value should be subtracted from in ModPlayer.UpdateBadLifeRegen and added to in ModPlayer.UpdateLifeRegen.
 
int lifeRegenCount
 This player's accumulated life regeneration.
If this value reaches or exceeds 120, the player gains lifeRegenCount / 120 health and this value decreases until it no longer exceeds 120.
If this value reaches or exceeds -120, the player loses health in the same way.
In either case, text will appear above the player indicating the life regeneration or life loss.
 
float lifeRegenTime
 How effective this player's natural life regeneration should be. Resets whenever the player is hurt, increases over time.
Certain effects increase this value to increase More...
 
float lifeSteal = 99999f
 
bool lightOrb
 
bool lizard
 
EquipmentLoadout[] Loadouts
 
int loadStatus
 
DirectionalInputSyncCache LocalInputCache
 
bool longInvince
 
long lostCoins
 
string lostCoinString = ""
 
bool loveStruck
 
float luck
 
float luckMaximumCap = 1f
 
float luckMinimumCap = -0.7f
 
bool luckNeedsSync
 
byte luckPotion
 
bool magicCuffs
 
bool magicLantern
 
bool magicQuiver
 
bool magmaStone
 
float manaCost = 1f
 The percent of mana actually used when mana is consumed.
Cannot reduce an item's mana cost below 0.
 
bool manaFlower
 
bool manaMagnet
 
int manaRegen
 
int manaRegenBonus
 
bool manaRegenBuff
 
int manaRegenCount
 
float manaRegenDelay
 
float manaRegenDelayBonus
 
bool manaSick
 
float manaSickReduction
 
bool mapAlphaDown
 
bool mapAlphaUp
 
bool mapFullScreen
 
bool mapStyle
 
bool mapZoomIn
 
bool mapZoomOut
 
float maxFallSpeed = 10f
 
int maxMinions = 1
 The maximum value of minions this player can have summoned at once.
A minion's value is stored as Projectile.minionSlots.
 
float maxRegenDelay
 
float maxRunSpeed = 3f
 The maximum speed, in pixels/tick, that this player can reach by just running. More...
 
int maxTurrets = 1
 
int maxTurretsOld = 1
 
byte meleeEnchant
 The vanilla flask effect which the player currently has active; these affect all melee weapons and whips.
Defaults to 0, which denotes that the player does not currently have a flask active.
The following values correspond to vanilla flasks:
1 => Flask of Venom (affected weapons proc Acid Venom on hit)
2 => Flask of Cursed Flames (affected weapons proc Cursed Inferno on hit)
3 => Flask of Fire (affected weapons proc On Fire! on hit)
4 => Flask of Gold (affected weapons proc Midas on hit)
5 => Flask of Ichor (affected weapons proc Ichor on hit)
6 => Flask of Nanites (affected weapons proc Confused on hit)
7 => Flask of Party (affected weapons sometimes release confetti explosions on hit)
8 => Flask of Poison (affected weapons proc Poisoned on hit)

 
int[] meleeNPCHitCooldown = new int[200]
 
bool meleeScaleGlove
 
bool merman
 
bool minecartLeft
 
bool miniMinotaur
 
int MinionAttackTargetNPC = -1
 
Vector2 MinionRestTargetPoint = Vector2.Zero
 
int miscCounter
 
Item[] miscDyes = new Item[5]
 
Item[] miscEquips = new Item[5]
 The player's equipment items. From indexes 0-4: Pet, Light Pet, Minecart, Mount, and Hook.
 
int miscTimer
 
bool moonLeech
 
bool moonLordLegs
 
bool moonLordMonolithShader
 
Mount mount
 This player's Mount.
Do not overwrite this value. Instead, call Mount.SetMount(int, Player, bool) or Mount.Dismount(Player) on it.
 
float MountFishronSpecialCounter
 
bool mouseInterface
 
PlayerMovementAccsCache movementAbilitiesCache
 
float moveSpeed = 1f
 The multiplier on this player's maxRunSpeed and runAcceleration.
 
int mushroomDelayTime = Item.mushroomDelay
 
float musicDist
 
string name = ""
 This player's displayed name.
Usually capped at 20 characters.
 
float nearbyActiveNPCs
 
int nebulaCD
 
int nebulaLevelDamage
 
int nebulaLevelLife
 
int nebulaLevelMana
 
int nebulaManaCounter
 
bool nebulaMonolithShader
 
int neck = -1
 
bool netLife
 
int netLifeTime
 
bool netMana
 
int netManaTime
 
int netSkip
 
int nextCycledSpiderMinionType
 
bool nightVision
 
bool noBuilding
 
bool noFallDmg
 If true, this player will take no fall damage.
 
bool noItems
 
bool noKnockback
 
int nonTorch = -1
 
int noThrow
 
bool[] npcTypeNoAggro = new bool[NPCID.Count]
 
int numberOfDeathsPVE
 
int numberOfDeathsPVP
 
int numMinions
 The current number of minions this player has summoned. Note that slotsMinions is how the minion limit is tracked, not this.
 
bool oldAdjHoney
 
bool oldAdjLava
 
bool oldAdjShimmer
 
bool oldAdjWater
 
byte oldLuckPotion
 
int oldSelectItem
 
bool onFire
 
bool onFire2
 
bool onFire3
 
bool onFrostBurn
 
bool onFrostBurn2
 
bool onHitDodge
 
bool onHitPetal
 
bool onHitRegen
 
bool onHitTitaniumStorm
 
bool onTrack
 
bool onWrongGround
 
float opacityForAnimation = 1f
 
bool outOfRange
 
int overrideFishingBobber = -1
 
BitsByte ownedLargeGems
 
int[] ownedProjectileCounts = new int[ProjectileID.Count]
 Provides efficient access to the number of projectiles of the specified type owned by this player currently active in the game world.
Can be used to prevent spawning additional projectiles when a limit is reached.
Updated each game update right before Player.UpdateBuffs.
For example, return player.ownedProjectileCounts[Item.shoot] < 1; in ModItem.CanUseItem could prevent a player using the item if the projectile the item spawns is already in the game world for the player.
 
bool palladiumRegen
 
bool panic
 
Color pantsColor = new Color(255, 230, 175)
 
bool parrot
 
bool parryDamageBuff
 
bool penguin
 
int petalTimer
 
bool petFlagBabyImp
 
bool petFlagBabyRedPanda
 
bool petFlagBabyShark
 
bool petFlagBabyWerewolf
 
bool petFlagBerniePet
 
bool petFlagBlueChickenPet
 
bool petFlagBrainOfCthulhuPet
 
bool petFlagCaveling
 
bool petFlagChesterPet
 
bool petFlagDD2BetsyPet
 
bool petFlagDD2Dragon
 
bool petFlagDD2Gato
 
bool petFlagDD2Ghost
 
bool petFlagDD2OgrePet
 
bool petFlagDeerclopsPet
 
bool petFlagDestroyerPet
 
bool petFlagDirtiestBlock
 
bool petFlagDukeFishronPet
 
bool petFlagDynamiteKitten
 
bool petFlagEaterOfWorldsPet
 
bool petFlagEverscreamPet
 
bool petFlagEyeOfCthulhuPet
 
bool petFlagFairyQueenPet
 
bool petFlagFennecFox
 
bool petFlagGlitteryButterfly
 
bool petFlagGlommerPet
 
bool petFlagGolemPet
 
bool petFlagIceQueenPet
 
bool petFlagJunimoPet
 
bool petFlagKingSlimePet
 
bool petFlagLilHarpy
 
bool petFlagLunaticCultistPet
 
bool petFlagMartianPet
 
bool petFlagMoonLordPet
 
bool petFlagPigPet
 
bool petFlagPlanteraPet
 
bool petFlagPlantero
 
bool petFlagPumpkingPet
 
bool petFlagQueenBeePet
 
bool petFlagQueenSlimePet
 
bool petFlagShadowMimic
 
bool petFlagSkeletronPet
 
bool petFlagSkeletronPrimePet
 
bool petFlagSpiffo
 
bool petFlagSugarGlider
 
bool petFlagTwinsPet
 
bool petFlagUpbeatStar
 
bool petFlagVoltBunny
 
int phantasmTime
 
int phantomPhoneixCounter
 
float pickSpeed = 1f
 
TrackedProjectileReference piggyBankProjTracker
 
bool pirateMinion
 
bool poisoned
 
PortableStoolUsage portableStoolInfo
 
bool portalPhysicsFlag
 
int potionDelay
 
int potionDelayTime = Item.potionDelay
 
Vector2? PotionOfReturnHomePosition
 
Vector2? PotionOfReturnOriginalUsePosition
 
bool poundRelease
 
bool powerrun
 
bool preventAllItemPickups
 
bool pStone
 
bool pulley
 If true, the player is attached to a rope or similar tile.
 
byte pulleyDir
 While attached to a rope or similar tile (pulley), this value represents the how close to the rope the player is. A value of 1 means the player is centered on the rope, while a value of 2 represents that the player has nudged away from the rope but is still attached. Entity.direction is used still for the players direction.
 
int pulleyFrame
 
float pulleyFrameCounter
 
bool puppy
 
bool pvpDeath
 
bool pygmy
 
SelectionRadial QuicksRadial = new SelectionRadial(SelectionRadial.SelectionMode.RadialQuicks)
 
RabbitOrderFrameHelper rabbitOrderFrame
 
bool rabid
 
bool raven
 
bool redFairy
 
bool releaseCreativeMenu
 
bool releaseDown
 
bool releaseHook
 
bool releaseInventory
 
bool releaseJump
 
bool releaseLeft
 
bool releaseMapFullscreen
 
bool releaseMapStyle
 
bool releaseMount
 
bool releaseQuickHeal
 
bool releaseQuickMana
 
bool releaseRight
 
bool releaseSmart
 
bool releaseThrow
 
bool releaseUp
 
bool releaseUseItem
 
bool releaseUseTile
 
bool remoteVisionForDrone
 
bool resistCold
 If true, this player will take 30% less damage from any NPC with NPC.coldDamage set and any projectile with Projectile.coldDamage set.
 
int respawnTimer
 
int restorationDelayTime = Item.restorationDelay
 
int reuseDelay
 
int rightTimer
 
int rocketBoots
 
int rocketDelay
 
int rocketDelay2
 
bool rocketFrame
 
bool rocketRelease
 
int rocketSoundDelay
 
int rocketTime
 
int rocketTimeMax = 7
 
int ropeCount
 
bool rulerGrid
 
bool rulerLine
 
float runAcceleration = 0.08f
 The acceleration, in pixels/ticks^2, that this player experiences while running. More...
 
bool runningOnSand
 
float runSlowdown = 0.2f
 
int runSoundDelay
 
bool sailDash
 
bool sapling
 
SavedPlayerDataWithAnnoyingRules savedPerPlayerFieldsThatArentInThePlayerClass
 
bool scope
 
int selectedItem
 
bool selectItemOnNextUse
 Causes SmartSelectLookup to run the next time an item animation is finished, even if controlUseItem is held.
Used internally by tML to when a hotbar key is pressed while using an item.
 
bool setApprenticeT2
 
bool setApprenticeT3
 
string setBonus = ""
 The text that is shown on armor (Item.wornArmor) with an active set bonus.
 
bool setForbidden
 
bool setForbiddenCooldownLocked
 
bool setHuntressT2
 
bool setHuntressT3
 
bool setMonkT2
 
bool setMonkT3
 
bool setNebula
 
bool setSolar
 
bool setSquireT2
 
bool setSquireT3
 
bool setStardust
 
bool setVortex
 
bool shadowArmor
 
int shadowCount
 
int[] shadowDirection = new int[3]
 
bool shadowDodge
 
float shadowDodgeCount
 
int shadowDodgeTimer
 
Vector2[] shadowOrigin = new Vector2[3]
 
Vector2[] shadowPos = new Vector2[3]
 
float[] shadowRotation = new float[3]
 
bool sharknadoMinion
 
int shield = -1
 
int shield_parry_cooldown
 
int shieldParryTimeLeft
 
bool shieldRaised
 
bool shimmerImmune
 
bool shimmering
 
bool shimmerMonolithShader
 
float shimmerTransparency
 
ShimmerUnstuckHelper shimmerUnstuckHelper
 
bool shinyStone
 
Color shirtColor = new Color(175, 165, 140)
 
int shoe = -1
 
Color shoeColor = new Color(160, 105, 60)
 
bool showLastDeath
 
bool shroomiteStealth
 
int sign = -1
 
bool silence
 
PlayerSittingHelper sitting
 
bool skeletron
 
Color skinColor = new Color(255, 125, 90)
 
int skinDyePacked
 
int skinVariant
 
bool skipAnimatingValuesInPlayerFrame
 
bool skyStoneEffects
 
PlayerSleepingHelper sleeping
 
int slideDir
 
bool sliding
 
bool slime
 
bool slippy
 
bool slippy2
 
bool sloping
 
float slotsMinions
 The current total value of minions this player has summoned. Used to limit active minions to maxMinions
A minion's value is stored as Projectile.minionSlots.
 
bool slow
 
bool slowFall
 
bool slowOgreSpit
 
bool smolstar
 
int snowBallLauncherInteractionCooldown
 
bool snowman
 
bool socialGhost
 
bool socialIgnoreLight
 
bool socialShadowRocketBoots
 
int solarCounter
 
bool solarDashConsumedFlare
 
bool solarDashing
 
bool solarMonolithShader
 
Vector2[] solarShieldPos = new Vector2[3]
 
int solarShields
 
Vector2[] solarShieldVel = new Vector2[3]
 
bool sonarPotion
 
int soulDrain
 
bool spaceGun
 
bool spawnMax
 
int SpawnX = -1
 
int SpawnY = -1
 
StatModifier specialistDamage = StatModifier.Default
 
float[] speedSlice = new float[60]
 
byte spelunkerTimer
 
int[] spI = new int[200]
 
bool spider
 
bool spiderArmor
 
bool spiderMinion
 
int spikedBoots
 Used by the Shoe Spikes and Climbing Claws to allow for holding onto walls (of tiles, not to be confused with actual walls).
Defaults to 0. Any value higher than 0 allows the player to wall-jump.
A value of 1 causes the player to slowly slide down them while holding onto them.
A value of 2 or more doesn't give this limitation, allowing the player to stay holding onto a wall indefinitely.
 
string[] spN = new string[200]
 
bool sporeSac
 
int[] spX = new int[200]
 
int[] spY = new int[200]
 
bool squashling
 
bool stairFall
 
int starCloakCooldown
 
Item starCloakItem
 
Item starCloakItem_beeCloakOverrideItem
 
Item starCloakItem_manaCloakOverrideItem
 
Item starCloakItem_starVeilOverrideItem
 
bool stardustDragon
 
bool stardustGuardian
 
bool stardustMinion
 
bool stardustMonolithShader
 
bool starving
 
DefenseStat statDefense
 The defense value of this player.
The Defense wiki pageteaches how player defense affects incoming damage alongside DefenseEffectiveness.
The value resets to 0 during Player.ResetEffects and is manipulated throughout Player.Update(int).
If the final value is needed, ModPlayer.PostUpdate or anytime later is the best place. As such it is not recommended to manipulate the value during PostUpdate or at any time later for compatibility. Failure to follow this guideline will result in inconsistent behavior.
Due to this field being a DefenseStat, modders can freely add, subtract, multiply, and divide the value. The final result will properly account for all modifications applied.

 
int statLife = 100
 The current health of this player. Capped at statLifeMax2.
If you increase this value, be sure to respect the cap. More...
 
int statLifeMax = 100
 The maximum health this player can have without adjustment.
You should not modify this value. If you need to increase max health for equipment, modify statLifeMax2. If you need to increase max health for a permanent stat boost, use ModPlayer.ModifyMaxStats(out StatModifier, out StatModifier).
 
int statLifeMax2 = 100
 The maximum health this player can have, adjusted by buffs and equipment.
 
int statMana
 The current mana of this player. Capped at statManaMax2.
If you increase this value, be sure to respect the cap. More...
 
int statManaMax
 The maximum mana this player can have without adjustment.
You should not modify this value. If you need to increase max mana for equipment, modify statManaMax2. If you need to increase max mana for a permanent stat boost, use ModPlayer.ModifyMaxStats(out StatModifier, out StatModifier).
 
int statManaMax2
 The maximum mana this player can have, adjusted by buffs and equipment.
 
float stealth = 1f
 
int stealthTimer
 
int step = -1
 
float stepSpeed = 1f
 
bool sticky
 
int stickyBreak
 
bool stinky
 
bool stoned
 
bool stormTiger
 
int stringColor
 
bool strongBees
 If true, then the bees created by honeyCombItem have a chance to be stronger.
 
byte suffocateDelay
 
bool suffocating
 
bool sunflower
 
bool suspiciouslookingTentacle
 
int swimTime
 
int tail = -1
 
int tankPet = -1
 
bool tankPetReset
 
int taxMoney
 
double taxTimer
 
int team
 
bool teleporting
 
int teleportStyle
 
float teleportTime
 
float thorns
 
bool tiki
 
PlayerInteractionAnchor tileEntityAnchor
 
bool tileInteractAttempted
 
bool tileInteractionHappened
 
float tileSpeed = 1f
 
int timeShimmering
 
int timeSinceLastDashStarted
 The amount of time that has passed, in ticks, since this player last performed a dash.
 
bool tipsy
 
int titaniumStormCooldown
 
bool tongued
 
int toolTime
 
float torchLuck
 
List< Point > TouchedTiles = new List<Point>()
 
float townNPCs
 The sum of the NPC.npcSlots of all town NPCs near this player.
If townNPCs > 2f, then this player is in a town.
 
float trackBoost
 
bool trapDebuffSource
 
Item trashItem = new Item()
 
bool treasureMagnet
 
bool trident
 
bool truffle
 
bool tryKeepingHoveringDown
 
bool tryKeepingHoveringUp
 
bool turtle
 
bool turtleArmor
 
bool turtleThorns
 
bool twinsMinion
 
bool UFOMinion
 
Color underShirtColor = new Color(160, 180, 215)
 
bool unlockedBiomeTorches
 
bool unlockedSuperCart
 If true, then this player has permanently buffed their minecarts. See UsingSuperCart for more info.
 
bool usedAegisCrystal
 
bool usedAegisFruit
 
bool usedAmbrosia
 
bool usedArcaneCrystal
 
bool usedGalaxyPearl
 
bool usedGummyWorm
 
bool vampireFrog
 
int vanityRocketBoots
 
bool venom
 
TrackedProjectileReference voidLensChest
 
BitsByte voidVaultInfo
 
bool volatileGelatin
 
int volatileGelatinCounter
 
bool vortexDebuff
 
bool vortexMonolithShader
 
bool vortexStealthActive
 
int waist = -1
 
float wallSpeed = 1f
 
bool waterWalk
 
bool waterWalk2
 
bool wearsRobe
 
bool webbed
 
bool wellFed
 
bool wereWolf
 
byte wetSlime
 
float whipRangeMultiplier
 
bool windPushed
 
float wingAccRunSpeed = -1f
 
int wingFrame
 
int wingFrameCounter
 
float wingRunAccelerationMult = 1f
 
int wings
 
int wingsLogic
 
float wingTime
 
int wingTimeMax
 
int wireOperationsCooldown
 
bool wisp
 
bool witheredArmor
 
bool witheredWeapon
 
bool wolfAcc
 
bool yoraiz0rDarkness
 
int yoraiz0rEye
 
bool yoyoGlove
 
bool yoyoString
 
bool zephyrfish
 
BitsByte zone1 = (byte)0
 
BitsByte zone2 = (byte)0
 
BitsByte zone3 = (byte)0
 
BitsByte zone4 = (byte)0
 
BitsByte zone5 = (byte)0
 
- Public Attributes inherited from Entity
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.
 
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
 
Vector2 oldPosition
 
Vector2 oldVelocity
 
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.
 

Static Public Attributes

static float airLightDecay = 1f
 
static int BlockInteractionWithProjectiles = 3
 
const int ChairSittingMaxDistance = 40
 
static int crystalLeafDamage = 100
 
static int crystalLeafKB = 10
 
static bool deadForGood = false
 
static float defaultGravity = 0.4f
 
const int defaultHeight = 42
 
static int defaultItemGrabRange = 42
 
const int defaultWidth = 20
 
const int fartKartCloudDelayMax = 20
 
static int FlexibleWandCycleOffset
 
static Point FlexibleWandLastPosition
 
static int FlexibleWandRandomSeed
 
const int InitialAccSlotCount = 5
 
static int jumpHeight = 15
 
static float jumpSpeed = 5.01f
 The speed, in pixels/tick, that this players jumps at.
 
static bool lastPound = true
 
const int LifeCrystalMax = 15
 The maximum amount of Life Crystals this player is allowed to consume total
 
const int LifeFruitMax = 20
 The maximum amount of Life Fruit this player is allowed to consume total
 
const int ManaCrystalMax = 9
 The maximum amount of Mana Crystals this player is allowed to consume total
 
static float manaSickLessDmg = 0.25f
 
static int manaSickTime = 300
 
static int manaSickTimeMax = 600
 
const int maxSolarShields = 3
 
const int miscSlotCart = 2
 
const int miscSlotHook = 4
 
const int miscSlotLight = 1
 
const int miscSlotMount = 3
 
const int miscSlotPet = 0
 
static int musicNotes = 6
 
static int nameLen = 20
 
const int nebulaMaxLevel = 3
 
static readonly float PhilosopherStoneDurationMultiplier = 0.75f
 
const int respawnTimerMax = 3600
 
const int SafeItemAnimationTimeForPreventingExploits = 20
 
const int shadowMax = 3
 
const int SHIELD_PARRY_DAMAGE_BUFF_MULTIPLIER = 5
 
const int SHIELD_PARRY_DURATION = 20
 
const int SHIELD_PARRY_DURATION_DRAWING_TWEAKER = 20
 
static float solidLightDecay = 1f
 
const int SupportedMiscSlotCount = 5
 
const int SupportedSlotsAccs = 7
 
const int SupportedSlotsArmor = 3
 
const int SupportedSlotSets = 10
 
static double taxRate = 3600
 
static int tileRangeX = 5
 
static int tileRangeY = 4
 
static int tileTargetX
 
static int tileTargetY
 

Properties

bool accFlipper [get, set]
 
bool[] adjTile [get, set]
 
bool AnyThrownCostReduction [get]
 Returns true if either ThrownCost33 or ThrownCost50 are true
 
Vector2 BlehOldPositionFixer [get]
 
int breathCDMax [get]
 
bool CanBeTalkedTo [get]
 
bool CCed [get]
 Checks if the player is currently "crowd controlled", meaning the player is frozen, webbed, or stoned. Used in various checks to prevent some player actions that shouldn't be possible while in those states, such as channeling attacks, quick using items, and swapping loadouts.
 
int ConsumedLifeCrystals [get, set]
 How many Life Crystals this player has consumed
 
int ConsumedLifeFruit [get, set]
 How many Life Fruit this player has consumed
 
int ConsumedManaCrystals [get, set]
 How many Mana Crystals this player has consumed
 
SceneEffectLoader.SceneEffectInstance CurrentSceneEffect = new SceneEffectLoader.SceneEffectInstance() [get, set]
 Container for current SceneEffect client properties such as: Backgrounds, music, and water styling
 
bool DeadOrGhost [get]
 
Vector2 DefaultSize [get]
 
Vector2 Directions [get]
 
Span< ExtraJumpStateExtraJumps [get]
 
Vector2? HandPosition [get]
 
bool HasMinionAttackTargetNPC [get]
 
bool HasMinionRestTarget [get]
 
int HeightMapOffset [get]
 
int HeightOffsetBoost [get]
 
float HeightOffsetHitboxCenter [get]
 
float HeightOffsetVisual [get]
 
Item HeldItem [get]
 
Rectangle HitboxForBestiaryNearbyCheck [get]
 
bool isLockedToATile [get]
 
bool IsStandingStillForSpecialEffects [get]
 
bool IsVoidVaultEnabled [get, set]
 
bool ItemAnimationActive [get]
 Returns true if an item animation is currently running.
 
bool ItemAnimationEndingOrEnded [get]
 Returns true if the item animation is on or after its last frame. Meaning it could (if the player clicks etc) start again next frame.
Vanilla uses it to despawn spears, but it's not recommended because it will desync in multiplayer
(a remote player could get the packet for a new projectile just as they're finishing a swing).
It is recommended to use ai counters for the lifetime of animation bound projectiles instead.
 
bool ItemAnimationJustStarted [get]
 Returns true if the item animation is in its first frame.
 
bool ItemTimeIsZero [get]
 
int ItemUsesThisAnimation [get]
 The number of times the item has been used/fired this animation (swing)
 
bool Male [get, set]
 
static int MaxBuffs [get]
 
float miscCounterNormalized [get]
 
RefReadOnlyArray< ModPlayerModPlayers [get]
 
Vector2 MountedCenter [get, set]
 Returns the player's center adjusted for mount and step stool usage. Typically used in conjunction with RotatedRelativePoint(Vector2, bool, bool) to retrieve a suitable position for positioning items and effects originating from the player.
 
bool MountFishronSpecial [get]
 
float MountXOffset [get]
 
Vector2? MouthPosition [get]
 
HashSet< int > NearbyModTorch = new HashSet<int>() [get]
 
float NormalizedLuck [get]
 
bool[] oldAdjTile [get, set]
 
bool PortalPhysicsEnabled [get]
 
bool sandStorm [get, set]
 
bool ShoppingZone_AnyBiome [get]
 
bool ShoppingZone_BelowSurface [get]
 
bool ShoppingZone_Forest [get]
 
bool ShouldFloatInWater [get]
 
bool ShouldNotDraw [get]
 
bool SlimeDontHyperJump [get]
 
int talkNPC [get]
 
NPC TalkNPC [get]
 The NPC instance the player is talking to, or null if talkNPC is -1
 
bool ThrownCost33 [get, set]
 If true, player has a 33% chance of not consuming the thrown item.
Only applies to consumable items and projectiles counted as the DamageClass.Throwing damage type.
Projectiles spawned from a player who holds such item will set Projectile.noDropItem to prevent duplication.
Stacks with ThrownCost50 multiplicatively
 
bool ThrownCost50 [get, set]
 If true, player has a 50% chance of not consuming the thrown item.
Only applies to consumable items counted as the DamageClass.Throwing damage type.
Projectiles spawned from a player who holds such item will set Projectile.noDropItem to prevent duplication.
Stacks with ThrownCost33 multiplicatively
 
float ThrownVelocity [get, set]
 Multiplier to shot projectile velocity before throwing. Result will be capped to 16f.
Only applies to items counted as the DamageClass.Throwing damage type
 
bool TileReplacementEnabled [get]
 
bool TryingToHoverDown [get]
 
bool TryingToHoverUp [get]
 
bool UsingBiomeTorches [get, set]
 
bool UsingSuperCart [get, set]
 If true, then any minecart (MountID.Sets.Cart) this player rides in will be significantly faster and fire lasers.
Cannot be true if unlockedSuperCart is false.
 
override Vector2 VisualPosition [get]
 
bool ZoneBeach [get, set]
 
bool ZoneCorrupt [get, set]
 
bool ZoneCrimson [get, set]
 
bool ZoneDesert [get, set]
 
bool ZoneDirtLayerHeight [get, set]
 If true, then this player is underground (Main.worldSurface) but above the Caverns layer (Main.rockLayer).
 
bool ZoneDungeon [get, set]
 
bool ZoneForest [get]
 Shorthand for More...
 
bool ZoneGemCave [get, set]
 
bool ZoneGlowshroom [get, set]
 
bool ZoneGranite [get, set]
 
bool ZoneGraveyard [get, set]
 
bool ZoneHallow [get, set]
 
bool ZoneHive [get, set]
 
bool ZoneJungle [get, set]
 
bool ZoneLihzhardTemple [get, set]
 
bool ZoneMarble [get, set]
 
bool ZoneMeteor [get, set]
 
bool ZoneNormalCaverns [get]
 Shorthand for More...
 
bool ZoneNormalSpace [get]
 Shorthand for More...
 
bool ZoneNormalUnderground [get]
 Shorthand for More...
 
bool ZoneOldOneArmy [get, set]
 
bool ZoneOverworldHeight [get, set]
 If true, then this player is above ground (Main.worldSurface) but not in space (ZoneSkyHeight).
 
bool ZonePeaceCandle [get, set]
 
bool ZonePurity = false [get, set]
 The zone property storing if the player is not in any particular biome. Updated in UpdateBiomes Does NOT account for height. Please use ZoneForest / ZoneNormalX for height based derivatives.
 
bool ZoneRain [get, set]
 
bool ZoneRockLayerHeight [get, set]
 If true, then this player is in the Caverns layer (Main.rockLayer) but not in the Underworld (Main.UnderworldLayer).
 
bool ZoneSandstorm [get, set]
 
bool ZoneShadowCandle [get, set]
 
bool ZoneShimmer [get, set]
 
bool ZoneSkyHeight [get, set]
 If true, then this player is the top 35% of the world.
NOTE: Vanilla uses a lot of different conditions for what counts as space. This flag is never used in vanilla, but the logic behind it is used for NPC shops and enemy spawns.
 
bool ZoneSnow [get, set]
 
bool ZoneTowerNebula [get, set]
 
bool ZoneTowerSolar [get, set]
 
bool ZoneTowerStardust [get, set]
 
bool ZoneTowerVortex [get, set]
 
bool ZoneUndergroundDesert [get, set]
 
bool ZoneUnderworldHeight [get, set]
 If true, then this player is in the Underworld (Main.UnderworldLayer).
 
bool ZoneWaterCandle [get, set]
 
- Properties inherited from Entity
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]
 
- Properties inherited from IEntityWithInstances< ModPlayer >
RefReadOnlyArray< T > Instances [get]
 

Member Function Documentation

◆ AddBuff()

void Player.AddBuff ( int  type,
int  timeToAdd,
bool  quiet = true,
bool  foodHack = false 
)

Gives the player the provided buff. This accounts for if the player is immune to the buff. This also accounts for adjusting the buff time for different game modes. If the player already has the buff, the re-apply logic will happen. Vanilla buff types are found in BuffID and modded buffs are typically retrieved using ModContent.BuffType<T>. The quiet parameter will determine if the network sync message should happen. This should only be set to false in non-deterministic situations (such as random chance) and code that only runs locally. Other situations run on all clients so the buff should automatically be applied on all clients, keeping the player buff data in sync without burdening the network. When in doubt, consult vanilla source code examples or test your code.
If applying a buff to a player other than the local player in pvp, quiet should be false and the buff must be true in Main.pvpBuff to properly sync.

Parameters
typeThe buff type
timeToAddThe desired buff time in ticks. 60 ticks is 1 second
quietIf true, the network sync message is skipped.
foodHackunused

◆ AddImmuneTime()

void Player.AddImmuneTime ( int  cooldownCounterId,
int  immuneTime 
)

Adds to either Player.immuneTime or Player.hurtCooldowns based on the cooldownCounterId

Parameters
cooldownCounterIdSee ImmunityCooldownID for valid ids.
immuneTimeExtra immunity time to add

◆ ApplyDamageToNPC()

void Player.ApplyDamageToNPC ( NPC  npc,
int  damage,
float  knockback,
int  direction,
bool  crit = false,
DamageClass damageType = null,
bool  damageVariation = false 
)

Deals damage to an NPC (and syncs the hit in multiplayer).
The damage will be affected by modifiers, armor pen, enemy resistances etc.
Will not apply damage class modifiers/knockback. Use GetTotalDamage<T> to adjust the damage before calling if necessary.
Will apply damage class based armor penetration.
Will exit early with no effect if PlayerLoader.CanHitNPC returns false.

Parameters
npcThe NPC to strike
damageThe damage to deal to the NPC, before modifications, defense, resistances etc
knockbackThe amount of knockback to apply
directionThe hit direction of the resulting strike (1 or -1)
critWhether or not the strike is a crit
damageTypeDefaults to DamageClass.Default
damageVariationWhether to apply damage variation. Defaults to false.

◆ BuffHandle_SpawnPetIfNeededAndSetTime()

void Player.BuffHandle_SpawnPetIfNeededAndSetTime ( int  buffIndex,
ref bool  petBool,
int  petProjID,
int  buffTimeToGive = 18000 
)

A helper method that handles code common to pet buffs. Can be used during the buff update code.
Sets the buff time to the value and spawns the corresponding pet projectile for the player if not yet spawned.

Parameters
buffIndex
petBool
petProjID
buffTimeToGive

◆ BuyItem()

bool Player.BuyItem ( long  price,
int  customCurrency = -1 
)

Attempts to "purchase" something that costs the given price .
Items will be taken from all of the player inventories and banks combined.
If customCurrency is provided, the price will be in terms of the custom currency instead of coins.
If the player has enough currency, the currency will be taken from the inventories.

Parameters
price
customCurrency
Returns
true if the player had enough currency to pay the price.

◆ ChangeDir()

void Player.ChangeDir ( int  dir)

Changes the player's direction (Entity.direction) while adjusting arm and item rotations to be consistent. Will also account for pulley and pulleyDir. The player direction change will be prevented if the player is on a rope but there isn't space for the player to face the new direction.

Parameters
dir

◆ CheckMana()

bool Player.CheckMana ( Item  item,
int  amount = -1,
bool  pay = false,
bool  blockQuickMana = false 
)

Determines if this player has enough mana to use an item.
If the player doesn't have enough mana and blockQuickMana is false, the player will activate any missing mana effects they have and try again.
The pay parameter can be used to consume the mana amount.

Parameters
itemThe item to use.
amountThe amount of mana needed. If -1, calculate using GetManaCost(Item).
payIf true, actually use the mana requested.
blockQuickManaIf true, prevent on missing mana effects like the Mana Flower from activating if the player doesn't have enough mana.
Returns
true if the player has enough mana to use the item, false otherwise.

◆ ChooseAmmo()

Item Player.ChooseAmmo ( Item  weapon)

Attempts to select an ammo item stack from this player's inventory to shoot with the given weapon.

Parameters
weaponThe weapon for which this call should try to find ammo.
Returns
Null if no suitable ammo is found; otherwise, returns the first ammo item found.

◆ ClearBuff()

void Player.ClearBuff ( int  type)

Removes the provided buff type from the player and shuffles the remaining buff indexes down to fill the gap. Use Player.DelBuff(int) if you only know the buff index

Parameters
typeThe buff type

◆ ConsumeItem()

bool Player.ConsumeItem ( int  type,
bool  reverseOrder = false,
bool  includeVoidBag = false 
)

Use to consume a single item. The item does not have to be Item.consumable.
Attempts to reduce the Item.stack of the first Item found in the inventory by 1.
Respects ItemLoader.ConsumeItem(Item, Player), so the item won't necessarily be consumed.
To consume multiple of the item, first check Player.CountItem to ensure that there are enough of the item, then use a for loop to call this method many times.

Parameters
typeThe item type to consume
reverseOrderIf true, the search for the item will start at the end of the player inventory
includeVoidBagIf true, the void bag, if open, will also be considered for finding an item to consume
Returns
True if the item was found and attempted to be consumed

◆ CountItem()

int Player.CountItem ( int  type,
int  stopCountingAt = 0 
)

Counts the total stack of the specified item type in this players inventory.
Does not check Void Bag.
Use Player.HasItem(int) to check if the player has the item at all.

Parameters
typeThe item type to count
stopCountingAtWhen to stop counting, useful to avoid unnecessary calculations
Returns
The total amount counted

◆ DelBuff()

void Player.DelBuff ( int  b)

Removes the buff at the provided index in buffType and buffTime and shuffles the remaining buff indexes down to fill the gap. Use Player.ClearBuff(int) if you only know the BuffID.

Parameters
bThe index in buffType of the buff to remove.

◆ GetAdjustedItemScale()

float Player.GetAdjustedItemScale ( Item  item)

Used to determine what the overall scale of an item should be.
CombinedHooks.ModifyItemScale is called here.

Parameters
itemThe item to fetch the adjusted scale of.
Returns
The final scale of the item, after the Titan Glove effect and all modded calculations.

◆ GetArmorPenetration< T >()

ref float Player.GetArmorPenetration< T > ( )

Gets the armor penetration modifier for this damage type on this player. This returns a reference, and as such, you can freely modify this method's return value with operators. Note that armor penetration value are typically whole numbers. Adding 5, for example, would add 5 to the armor penetration stat, similar to the Shark Tooth Necklace accessory.

Type Constraints
T :DamageClass 
T :ref 
T :GetArmorPenetration 
T :ModContent.GetInstance<T>() 

◆ GetAttackSpeed< T >()

ref float Player.GetAttackSpeed< T > ( )

Gets the attack speed modifier for this damage type on this player. This returns a reference, and as such, you can freely modify this method's return values with operators. Setting this such that it results in zero or a negative value will throw an exception. NOTE: Due to the nature of attack speed modifiers, modifications to Flat will do nothing for this modifier. Note that attack speed is a multiplier. Adding 0.15f, for example, would add 15% to the attack speed stat.

Type Constraints
T :DamageClass 
T :ref 
T :GetAttackSpeed 
T :ModContent.GetInstance<T>() 

◆ GetCritChance< T >()

ref float Player.GetCritChance< T > ( )

Gets the crit chance modifier for this damage type on this player. This returns a reference, and as such, you can freely modify this method's return value with operators. Note that crit values are percentage values ranging from 0 to 100, unlike damage multipliers. Adding 4, for example, would add 4% to the crit chance.

Type Constraints
T :DamageClass 
T :ref 
T :GetCritChance 
T :ModContent.GetInstance<T>() 

◆ GetDamage< T >()

Gets the damage modifier for this damage type on this player. This returns a reference, and as such, you can freely modify this method's return value with operators.

Type Constraints
T :DamageClass 
T :ref 
T :GetDamage 
T :ModContent.GetInstance<T>() 

◆ GetItemGrabRange()

int Player.GetItemGrabRange ( Item  item)

Fetches the range at which the given item begins to gravitate towards the player.
This range, referred to as item grab range, is measured in pixels.

Parameters
itemThe item whose grab range is being evaluated.
Returns
The item grab range of the player, in pixels.

◆ GetJumpState< T >() [1/2]

ref ExtraJumpState Player.GetJumpState< T > ( )
Type Constraints
T :ExtraJump 
T :ref 
T :GetJumpState 
T :ModContent.GetInstance<T>() 

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

ref ExtraJumpState Player.GetJumpState< T > ( baseInstance)
Type Constraints
T :ExtraJump 
T :ref 
T :extraJumps 
T :baseInstance.Type 

◆ GetKnockback< T >()

Gets the knockback modifier for this damage type on this player. This returns a reference, and as such, you can freely modify this method's return value with operators. Note that knockback values are multipliers. Adding 0.12f, for example, would add 12% to the knockback stat.

Type Constraints
T :DamageClass 
T :ref 
T :GetKnockback 
T :ModContent.GetInstance<T>() 

◆ GetManaCost()

int Player.GetManaCost ( Item  item)

Calculates the mana needed to use the given item.

Parameters
itemThe item to check.
Returns
The amount of mana needed to use item . Cannot be less than 0.

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

T Player.GetModPlayer< T > ( )

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

Exceptions
KeyNotFoundException
Exceptions
IndexOutOfRangeException
Type Constraints
T :ModPlayer 
T :GetModPlayer 
T :ModContent.GetInstance<T>() 

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

T Player.GetModPlayer< T > ( baseInstance)

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

Exceptions
KeyNotFoundException
Exceptions
IndexOutOfRangeException
Exceptions
NullReferenceException
Type Constraints
T :ModPlayer 
T :modPlayers 
T :baseInstance.Index 
T :as 
T :T 
T :throw 
T :new 
T :KeyNotFoundException 
T :$ 
T :Instance 
T :of 

◆ GetTotalArmorPenetration< T >()

float Player.GetTotalArmorPenetration< T > ( )
Type Constraints
T :DamageClass 
T :GetTotalArmorPenetration 
T :ModContent.GetInstance<T>() 

◆ GetTotalAttackSpeed< T >()

float Player.GetTotalAttackSpeed< T > ( )
Type Constraints
T :DamageClass 
T :GetTotalAttackSpeed 
T :ModContent.GetInstance<T>() 

◆ GetTotalCritChance< T >()

float Player.GetTotalCritChance< T > ( )
Type Constraints
T :DamageClass 
T :GetTotalCritChance 
T :ModContent.GetInstance<T>() 

◆ GetTotalDamage()

StatModifier Player.GetTotalDamage ( DamageClass  damageClass)

Calculates a total damage modifier for the player for the provided DamageClass.
Use in conjunction with StatModifier.ApplyTo(float) to calculate a final damage value for a given DamageClass and base damage: int finalDamage = (int)player.GetTotalDamage(item.DamageType).ApplyTo(30);

The modifiers calculated here are important due to the possibility of damage classes inheriting modifiers from other damage classes. For instance, an attack can be classified as multiple damage types and each could have different modifiers to apply to the damage

Parameters
damageClassThe DamageClass to use for total damage calculation
Returns
All modifiers combined

◆ GetTotalDamage< T >()

Type Constraints
T :DamageClass 
T :GetTotalDamage 
T :ModContent.GetInstance<T>() 

◆ GetTotalKnockback< T >()

StatModifier Player.GetTotalKnockback< T > ( )
Type Constraints
T :DamageClass 
T :GetTotalKnockback 
T :ModContent.GetInstance<T>() 

◆ HasAmmo()

bool Player.HasAmmo ( Item  sItem)

Whether or not the player has ammunition available for the given weapon.

Parameters
sItemThe weapon for which to try to find ammunition.
Returns
True if the player has ammo available; false otherwise.

◆ HasBuff< T >()

bool Player.HasBuff< T > ( )

Type Constraints
T :ModBuff 
T :HasBuff 
T :ModContent.BuffType<T>() 

◆ HasItem()

bool Player.HasItem ( int  type)

Checks if the player has the specified item in their inventory.
Does not check Void Bag.
Use Player.CountItem(int, int) instead to count the total amount if needed.

Parameters
typeThe item type to count
Returns
True if the player has the item

◆ Heal()

void Player.Heal ( int  amount)

Heals the player for a certain amount.

Parameters
amountThe amount to heal the player by.

◆ InModBiome()

bool Player.InModBiome ( ModBiome  baseInstance)

Determines if the player is in specified ModBiome. This will throw exceptions on failure.

Exceptions
IndexOutOfRangeException
Exceptions
NullReferenceException

◆ InModBiome< T >()

bool Player.InModBiome< T > ( )

Type Constraints
T :ModBiome 
T :InModBiome 
T :ModContent.GetInstance<T>() 

◆ IsAmmoFreeThisShot()

bool Player.IsAmmoFreeThisShot ( Item  weapon,
Item  ammo,
int  projToShoot 
)

Determines whether or not the given ammunition should be conserved, based on the given weapon as wielded by this player.

Parameters
weaponThe weapon attempting to consume the ammo.
ammoThe ammo attempting to be conserved (i.e. not consumed).
projToShootThe projectile that should be shot by the given weapon/ammo combination.
Returns
True if the ammo should be conserved on the given shot; false otherwise.

◆ OpenChest()

void Player.OpenChest ( int  x,
int  y,
int  newChest 
)

Handles boilerplate for gamepad and UI when opening or closing a container.
Sets Player.chestX, and Player.chestY, and Player.chest to the given coordinates.

Parameters
xThe top-left X coordinate of the container.
yThe top-left Y coordinate of the container.
newChestThe container index in Main.chest if opening, or -1 if closing.

◆ PickAmmo()

bool Player.PickAmmo ( Item  weapon,
out int  projToShoot,
out float  speed,
out int  damage,
out float  knockBack,
out int  usedAmmoItemId,
bool  dontConsume = false 
)

A more-convenient-to-call variant of the vanilla PickAmmo method, which handles most vanilla ammunition logic to decide various common stats related to ammunition-consuming weapons.
The stats output by this method take into account any extra stats which the ammunition it finds may provide (read: it accounts for ammo damage and knockback).

Parameters
weaponThe weapon for which to handle ammunition logic.
projToShootThe projectile that should be shot based on the given weapon and the located ammunition.
speedThe speed at which the projectile that would be made by the given weapon and located ammunition should move.
damageThe damage value that the projectile shot should have, based on the given weapon and the located ammunition.
knockBackThe knockback value that the projectile shot should have, based on the given weapon and the located ammunition.
usedAmmoItemIdThe numerical ID of the located ammunition.
dontConsumeWhether or not ammo consumption logic should be called upon.
This defaults to false, and if it is true for any reason, ammo will not be consumed at the end of the method.
This is useful for gathering the data needed based on PickAmmo's calculations without incidentally consuming any ammunition in the process.
Returns
True if ammo was found/chosen, and false otherwise.

◆ QuickSpawnClonedItem()

int Player.QuickSpawnClonedItem ( IEntitySource  source,
Item  item,
int  stack = 1 
)

Will spawn an item like Player.QuickSpawnItem(IEntitySource, int, int), but clones it (handy when you need to retain item infos)

Parameters
sourceThe spawn context
itemThe item you want to be cloned
stackThe stack to give the item. Note that this will override maxStack if it's higher.

◆ QuickSpawnClonedItemDirect()

Item Player.QuickSpawnClonedItemDirect ( IEntitySource  source,
Item  item,
int  stack = 1 
)

Returns
Returns the Item instance

◆ QuickSpawnItem()

int Player.QuickSpawnItem ( IEntitySource  source,
int  item,
int  stack = 1 
)

Spawns an item into the world at this players position. This is a simpler alternative to Item.NewItem(IEntitySource, int, int, int, int, int, int, bool, int, bool, bool). This method can be called from multiplayer client code without necessitating manually syncing the item.
Use QuickSpawnItem(IEntitySource, Item, int) if a specific instance of an Item needs to be spawned into the world to preserve modded data.

Parameters
source
item
stack
Returns
The index of the item within Main.item

◆ QuickSpawnItemDirect() [1/2]

Item Player.QuickSpawnItemDirect ( IEntitySource  source,
int  type,
int  stack = 1 
)

Returns
Returns the Item instance

◆ QuickSpawnItemDirect() [2/2]

Item Player.QuickSpawnItemDirect ( IEntitySource  source,
Item  item,
int  stack = 1 
)

Returns
Returns the Item instance

◆ RotatedRelativePoint()

Vector2 Player.RotatedRelativePoint ( Vector2  pos,
bool  reverseRotation = false,
bool  addGfxOffY = true 
)

Takes an input position and returns the position adjusted to the players visual rotation and offset. This accounts for the player being shifted up or down and rotated while riding a mount, sitting in a chair, and sleeping.

Parameters
pos
reverseRotation
addGfxOffY
Returns

◆ StopExtraJumpInProgress()

void Player.StopExtraJumpInProgress ( )

Cancels any extra jump in progress.
Sets all ExtraJumpState.Active flags to false and calls OnExtraJumpEnded hooks.
Also sets jump to 0 if a an extra jump was active.

Used by vanilla when performing an action which would cancel jumping, such as grappling, grabbing a rope or getting frozen.

To prevent the use of remaining jumps, use ConsumeAllExtraJumps or blockExtraJumps.
To cancel a regular jump as well, do Player.jump = 0;

◆ StrikeNPCDirect()

void Player.StrikeNPCDirect ( NPC  npc,
NPC.HitInfo  hit 
)

Applies a hit to an NPC via NPC.StrikeNPC(NPC.HitInfo, bool, bool).
Also calls player based OnHit and OnKill hooks, tracks dps and net syncs the strike

Parameters
npcThe NPC to strike
hitThe hit to apply

◆ TryGetModPlayer< T >() [1/2]

bool Player.TryGetModPlayer< T > ( out T  result)

Gets the instance of the specified ModPlayer type.

Type Constraints
T :ModPlayer 
T :TryGetModPlayer 
T :ModContent.GetInstance<T>() 
T :out 
T :result 

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

bool Player.TryGetModPlayer< T > ( baseInstance,
out T  result 
)

Safely attempts to get the local instance of the type of the specified ModPlayer instance.

Returns
Whether or not the requested instance has been found.
Type Constraints
T :ModPlayer 

Member Data Documentation

◆ extraFall

int Player.extraFall

The number of extra tiles this player can fall before they start taking fall damage.

If you want to prevent fall damage entirely, use noFallDmg.

◆ lifeRegenTime

float Player.lifeRegenTime

How effective this player's natural life regeneration should be. Resets whenever the player is hurt, increases over time.
Certain effects increase this value to increase

Use ModPlayer.NaturalLifeRegen(ref float) to directly modify natural life regeneration.

◆ Loadouts

EquipmentLoadout [] Player.Loadouts
Initial value:
= new EquipmentLoadout[3] {
}
Definition: EquipmentLoadout.cs:7

◆ maxRunSpeed

float Player.maxRunSpeed = 3f

The maximum speed, in pixels/tick, that this player can reach by just running.

To apply a global run speed modifier, use moveSpeed.

◆ runAcceleration

float Player.runAcceleration = 0.08f

The acceleration, in pixels/ticks^2, that this player experiences while running.

To apply a global run speed modifier, use moveSpeed.

◆ statLife

int Player.statLife = 100

The current health of this player. Capped at statLifeMax2.
If you increase this value, be sure to respect the cap.

If you want to heal the player with the green text effect, use Player.Heal(int).
If you want to hurt the player, use Hurt(PlayerDeathReason, int, int, bool, bool, int, bool, float, float, float).

◆ statMana

int Player.statMana

The current mana of this player. Capped at statManaMax2.
If you increase this value, be sure to respect the cap.

If you want to use mana, use Player.CheckMana(Item, int, bool, bool) or its overload.

Property Documentation

◆ ZoneForest

bool Player.ZoneForest
get

Shorthand for

ZonePurity && ZoneOverworldHeight

◆ ZoneNormalCaverns

bool Player.ZoneNormalCaverns
get

Shorthand for

ZonePurity && ZoneRockLayerHeight

◆ ZoneNormalSpace

bool Player.ZoneNormalSpace
get

Shorthand for

ZonePurity && ZoneSkyHeight

◆ ZoneNormalUnderground

bool Player.ZoneNormalUnderground
get

Shorthand for

ZonePurity && ZoneDirtLayerHeight