TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches
Terraria.Player Class Reference
+ Inheritance diagram for Terraria.Player:

Classes

class  BuilderAccToggleIDs
 
struct  ChannelCancelKey
 
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
 
struct  SpecialToolUsageSettings
 

Public Types

enum  CompositeArmStretchAmount { Full , None , Quarter , ThreeQuarters }
 

Public Member Functions

delegate void DashStartAction (int dashDirection)
 
void RotateRelativePoint (ref float x, ref float y)
 
Vector2 RotatedRelativePointOld (Vector2 pos, bool rotateForward=true)
 
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.

 
bool CanDemonHeartAccessoryBeShown ()
 
bool CanMasterModeAccessoryBeShown ()
 
int GetAmountOfExtraAccessorySlotsToShow ()
 
EntityShadowInfo GetAdvancedShadow (int shadowIndex)
 
void UpdateAdvancedShadows ()
 
void ResetAdvancedShadows ()
 
void SetCompositeArmFront (bool enabled, CompositeArmStretchAmount stretch, float rotation)
 
void SetCompositeArmBack (bool enabled, CompositeArmStretchAmount stretch, float rotation)
 
void SetTalkNPC (int npcIndex, bool fromNet=false)
 
void SetItemTime (int frames)
 
void ApplyItemTime (Item sItem, float multiplier=1f, bool? callUseItem=null)
 
void SetDummyItemTime (int frames)
 
void SetItemAnimation (int frames)
 
void ApplyItemAnimation (Item sItem)
 
void ApplyItemAnimation (Item sItem, float multiplier, int? itemReuseDelay=null)
 
void MatchItemTimeToItemAnimation ()
 
bool InOpposingTeam (Player otherPlayer)
 
bool TeamChangeAllowed ()
 
void HealEffect (int healAmount, bool broadcast=true)
 Spawns a T:Terraria.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 M:Terraria.Player.Heal(System.Int32) method heals the player and calls this method and is more commonly used.
 
void ManaEffect (int manaAmount)
 
void InterruptItemUsageIfOverTile (int tileTypeToBeOver)
 
Vector2 GetHairDrawOffset (int hairID, bool hatHair)
 
Vector2 GetHelmetDrawOffset ()
 
Vector2 GetBeardDrawOffsetFromHelmet ()
 
Vector2 GetFaceHeadOffsetFromHelmet ()
 
Vector2 GetHelmetOffsetAddonFromFaceHead (Vector2 headOffset)
 
Vector2 GetLegsDrawOffset ()
 
void AccumulateGolfingScore (int score)
 
void ToggleInv ()
 
void ToggleCreativeMenu ()
 
void dropItemCheck ()
 
void DropSelectedItem ()
 
void DropSelectedItem (int slot, ref Item theItemWeDrop)
 
void PlayDroppedItemAnimation (int time)
 
int FindBuffIndex (int type)
 
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 T:Terraria.ID.BuffID and modded buffs are typically retrieved using M:Terraria.ModLoader.ModContent.BuffType``1. 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 F:Terraria.Main.pvpBuff to properly sync.
 
void DelBuff (int b)
 Removes the buff at the provided index in F:Terraria.Player.buffType and F:Terraria.Player.buffTime and shuffles the remaining buff indexes down to fill the gap. Use M:Terraria.Player.ClearBuff(System.Int32) if you only know the T:Terraria.ID.BuffID.
 
void ClearBuff (int type)
 Removes the provided buff type from the player and shuffles the remaining buff indexes down to fill the gap. Use M:Terraria.Player.DelBuff(System.Int32) if you only know the buff index.
 
int CountBuffs ()
 
void QuickHeal ()
 
Item QuickHeal_GetItemToUse ()
 
void QuickMana ()
 
Item QuickMana_GetItemToUse ()
 
void TrySwitchingLoadout (int loadoutIndex)
 
void QuickBuff ()
 
void QuickMount ()
 
bool CanFitSpace (int heightBoost)
 
Item QuickMount_GetItemToUse ()
 
void ClearGrapplingBlacklist ()
 
bool IsBlacklistedForGrappling (Point p)
 
void UpdateBlacklistedTilesForGrappling ()
 
void QuickGrapple ()
 
Item QuickGrapple_GetItemToUse ()
 
void StatusToNPC (int type, int i)
 
void StatusToPlayerPvP (int type, int i)
 
void Ghost ()
 
void OnHit (float x, float y, Entity victim)
 
void OpenPresent (int itemType)
 
void OpenLegacyPresent (int itemType)
 
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 M:Terraria.Item.NewItem(Terraria.DataStructures.IEntitySource,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Boolean,System.Int32,System.Boolean,System.Boolean). This method can be called from multiplayer client code without necessitating manually syncing the item.
Use M:Terraria.Player.QuickSpawnItem(Terraria.DataStructures.IEntitySource,Terraria.Item,System.Int32) if a specific instance of an Item needs to be spawned into the world to preserve modded data.
 
void OpenBossBag (int type)
 
void TryGettingDevArmor (IEntitySource source)
 
void OpenFishingCrate (int crateItemID)
 
int CountItem (int type, int stopCountingAt=0)
 Counts the total stack of the specified item type in this players F:Terraria.Player.inventory.
Does not check Void Bag.
Use M:Terraria.Player.HasItem(System.Int32) to check if the player has the item at all.

 
bool ConsumeItem (int type, bool reverseOrder=false, bool includeVoidBag=false)
 Use to consume a single item. The item does not have to be F:Terraria.Item.consumable.
Attempts to reduce the F:Terraria.Item.stack of the first T:Terraria.Item found in the F:Terraria.Player.inventory by 1.
Respects M:Terraria.ModLoader.ItemLoader.ConsumeItem(Terraria.Item,Terraria.Player), so the item won't necessarily be consumed.
To consume multiple of the item, first check M:Terraria.Player.CountItem(System.Int32,System.Int32) to ensure that there are enough of the item, then use a for loop to call this method many times.

 
void OpenShadowLockbox (int boxType)
 
void OpenLockBox (int lockboxItemType)
 
void OpenHerbBag (int bagType)
 
void OpenCanofWorms (int sourceItemType)
 
void OpenOyster (int sourceItemType)
 
void OpenGoodieBag (int itemType)
 
void UpdateDyes ()
 
int ArmorSetDye ()
 
IEntitySource GetSource_Buff (int buffIndex)
 
void UpdateBuffs (int i)
 
void TryToResetHungerToNeutral ()
 
void UpdateHungerBuffs ()
 
void UpdateStarvingState (bool withEmote)
 
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.

 
void BuffHandle_SpawnPetIfNeeded (ref bool petBool, int petProjID, int buffIndex)
 
void Counterweight (Vector2 hitPos, int dmg, float kb)
 
int beeType ()
 
int beeDamage (int dmg)
 
float beeKB (float KB)
 
void Yoraiz0rEye ()
 
bool IsItemSlotUnlockedAndUsable (int slot)
 
void RefreshInfoAccs ()
 
void RefreshInfoAccsFromTeamPlayers ()
 
void RefreshInfoAccsFromItemType (Item item)
 
void RefreshMechanicalAccsFromItemType (int accType)
 
void UpdatePermanentBoosters ()
 
void UpdateEquips (int i)
 
void GrantArmorBenefits (Item armorPiece)
 
void GrantPrefixBenefits (Item item)
 
void DoBootsEffect (Utils.TileActionAttempt theEffectMethod)
 
bool DoBootsEffect_PlaceFlamesOnTile (int X, int Y)
 
bool DoBootsEffect_PlaceFlowersOnTile (int X, int Y)
 
void ApplyEquipVanity (Item currentItem)
 
WingStats GetWingStats (int wingID)
 
void ApplyEquipFunctional (Item currentItem, bool hideVisual)
 
void UpdateArmorSets (int i)
 
void UpdateSocialShadow ()
 
void UpdateTeleportVisuals ()
 
void ForceUpdateBiomes ()
 
bool CanSeeShimmerEffects ()
 
void UpdateBiomes ()
 
void ManageSpecialBiomeVisuals (string biomeName, bool inZone, Vector2 activationSource=default(Vector2))
 
void GetHairSettings (out bool fullHair, out bool hatHair, out bool hideHair, out bool backHairDraw, out bool drawsBackHairWithoutHeadgear)
 
void UpdateDead ()
 
void UpdatePet (int i)
 
void UpdatePetLight (int i)
 
void TogglePet ()
 
void ToggleLight ()
 
bool IsWithinSnappngRangeToTile (int x, int y, int distanceInPixels)
 
void SmartInteractLookup ()
 
void SmartSelectLookup ()
 
void AddCoinLuck (Vector2 coinPosition, int coinAmount)
 
int RollLuck (int range)
 
void ResetEffects ()
 
void UpdateImmunity ()
 
void UpdateLifeRegen ()
 
void UpdateManaRegen ()
 
void UpdateJumpHeight ()
 
void FindPulley ()
 
void HorizontalMovement ()
 
int CollideWithNPCs (Rectangle myRect, float Damage, float Knockback, int NPCImmuneTime, int PlayerImmuneTime, DamageClass? damageType=null)
 
void ApplyBannerOffenseBuff (NPC npc, ref NPC.HitModifiers modifiers)
 
void ApplyBannerOffenseBuff (int bannerId, ref NPC.HitModifiers modifiers)
 
void ApplyBannerDefenseBuff (NPC npc, ref HurtModifiers modifiers)
 
void ApplyBannerDefenseBuff (int bannerId, ref HurtModifiers 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 M:Terraria.Player.GetTotalDamage``1 to adjust the damage before calling if necessary.
Will apply damage class based armor penetration.
Will exit early with no effect if M:Terraria.ModLoader.PlayerLoader.CanHitNPC(Terraria.Player,Terraria.NPC) returns false.
 
void StrikeNPCDirect (NPC npc, NPC.HitInfo hit)
 Applies a hit to an NPC via M:Terraria.NPC.StrikeNPC(Terraria.NPC.HitInfo,System.Boolean,System.Boolean).
Also calls player based OnHit and OnKill hooks, tracks dps and net syncs the strike.
 
void OnKillNPC (ref NPCKillAttempt attempt, object externalKillingBlowSource)
 
void GiveImmuneTimeForCollisionAttack (int time)
 
bool CanNPCBeHitByPlayerOrPlayerProjectile (NPC npc, Projectile projectile=null)
 
void JumpMovement ()
 
void DashMovement ()
 
void WallslideMovement ()
 
void CarpetMovement ()
 
void DoubleJumpVisuals ()
 
void WingMovement ()
 
void MoonLeechRope ()
 
void WOFTongue ()
 
void StatusFromNPC (NPC npc)
 
void GrappleMovement ()
 
void DoQueenSlimeHookTeleport (Vector2 targetPosition)
 
void RefreshMovementAbilities (bool doubleJumps=true)
 
void RefreshExtraJumps ()
 For each extra jump that is P:Terraria.DataStructures.ExtraJumpState.Enabled, its P:Terraria.DataStructures.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 ConsumeAllExtraJumps ()
 Sets the P:Terraria.DataStructures.ExtraJumpState.Available flag for all extra jumps to false.
If you want to disable an extra jump, use M:Terraria.DataStructures.ExtraJumpState.Disable instead.
If you want to disable all extra jumps, but not prevent them once the disabling factor is removed, use F:Terraria.Player.blockExtraJumps instead.
 
void StickyMovement ()
 
bool HasLockedInventory ()
 
bool IsStackingItems ()
 
List< int > GetNearbyContainerProjectilesList ()
 
void UpdateNearbyInteractibleProjectilesList ()
 
bool IsProjectileInteractibleAndInInteractionRange (Projectile proj, ref Vector2 compareSpot)
 
bool useVoidBag ()
 
void QuickStackAllChests ()
 
void CheckDrowning ()
 
void CheckCrackedBrickBreak ()
 
void CheckIceBreak ()
 
void SlopeDownMovement ()
 
void ShimmerCollision (bool fallThrough, bool ignorePlats, bool noCollision)
 
void HoneyCollision (bool fallThrough, bool ignorePlats)
 
void WaterCollision (bool fallThrough, bool ignorePlats)
 
void DryCollision (bool fallThrough, bool ignorePlats)
 
void SlopingCollision (bool fallThrough, bool ignorePlats)
 
void FloorVisuals (bool Falling)
 
void ResetFloorFlags ()
 
void BordersMovement ()
 
void CollectTaxes ()
 
void GamepadEnableGrappleCooldown ()
 
void TryInterruptingItemUsage ()
 
void UpdateHairDyeDust ()
 
void Update (int i)
 
void UpdateLuck ()
 
void TryOpeningFullscreenMap ()
 
void UpdateLuckFactors ()
 
void RecalculateLuck ()
 
void UpdateMiscCounter ()
 
void WingFrame (bool wingFlap, bool isCustomWings=false)
 
bool ShouldDrawWingsThatAreAlwaysAnimated ()
 
bool IsInInteractionRangeToMultiTileHitbox (int chestPointX, int chestPointY)
 
void ResetVisibleAccessories ()
 
void UpdateArmorLights ()
 
void Update_NPCCollision ()
 
bool CanParryAgainst (Rectangle blockingPlayerRect, Rectangle enemyRect, Vector2 enemyVelocity)
 
void ItemCheck_ManageRightClickFeatures ()
 
void ItemCheck_ManageRightClickFeatures_ShieldRaise (bool theGeneralCheck)
 
void TryTogglingShield (bool shouldGuard)
 
void ScrollHotbar (int Offset)
 
List< int > GetListOfProjectilesToInteractWithHack ()
 
void LockGamepadTileInteractions ()
 
void LookForTileInteractions ()
 
bool InInteractionRange (int interactX, int interactY, TileReachCheckSettings settings)
 
bool IsInTileInteractionRange (int targetX, int targetY, TileReachCheckSettings settings)
 
void TileInteractionsCheck (int myX, int myY)
 
void PetAnimal (int animalNpcIndex)
 
bool CanSnapToPosition (Vector2 offset)
 
void StopVanityActions (bool multiplayerBroadcast=true)
 
void OpenChest (int x, int y, int newChest)
 Handles boilerplate for gamepad and UI when opening or closing a container.
Sets F:Terraria.Player.chestX, and F:Terraria.Player.chestY, and F:Terraria.Player.chest to the given coordinates.
 
void CloseSign ()
 
void RemoveAllGrapplingHooks ()
 
void RemoveAllFishingBobbers ()
 
Color ChatColor ()
 
bool CanAcceptItemIntoInventory (Item item)
 
void Heal (int amount)
 Heals the player for a certain amount.
 
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.
 
bool SellItem (Item item, int stack=-1)
 
void RefreshItems (bool onlyIfVariantChanged=true)
 
void GetItemExpectedPrice (Item item, out long calcForSelling, out long calcForBuying)
 
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.

 
bool CanAfford (long price, int customCurrency=-1)
 
bool PayCurrency (long price, int customCurrency=-1)
 
void AdjTiles ()
 
bool IsTileTypeInInteractionRange (int targetTileType, TileReachCheckSettings settings)
 
void DisplayDollUpdate ()
 
bool IsColorfulDye (int dye)
 
bool ShouldDrawFootball ()
 
void PlayerFrame ()
 
bool ItemIsVisuallyIncompatible (Item item)
 
void UpdateVisibleAccessory (int itemSlot, Item item, bool modded=false)
 
void SetArmorEffectVisuals (Player drawPlayer)
 
void Teleport (Vector2 newPos, int Style=0, int extraInfo=0)
 
void DoPotionOfReturnTeleportationAndSetTheComebackPoint ()
 
void DoPotionOfReturnReturnToOriginalUsePosition ()
 
void AutoFinchStaff ()
 
void Spawn (PlayerSpawnContext context)
 
bool Spawn_GetPositionAtWorldSpawn (ref int floorX, ref int floorY)
 
void SetImmuneTimeForAllTypes (int time)
 
void ShadowDodge ()
 
void BrainOfConfusionDodge ()
 
void NinjaDodge ()
 
void ApplyArmorSoundAndDustChanges ()
 
double Hurt (PlayerDeathReason damageSource, int Damage, int hitDirection, bool pvp=false, bool quiet=false, int cooldownCounter=-1, bool dodgeable=true, float armorPenetration=0f, float scalingArmorPenetration=0f, 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=0f, float scalingArmorPenetration=0f, float knockback=4.5f)
 
void Hurt (HurtInfo info, bool quiet=false)
 
void KillMeForGood ()
 
void KillMe (PlayerDeathReason damageSource, double dmg, int hitDirection, bool pvp=false)
 
void DropTombstone (long coinsOwned, NetworkText deathText, int hitDirection)
 
bool CanPullItem (Item item, ItemSpaceStatus status)
 
ItemSpaceStatus ItemSpace (Item newItem)
 
bool ItemSpaceForCofveve (Item newItem)
 
bool CanItemSlotAccept (Item theSlot, Item theItemToAccept)
 
bool CanGoIntoAmmoOnPickup (Item theSlot, Item theItemToAccept)
 
void DoCoins (int i)
 
Item FillAmmo (int plr, Item newItem, GetItemSettings settings)
 
Item GetItem (int plr, Item newItem, GetItemSettings settings)
 
void PlaceThing (ref ItemCheckContext context)
 
Item GetBestPickaxe ()
 
void PlaceThing_Tiles_PlaceIt_ConsumeFlexibleWandMaterial ()
 
int BiomeTorchPlaceStyle (ref int type, ref int style)
 
int BiomeTorchHoldStyle (int style)
 
int BiomeCampfirePlaceStyle (ref int type, ref int style)
 
int BiomeCampfireHoldStyle (int itemType)
 
Item FindPaintOrCoating ()
 
void ChangeDir (int dir)
 
Rectangle getRect ()
 
void HorsemansBlade_SpawnPumpkin (int npcIndex, int dmg, float kb)
 
void PutItemInInventoryFromItemUsage (int type, int theSelectedItem=-1)
 
bool SummonItemCheck (Item item)
 
PlayerFishingConditions GetFishingConditions ()
 
bool HasUnityPotion ()
 
void TakeUnityPotion ()
 
void UnityTeleport (Vector2 telePos)
 
void SporeSac (Item sourceItem)
 
void VolatileGelatin (Item sourceItem)
 
bool CanHit (Entity ent)
 
Rectangle GetItemDrawFrame (int type)
 
float GetAdjustedItemScale (Item item)
 Used to determine what the overall scale of an item should be.
M:Terraria.ModLoader.CombinedHooks.ModifyItemScale(Terraria.Player,Terraria.Item,System.Single@) is called here.
 
void ApplyMeleeScale (ref float scale)
 
Vector2 ApplyRangeCompensation (float rangeCompensation, Vector2 startPos, Vector2 targetPos)
 
void ItemCheck ()
 
bool HasNPCBannerBuff (int bannerType)
 
void ResetMeleeHitCooldowns ()
 
void UpdateMeleeHitCooldowns ()
 
bool CanHitNPCWithMeleeHit (int npcIndex)
 
void SetMeleeHitCooldown (int npcIndex, int timeInFrames)
 
void TakeDamageFromJellyfish (int npcIndex)
 
void ApplyAttackCooldown ()
 
void ApplyAttackCooldown (int frames)
 
bool[] GetTileCutIgnorance (bool allowRegrowth, bool fromTrap)
 
void UseManaMaxIncreasingItem (int increase)
 
void UseHealthMaxIncreasingItem (int increase)
 
void LimitPointToPlayerReachableArea (ref Vector2 pointPoisition)
 
void PickWall (int x, int y, int damage)
 
bool IsTargetTileInItemRange (Item sItem)
 
void PlayGuitarChord (float range)
 
void PlayDrums (float range)
 
bool CanDoWireStuffHere (int x, int y)
 
Vector2 GetFarthestSpawnPositionOnLine (Vector2 startPos, float speedX, float speedY)
 
int SpawnMinionOnCursor (IEntitySource projectileSource, int ownerIndex, int minionProjectileId, int originalDamageNotScaledByMinionDamage, float KnockBack, Vector2 offsetFromCursor=default(Vector2), Vector2 velocityOnSpawn=default(Vector2))
 
bool TryPlacingAGolfBallNearANearbyTee (Vector2 placePosition)
 
void GetPreferredGolfBallToUse (out int projType)
 
bool CanVisuallyHoldItem (Item item)
 
Vector2 GetFrontHandPosition (CompositeArmStretchAmount stretch, float rotation)
 
Vector2 GetBackHandPosition (CompositeArmStretchAmount stretch, float rotation)
 
void ItemCheck_ApplyUseStyle (float mountOffset, Item sItem, Rectangle heldItemFrame)
 
void FlipItemLocationAndRotationForGravity ()
 
bool CanAutoReuseItem (Item sItem)
 
void StartChanneling ()
 
void StartChanneling (Item item)
 
void TryUpdateChannel (Projectile projectile)
 
void TryCancelChannel (Projectile projectile)
 
void FindSentryRestingSpot (int checkProj, out int worldX, out int worldY, out int pushYUp)
 
void UpdateMaxTurrets ()
 Kills F:Terraria.Projectile.sentry projectiles exceeding the players current F:Terraria.Player.maxTurrets. The oldest projectiles, determined by F:Terraria.Projectile.timeLeft, are killed.
Call this method immediately after spawning a F:Terraria.Projectile.sentry projectile.

 
float GetWeaponKnockback (Item sItem)
 
float GetWeaponKnockback (Item sItem, float baseKnockback)
 
int GetWeaponCrit (Item sItem)
 
int GetWeaponDamage (Item sItem, bool forTooltip=false)
 
bool HasAmmo (Item sItem)
 Whether or not the player has ammunition available for the given weapon.
 
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).

 
Item ChooseAmmo (Item weapon)
 Attempts to select an ammo item stack from this player's inventory to shoot with the given weapon.
 
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.
 
void GetOtherPlayersPickTile (int x, int y, int pickDamage)
 
void PickTile (int x, int y, int pickPower)
 
bool isNearFairy ()
 
bool isNearNPC (int type, float range=-1f)
 
bool HasEnoughPickPowerToHurtTile (int x, int y)
 
bool ItemFitsWeaponRack (Item i)
 
void PlaceWeapon (int x, int y)
 
bool ItemFitsItemFrame (Item i)
 
Color GetImmuneAlpha (Color newColor, float alphaReduction)
 
Color GetImmuneAlphaPure (Color newColor, float alphaReduction)
 
Color GetDeathAlpha (Color newColor)
 
void addDPS (int dmg)
 
void checkDPSTime ()
 
int getDPS ()
 
long DropCoins ()
 
void DropItems ()
 
void TryDroppingSingleItem (IEntitySource source, Item theItem)
 
object Clone ()
 
void CopyVisuals (Player other)
 
Player clientClone ()
 
void FindSpawn ()
 
void RemoveSpawn ()
 
void ChangeSpawn (int x, int y)
 
void SetPlayerDataToOutOfClassFields ()
 
Player SerializedClone ()
 
void FixLoadedData ()
 
Color GetHairColor (bool useLighting=true)
 
bool HasItem (int type)
 Checks if the player has the specified item in their F:Terraria.Player.inventory.
Does not check Void Bag.
Use M:Terraria.Player.CountItem(System.Int32,System.Int32) instead to count the total amount if needed.

 
bool HasItem (int type, Item[] collection)
 Similar to M:Terraria.Player.HasItem(System.Int32), but checks the provided Item[] collection for items instead. Useful for checking other Item arrays, such as F:Terraria.Player.armor or F:Terraria.Player.bank.
 
bool HasItemInInventoryOrOpenVoidBag (int type)
 Similar to M:Terraria.Player.HasItem(System.Int32), but also checks the Void Bag.
 
bool HasItemInAnyInventory (int type)
 
int FindItem (int netid)
 
int FindItem (List< int > netids)
 
int FindItem (bool[] validtypes)
 
int FindItem (int type, Item[] collection)
 
int FindItemInInventoryOrOpenVoidBag (int type, out bool inVoidBag)
 
 Player ()
 
void MagicConch ()
 
void Shellphone_Spawn ()
 
void DemonConch ()
 
void TeleportationPotion ()
 
Vector2 CheckForGoodTeleportationSpot (ref bool canSpawn, int teleportStartX, int teleportRangeX, int teleportStartY, int teleportRangeY, RandomTeleportationAttemptSettings settings)
 
void GetAnglerReward (NPC angler, int questItemType)
 
bool DropAnglerAccByMissing (List< int > itemIdsOfAccsWeWant, float totalChance, out bool botheredRollingForADrop, out int itemIdToDrop)
 
void GetDyeTraderReward (NPC dyeTrader)
 
bool CheckMana (int amount, bool pay=false, bool blockQuickMana=false)
 
void TryPortalJumping ()
 
bool ConsumeSolarFlare ()
 
void KeyDoubleTap (int keyDir)
 
void UpdateForbiddenSetLock ()
 
void CommandForbiddenStorm ()
 
void KeyHoldDown (int keyDir, int holdTime)
 
void MinionNPCTargetAim (bool doNotDisableIfTheTargetIsTheSame)
 
void MinionRestTargetAim ()
 
void UpdateMinionTarget ()
 
void NebulaLevelup (int type)
 
void UpdateTouchingTiles ()
 
GetModPlayer< T > ()
 Gets the instance of the specified ModPlayer type. This will throw exceptions on failure.
 
GetModPlayer< T > (T baseInstance)
 Gets the local instance of the type of the specified ModPlayer instance. This will throw exceptions on failure.
 
bool TryGetModPlayer< T > (out T result)
 Gets the instance of the specified ModPlayer type.
 
bool TryGetModPlayer< T > (T baseInstance, out T result)
 Safely attempts to get the local instance of the type of the specified ModPlayer instance.
 
void DropFromItem (int itemType)
 
int QuickSpawnClonedItem (IEntitySource source, Item item, int stack=1)
 Will spawn an item like M:Terraria.Player.QuickSpawnItem(Terraria.DataStructures.IEntitySource,System.Int32,System.Int32), but clones it (handy when you need to retain item infos)
 
int QuickSpawnItem (IEntitySource source, Item item, int stack=1)
 
Item QuickSpawnClonedItemDirect (IEntitySource source, Item item, int stack=1)
 
Item QuickSpawnItemDirect (IEntitySource source, Item item, int stack=1)
 
Item QuickSpawnItemDirect (IEntitySource source, int type, int stack=1)
 
bool HasBuff (int type)
 Returns whether or not this Player currently has a (de)buff of the provided type.
 
bool HasBuff< T > ()
 
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.
 
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 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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
StatModifier GetTotalDamage< T > ()
 
StatModifier GetTotalDamage (DamageClass damageClass)
 Calculates a total damage modifier for the player for the provided T:Terraria.ModLoader.DamageClass.
Use in conjunction with M:Terraria.ModLoader.StatModifier.ApplyTo(System.Single) to calculate a final damage value for a given T:Terraria.ModLoader.DamageClass and base damage: int finalDamage = (int)player.GetTotalDamage(item.DamageType).ApplyTo(30);
 
float GetTotalCritChance< T > ()
 
float GetTotalCritChance (DamageClass damageClass)
 
float GetTotalAttackSpeed< T > ()
 
float GetTotalAttackSpeed (DamageClass damageClass)
 
float GetTotalArmorPenetration< T > ()
 
float GetTotalArmorPenetration (DamageClass damageClass)
 
StatModifier GetTotalKnockback< T > ()
 
StatModifier GetTotalKnockback (DamageClass damageClass)
 
int GetWeaponArmorPenetration (Item sItem)
 
float GetWeaponAttackSpeed (Item sItem)
 
bool InModBiome (ModBiome baseInstance)
 Determines if the player is in specified ModBiome. This will throw exceptions on failure.
 
bool InModBiome< T > ()
 
bool InZonePurity ()
 Calculates whether or not the player is in the purity/forest biome.
 
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 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.
 
int GetHealLife (Item item, bool quickHeal=false)
 
int GetHealMana (Item item, bool quickHeal=false)
 
int GetManaCost (Item item)
 Calculates the mana needed to use the given item.
 
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.
 
void AddImmuneTime (int cooldownCounterId, int immuneTime)
 Adds to either Player.immuneTime or Player.hurtCooldowns based on the cooldownCounterId.
 
ref ExtraJumpState GetJumpState< T > (T baseInstance)
 
ref ExtraJumpState GetJumpState< T > ()
 
bool AnyExtraJumpUsable ()
 Returns true if any extra jump is P:Terraria.DataStructures.ExtraJumpState.Available and M:Terraria.ModLoader.ExtraJump.CanStart(Terraria.Player).
Setting F:Terraria.Player.blockExtraJumps will cause this method to return false instead.
 
void StopExtraJumpInProgress ()
 Cancels any extra jump in progress.
Sets all P:Terraria.DataStructures.ExtraJumpState.Active flags to false and calls OnExtraJumpEnded hooks.
Also sets F:Terraria.Player.jump to 0 if a an extra jump was active.


 
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_OnHurt (PlayerDeathReason damageSource, string? context=null)
 
IEntitySource GetSource_OpenItem (int itemType, string? context=null)
 
IEntitySource GetSource_ItemUse (Item item, string? context=null)
 
IEntitySource GetSource_ItemUse_WithPotentialAmmo (Item item, int ammoItemId, string? context=null)
 
float AngleTo (Vector2 Destination)
 
float AngleFrom (Vector2 Source)
 
float Distance (Vector2 Other)
 
float DistanceSQ (Vector2 Other)
 
Vector2 DirectionTo (Vector2 Destination)
 
Vector2 DirectionFrom (Vector2 Source)
 
bool WithinRange (Vector2 Target, float MaxRange)
 
IEntitySource GetSource_FromThis (string? context=null)
 
IEntitySource GetSource_FromAI (string? context=null)
 
IEntitySource GetSource_DropAsItem (string? context=null)
 
IEntitySource GetSource_Loot (string? context=null)
 
IEntitySource GetSource_GiftOrReward (string? context=null)
 
IEntitySource GetSource_OnHit (Entity victim, string? context=null)
 
IEntitySource GetSource_OnHurt (Entity? attacker, string? context=null)
 
IEntitySource GetSource_Death (string? context=null)
 
IEntitySource GetSource_Misc (string context)
 
IEntitySource GetSource_TileInteraction (int tileCoordsX, int tileCoordsY, string? context=null)
 
IEntitySource GetSource_ReleaseEntity (string? context=null)
 
IEntitySource GetSource_CatchEntity (Entity caughtEntity, string? context=null)
 

Static Public Member Functions

static byte FindClosest (Vector2 Position, int Width, int Height)
 
static float GetClosestPlayersLuck (Point Position)
 
static float GetClosestPlayersLuck (Vector2 Position)
 
static float GetClosestRollLuck (Vector2 position, int range)
 
static float GetClosestRollLuck (int x, int y, int range)
 
static ? Tile GetFloorTile (int x, int y)
 
static int GetFloorTileType (int x, int y)
 
static int GetMouseScrollDelta ()
 
static bool IsHoveringOverABottomSideOfABed (int myX, int myY)
 
static int SetMatch (SetMatchRequest request, ref bool somethingSpecial)
 
static bool CanPlayerSmashWall (int X, int Y)
 
static bool WouldSpotOverlapWithSentry (int worldX, int worldY, bool lightningAura)
 
static bool CheckSpawn (int x, int y)
 
static void SavePlayer (PlayerFileData playerFile, bool skipMapSave=false)
 
static void ClearPlayerTempInfo ()
 
static void InternalSaveMap (bool isCloudSave)
 
static PlayerFileData LoadPlayer (string playerPath, bool cloudSave)
 
static void FixLoadedData_EliminiateDuplicateAccessories (Item[] armorArray)
 
static PlayerFileData GetFileData (string file, bool cloudSave)
 
static float GetAnglerRewardRarityMultiplier (int questsDone)
 
static ? IEntitySource GetSource_None ()
 
static ? IEntitySource InheritSource (Entity entity)
 
static IEntitySource GetSource_NaturalSpawn ()
 
static IEntitySource GetSource_TownSpawn ()
 

Public Attributes

int emoteTime
 
CreativeUnlocksTracker creativeTracker
 
OverheadMessage chatOverhead
 
SelectionRadial DpadRadial = new SelectionRadial()
 
SelectionRadial CircularRadial = new SelectionRadial(SelectionRadial.SelectionMode.RadialCircular)
 
SelectionRadial QuicksRadial = new SelectionRadial(SelectionRadial.SelectionMode.RadialQuicks)
 
bool alchemyTable
 
int HotbarOffset
 
bool GoingDownWithGrapple
 
byte spelunkerTimer
 
bool[] hideInfo = new bool[InfoDisplayLoader.InfoDisplayCount]
 
int[] builderAccStatus = new int[BuilderToggleLoader.BuilderToggleCount]
 
long lostCoins
 
string lostCoinString = ""
 
int soulDrain
 
float drainBoost
 
bool dd2Accessory
 
string name = ""
 This player's displayed name.
Usually capped at 20 characters.
 
int taxMoney
 
double taxTimer
 
int numberOfDeathsPVE
 
int numberOfDeathsPVP
 
float basiliskCharge
 
Vector2 lastDeathPostion
 
DateTime lastDeathTime
 
bool showLastDeath
 
bool usedAegisCrystal
 
bool usedAegisFruit
 
bool usedArcaneCrystal
 
bool usedGalaxyPearl
 
bool usedGummyWorm
 
bool usedAmbrosia
 
int extraAccessorySlots = 2
 
bool extraAccessory
 
int tankPet = -1
 
bool tankPetReset
 
int stringColor
 
int counterWeight
 
bool yoyoString
 
bool yoyoGlove
 
int beetleOrbs
 
float beetleCounter
 
int beetleCountdown
 
bool beetleDefense
 
bool beetleOffense
 
bool beetleBuff
 
int solarShields
 
int solarCounter
 
Vector2[] solarShieldPos = (Vector2[])(object)new Vector2[3]
 
Vector2[] solarShieldVel = (Vector2[])(object)new Vector2[3]
 
bool solarDashing
 
bool solarDashConsumedFlare
 
int nebulaLevelLife
 
int nebulaLevelMana
 
int nebulaManaCounter
 
int nebulaLevelDamage
 
bool manaMagnet
 
bool lifeMagnet
 
bool treasureMagnet
 
bool chiselSpeed
 
bool lifeForce
 
bool calmed
 
bool inferno
 
float flameRingRot
 
float flameRingScale = 1f
 
byte flameRingFrame
 
byte flameRingAlpha
 
int netManaTime
 
int netLifeTime
 
bool netMana
 
bool netLife
 
Vector2[] beetlePos = (Vector2[])(object)new Vector2[3]
 
Vector2[] beetleVel = (Vector2[])(object)new Vector2[3]
 
int beetleFrame
 
int beetleFrameCounter
 
float manaSickReduction
 
bool manaSick
 
int afkCounter
 
bool stairFall
 
int loadStatus
 
Vector2[] itemFlamePos = (Vector2[])(object)new Vector2[7]
 
int itemFlameCount
 
bool outOfRange
 
float lifeSteal = 99999f
 
float ghostDmg
 
bool teleporting
 
float teleportTime
 
int teleportStyle
 
bool sloping
 
bool chilled
 
bool dazed
 
bool frozen
 
bool stoned
 
bool lastStoned
 
bool ichor
 
bool webbed
 
bool tipsy
 
bool noBuilding
 
int ropeCount
 
int manaRegenBonus
 
float manaRegenDelayBonus
 
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

 
int dash
 The current vanilla dash that the player is VISIBLY using.
Unlike F:Terraria.Player.dashType, this does not update if a dash cannot currently be input.

 
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 timeSinceLastDashStarted
 The amount of time that has passed, in ticks, since this player last performed a dash.
 
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 eocDash
 
int eocHit
 
float accRunSpeed
 
bool cordage
 
int gem = -1
 
int gemCount
 
BitsByte ownedLargeGems
 
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)

 
byte pulleyDir
 
bool pulley
 
int pulleyFrame
 
float pulleyFrameCounter
 
bool blackBelt
 
bool sliding
 
int slideDir
 
int snowBallLauncherInteractionCooldown
 
bool iceSkate
 
bool carpet
 
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.
 
int carpetFrame = -1
 
float carpetFrameCounter
 
bool canCarpet
 
int carpetTime
 
int miscCounter
 
int infernoCounter
 
int insanityShadowCooldown
 
int starCloakCooldown
 
bool crimsonRegen
 
bool ghostHeal
 
bool ghostHurt
 
bool sticky
 
bool slippy
 
bool slippy2
 
bool powerrun
 
bool runningOnSand
 
bool flapSound
 
bool iceBarrier
 
bool dangerSense
 
byte luckPotion
 
byte oldLuckPotion
 
float endurance
 The percent of damage this player should resist.
Has a soft cap of 1f. Cannot reduce taken damage below 1.
 
float whipRangeMultiplier
 
bool loveStruck
 
bool stinky
 
bool resistCold
 If true, this player will take 30% less damage from any NPC with F:Terraria.NPC.coldDamage set and any projectile with F:Terraria.Projectile.coldDamage set.
 
bool electrified
 
bool dryadWard
 
bool panic
 
Item brainOfConfusionItem
 
int brainOfConfusionDodgeAnimationCounter
 
byte iceBarrierFrame
 
byte iceBarrierFrameCounter
 
bool shadowDodge
 
float shadowDodgeCount
 
bool palladiumRegen
 
bool onHitDodge
 
bool onHitRegen
 
bool onHitPetal
 
bool onHitTitaniumStorm
 
int titaniumStormCooldown
 
bool hasTitaniumStormBuff
 
int petalTimer
 
int shadowDodgeTimer
 
int boneGloveTimer
 
int phantomPhoneixCounter
 
int fishingSkill
 
bool cratePotion
 
bool sonarPotion
 
bool accFishingLine
 If true, this player's fishing line will never break.
 
bool accFishingBobber
 
bool accTackleBox
 
bool accLavaFishing
 
int maxMinions = 1
 The maximum value of minions this player can have summoned at once.
A minion's value is stored as F:Terraria.Projectile.minionSlots.
 
int numMinions
 The current number of minions this player has summoned. Note that F:Terraria.Player.slotsMinions is how the minion limit is tracked, not this.
 
float slotsMinions
 The current total value of minions this player has summoned. Used to limit active minions to F:Terraria.Player.maxMinions
A minion's value is stored as F:Terraria.Projectile.minionSlots.
 
bool pygmy
 
bool raven
 
bool slime
 
bool hornetMinion
 
bool impMinion
 
bool twinsMinion
 
bool spiderMinion
 
int nextCycledSpiderMinionType
 
bool pirateMinion
 
bool sharknadoMinion
 
bool UFOMinion
 
bool DeadlySphereMinion
 
bool stardustMinion
 
bool stardustGuardian
 
bool stardustDragon
 
bool batsOfLight
 
bool babyBird
 
bool vampireFrog
 
bool stormTiger
 
int highestStormTigerGemOriginalDamage
 
bool smolstar
 
bool empressBlade
 
bool flinxMinion
 
bool abigailMinion
 
int highestAbigailCounterOriginalDamage
 
float wingTime
 
int wings
 
int wingsLogic
 
int wingTimeMax
 
int wingFrame
 
int wingFrameCounter
 
int skinVariant
 
bool ghost
 
int ghostFrame
 
int ghostFrameCounter
 
int miscTimer
 
int environmentBuffImmunityTimer
 
int _framesLeftEligibleForDeadmansChestDeathAchievement
 
bool pvpDeath
 
BitsByte zone1 = (byte)0
 
BitsByte zone2 = (byte)0
 
BitsByte zone3 = (byte)0
 
BitsByte zone4 = (byte)0
 
BitsByte zone5 = (byte)0
 
bool boneArmor
 
bool frostArmor
 
bool honey
 
bool crystalLeaf
 
int crystalLeafCooldown
 
PortableStoolUsage portableStoolInfo
 
bool preventAllItemPickups
 
bool dontHurtCritters
 
bool hasLucyTheAxe
 
bool dontHurtNature
 
int[] doubleTapCardinalTimer = new int[4]
 
int[] holdDownCardinalTimer = new int[4]
 
bool defendedByPaladin
 
bool hasPaladinShield
 
float[] speedSlice = new float[60]
 
float townNPCs
 The sum of the F:Terraria.NPC.npcSlots of all town NPCs near this player.
If F:Terraria.Player.townNPCs > 2f, then this player is in a town.
 
double headFrameCounter
 
double bodyFrameCounter
 
double legFrameCounter
 
int netSkip
 
int oldSelectItem
 
bool immune
 
bool immuneNoBlink
 
int immuneTime
 
int immuneAlphaDirection
 
int immuneAlpha
 
int team
 
bool hbLocked
 
float maxRegenDelay
 
int sign = -1
 
bool editedChestName
 
int reuseDelay
 
int aggro
 
float nearbyActiveNPCs
 
bool creativeInterface
 
bool mouseInterface
 
bool lastMouseInterface
 
int noThrow
 
int changeItem = -1
 
int selectedItem
 
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 M:Terraria.ModLoader.ModItem.UpdateAccessory(Terraria.Player,System.Boolean) to set fields in a T:Terraria.ModLoader.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 F:Terraria.Player.dye. The player's inventory is F:Terraria.Player.inventory. For equipment, see F:Terraria.Player.miscEquips and F:Terraria.Player.miscDyes. F:Terraria.Player.trashItem is the trash slot.


 
Item[] dye = new Item[10]
 
Item[] miscEquips = new Item[5]
 The player's equipment items. From indexes 0-4: Pet, Light Pet, Minecart, Mount, and Hook.
 
Item[] miscDyes = new Item[5]
 
Item trashItem = new Item()
 
float itemRotation
 
int itemWidth
 
int itemHeight
 
Vector2 itemLocation
 
bool poundRelease
 
float ghostFade
 
float ghostDir = 1f
 
int[] buffType = new int[maxBuffs]
 The T:Terraria.ID.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 F:Terraria.Player.buffTime.
M:Terraria.Player.AddBuff(System.Int32,System.Int32,System.Boolean,System.Boolean), M:Terraria.Player.ClearBuff(System.Int32), and M:Terraria.Player.DelBuff(System.Int32) should be used to manipulate player buffs.
 
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 F:Terraria.Player.buffType.
M:Terraria.Player.AddBuff(System.Int32,System.Int32,System.Boolean,System.Boolean), M:Terraria.Player.ClearBuff(System.Int32), and M:Terraria.Player.DelBuff(System.Int32) should be used to manipulate player buffs.
 
bool[] buffImmune = new bool[BuffID.Count]
 Indexed by T:Terraria.ID.BuffID. If true for a given T:Terraria.ID.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 heldProj = -1
 
int breathCD
 
int breathMax = 200
 
int breath = 200
 
int lavaCD
 
int lavaMax
 
int lavaTime
 
bool ignoreWater
 
bool armorEffectDrawShadow
 
bool armorEffectDrawShadowSubtle
 
bool armorEffectDrawOutlines
 
bool armorEffectDrawShadowLokis
 
bool armorEffectDrawShadowBasilisk
 
bool armorEffectDrawOutlinesForbidden
 
bool armorEffectDrawShadowEOCShield
 
bool socialShadowRocketBoots
 
bool socialGhost
 
bool shroomiteStealth
 
bool ashWoodBonus
 
bool socialIgnoreLight
 
int stealthTimer
 
float stealth = 1f
 
int beardGrowthTimer
 
bool isDisplayDollOrInanimate
 
bool isFullbright
 
bool isHatRackDoll
 
bool isFirstFractalAfterImage
 
float firstFractalAfterImageOpacity
 
string setBonus = ""
 The text that is shown on armor (F:Terraria.Item.wornArmor) with an active set bonus.
 
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 F:Terraria.Player.bank (Piggy Bank), F:Terraria.Player.bank2 (Safe), F:Terraria.Player.bank3 (Defender's Forge), and F:Terraria.Player.bank4 (Void Vault). For armor and accessories, see F:Terraria.Player.armor and F:Terraria.Player.dye. For equipment, see F:Terraria.Player.miscEquips and F:Terraria.Player.miscDyes. F:Terraria.Player.trashItem is the trash slot.

 
bool[] inventoryChestStack = new bool[59]
 
Item lastVisualizedSelectedItem
 
Chest bank = new Chest(bank: true)
 
Chest bank2 = new Chest(bank: true)
 
Chest bank3 = new Chest(bank: true)
 
Chest bank4 = new Chest(bank: true)
 
BitsByte voidVaultInfo
 
float headRotation
 
float bodyRotation
 
float legRotation
 
Vector2 headPosition
 
Vector2 bodyPosition
 
Vector2 legPosition
 
Vector2 headVelocity
 
Vector2 bodyVelocity
 
Vector2 legVelocity
 
float fullRotation
 
Vector2 fullRotationOrigin = Vector2.Zero
 
int fartKartCloudDelay
 
int nonTorch = -1
 
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.
 
float stepSpeed = 1f
 
bool dead
 
int respawnTimer
 
long lastTimePlayerWasSaved
 
int attackCD
 
int potionDelay
 
byte difficulty
 
byte wetSlime
 
HitTile hitTile
 
HitTile hitReplace
 
int jump
 
int head = -1
 
int body = -1
 
int legs = -1
 
int handon = -1
 
int handoff = -1
 
int back = -1
 
int front = -1
 
int shoe = -1
 
int waist = -1
 
int shield = -1
 
int neck = -1
 
int face = -1
 
int balloon = -1
 
int backpack = -1
 
int tail = -1
 
int faceHead = -1
 
int faceFlower = -1
 
int balloonFront = -1
 
int beard = -1
 
bool[] hideVisibleAccessory = new bool[10]
 
BitsByte hideMisc = (byte)0
 
Rectangle headFrame
 
Rectangle bodyFrame
 
Rectangle legFrame
 
Rectangle hairFrame
 
DirectionalInputSyncCache LocalInputCache
 
bool controlLeft
 
bool controlRight
 
bool controlUp
 
bool controlDown
 
bool controlJump
 
bool controlUseItem
 
bool controlUseTile
 
bool controlThrow
 
bool controlInv
 
bool controlHook
 
bool controlTorch
 
bool controlMap
 
bool controlSmart
 
bool controlMount
 
bool releaseJump
 
bool releaseUp
 
bool releaseUseItem
 
bool releaseUseTile
 
bool releaseInventory
 
bool releaseHook
 
bool releaseThrow
 
bool releaseQuickMana
 
bool releaseQuickHeal
 
bool releaseLeft
 
bool releaseRight
 
bool releaseSmart
 
bool releaseMount
 
bool releaseDown
 
bool controlQuickMana
 
bool controlQuickHeal
 
bool controlCreativeMenu
 
bool releaseCreativeMenu
 
bool tileInteractionHappened
 
bool tileInteractAttempted
 
bool controlDownHold
 
bool isOperatingAnotherEntity
 
bool autoReuseAllWeapons
 
bool isControlledByFilm
 
bool tryKeepingHoveringDown
 
bool tryKeepingHoveringUp
 
int altFunctionUse
 
bool mapZoomIn
 
bool mapZoomOut
 
bool mapAlphaUp
 
bool mapAlphaDown
 
bool mapFullScreen
 
bool mapStyle
 
bool releaseMapFullscreen
 
bool releaseMapStyle
 
int leftTimer
 
int rightTimer
 
bool delayUseItem
 
bool cursorItemIconEnabled
 
bool cursorItemIconReversed
 
int cursorItemIconID
 
int cursorItemIconPush
 
string cursorItemIconText = ""
 
int runSoundDelay
 
float opacityForAnimation = 1f
 
Vector2[] shadowPos = (Vector2[])(object)new Vector2[3]
 
float[] shadowRotation = new float[3]
 
Vector2[] shadowOrigin = (Vector2[])(object)new Vector2[3]
 
int[] shadowDirection = new int[3]
 
int shadowCount
 
float manaCost = 1f
 The percent of mana actually used when mana is consumed.
Cannot reduce an item's mana cost below 0.
 
bool fireWalk
 
bool channel
 
int step = -1
 
bool skipAnimatingValuesInPlayerFrame
 
RabbitOrderFrameHelper rabbitOrderFrame
 
bool creativeGodMode
 
int availableAdvancedShadowsCount
 
CompositeArmData compositeFrontArm
 
CompositeArmData compositeBackArm
 
int anglerQuestsFinished
 
int golferScoreAccumulated
 
int bartenderQuestLog
 
bool downedDD2EventAnyDifficulty
 
DefenseStat statDefense
 The defense value of this player.
The Defense wiki pageteaches how player defense affects incoming damage alongside F:Terraria.Player.DefenseEffectiveness.
The value resets to 0 during M:Terraria.Player.ResetEffects and is manipulated throughout M:Terraria.Player.Update(System.Int32).
If the final value is needed, M:Terraria.ModLoader.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 T:Terraria.Player.DefenseStat, modders can freely add, subtract, multiply, and divide the value. The final result will properly account for all modifications applied.

 
MultipliableFloat DefenseEffectiveness
 Determines how effective the player's F:Terraria.Player.statDefense is at reducing incoming damage.
The Defense wiki pageexplains the effect, shown in the wiki as "factor".

 
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 F:Terraria.Player.statLifeMax2. If you need to increase max health for a permanent stat boost, use M:Terraria.ModLoader.ModPlayer.ModifyMaxStats(Terraria.ModLoader.StatModifier@,Terraria.ModLoader.StatModifier@).
 
int statLifeMax2 = 100
 The maximum health this player can have, adjusted by buffs and equipment.
 
int statLife = 100
 The current health of this player. Capped at F:Terraria.Player.statLifeMax2.
If you increase this value, be sure to respect the cap.
 
int statMana
 The current mana of this player. Capped at F:Terraria.Player.statManaMax2.
If you increase this value, be sure to respect the cap.
 
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 F:Terraria.Player.statManaMax2. If you need to increase max mana for a permanent stat boost, use M:Terraria.ModLoader.ModPlayer.ModifyMaxStats(Terraria.ModLoader.StatModifier@,Terraria.ModLoader.StatModifier@).
 
int statManaMax2
 The maximum mana this player can have, adjusted by buffs and equipment.
 
int lifeRegen
 The rate of this player's life regeneration in health/ticks, divided by 120.
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 F:Terraria.Player.lifeRegenCount.
This value should be subtracted from in M:Terraria.ModLoader.ModPlayer.UpdateBadLifeRegen and added to in M:Terraria.ModLoader.ModPlayer.UpdateLifeRegen.
 
int lifeRegenCount
 This player's accumulated life regeneration.
If this value reaches or exceeds 120, the player gains F:Terraria.Player.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.
 
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.
 
int manaRegen
 
int manaRegenCount
 
float manaRegenDelay
 
bool manaRegenBuff
 
bool noKnockback
 
bool shimmerImmune
 
bool spaceGun
 
float gravDir = 1f
 
bool chloroAmmoCost80
 
bool huntressAmmoCost90
 
bool ammoCost80
 
bool ammoCost75
 
int stickyBreak
 
bool magicQuiver
 
bool magmaStone
 
bool lavaRose
 
bool hasMoltenQuiver
 
int phantasmTime
 
bool ammoBox
 
bool ammoPotion
 
bool chaosState
 
bool strongBees
 If true, then the bees created by F:Terraria.Player.honeyCombItem have a chance to be stronger.
 
bool sporeSac
 
bool shinyStone
 
bool empressBrooch
 
bool volatileGelatin
 
int volatileGelatinCounter
 
bool hasMagiluminescence
 
bool shadowArmor
 
bool dontStarveShader
 
bool eyebrellaCloud
 
int yoraiz0rEye
 
bool yoraiz0rDarkness
 
bool hasUnicornHorn
 
bool hasAngelHalo
 
bool hasRainbowCursor
 
bool leinforsHair
 
bool stardustMonolithShader
 
bool nebulaMonolithShader
 
bool vortexMonolithShader
 
bool solarMonolithShader
 
bool moonLordMonolithShader
 
bool bloodMoonMonolithShader
 
bool shimmerMonolithShader
 
int overrideFishingBobber = -1
 
bool unlockedBiomeTorches
 
bool ateArtisanBread
 
bool unlockedSuperCart
 If true, then this player has permanently buffed their minecarts. See P:Terraria.Player.UsingSuperCart for more info.
 
bool enabledSuperCart = true
 If true, then this player has the effects of the Super Cart enabled. See P:Terraria.Player.UsingSuperCart for more info.
 
bool suspiciouslookingTentacle
 
bool crimsonHeart
 
bool lightOrb
 
bool blueFairy
 
bool redFairy
 
bool greenFairy
 
bool bunny
 
bool turtle
 
bool eater
 
bool penguin
 
bool HasGardenGnomeNearby
 
bool magicLantern
 
bool rabid
 
bool sunflower
 
bool wellFed
 
bool puppy
 
bool grinch
 
bool miniMinotaur
 
bool flowerBoots
 
bool fairyBoots
 
bool hellfireTreads
 
bool moonLordLegs
 
bool arcticDivingGear
 
bool coolWhipBuff
 
bool wearsRobe
 
bool minecartLeft
 
bool onWrongGround
 
bool onTrack
 
int cartRampTime
 
bool cartFlip
 
float trackBoost
 
Vector2 lastBoost = Vector2.Zero
 
Mount mount
 This player's T:Terraria.Mount.
Do not overwrite this value. Instead, call M:Terraria.Mount.SetMount(System.Int32,Terraria.Player,System.Boolean) or M:Terraria.Mount.Dismount(Terraria.Player) on it.
 
bool blackCat
 
bool spider
 
bool squashling
 
bool petFlagDD2Gato
 
bool petFlagDD2Ghost
 
bool petFlagDD2Dragon
 
bool petFlagUpbeatStar
 
bool petFlagSugarGlider
 
bool petFlagBabyShark
 
bool petFlagLilHarpy
 
bool petFlagFennecFox
 
bool petFlagGlitteryButterfly
 
bool petFlagBabyImp
 
bool petFlagBabyRedPanda
 
bool petFlagPlantero
 
bool petFlagDynamiteKitten
 
bool petFlagBabyWerewolf
 
bool petFlagShadowMimic
 
bool petFlagVoltBunny
 
bool petFlagKingSlimePet
 
bool petFlagEyeOfCthulhuPet
 
bool petFlagEaterOfWorldsPet
 
bool petFlagBrainOfCthulhuPet
 
bool petFlagSkeletronPet
 
bool petFlagQueenBeePet
 
bool petFlagDestroyerPet
 
bool petFlagTwinsPet
 
bool petFlagSkeletronPrimePet
 
bool petFlagPlanteraPet
 
bool petFlagGolemPet
 
bool petFlagDukeFishronPet
 
bool petFlagLunaticCultistPet
 
bool petFlagMoonLordPet
 
bool petFlagFairyQueenPet
 
bool petFlagPumpkingPet
 
bool petFlagEverscreamPet
 
bool petFlagIceQueenPet
 
bool petFlagMartianPet
 
bool petFlagDD2OgrePet
 
bool petFlagDD2BetsyPet
 
bool petFlagQueenSlimePet
 
bool petFlagBerniePet
 
bool petFlagGlommerPet
 
bool petFlagDeerclopsPet
 
bool petFlagPigPet
 
bool petFlagChesterPet
 
bool petFlagJunimoPet
 
bool petFlagBlueChickenPet
 
bool petFlagSpiffo
 
bool petFlagCaveling
 
bool petFlagDirtiestBlock
 
bool companionCube
 
bool babyFaceMonster
 
bool magicCuffs
 
bool coldDash
 
bool sailDash
 
bool desertDash
 
bool desertBoots
 
bool eyeSpring
 
bool snowman
 
bool scope
 
bool dino
 
bool skeletron
 
bool hornet
 
bool zephyrfish
 
bool tiki
 
bool parrot
 
bool truffle
 
bool sapling
 
bool cSapling
 
bool wisp
 
bool lizard
 
bool archery
 
bool poisoned
 
bool venom
 
bool blind
 
bool blackout
 
bool headcovered
 
bool frostBurn
 
bool onFrostBurn
 
bool onFrostBurn2
 
bool burned
 
bool shimmering
 
int timeShimmering
 
float shimmerTransparency
 
ShimmerUnstuckHelper shimmerUnstuckHelper
 
bool suffocating
 
byte suffocateDelay
 
bool dripping
 
bool drippingSlime
 
bool drippingSparkleSlime
 
bool onFire
 
bool onFire2
 
bool onFire3
 
bool noItems
 
bool cursed
 
bool hungry
 
bool starving
 
bool heartyMeal
 
bool windPushed
 
bool wereWolf
 
bool wolfAcc
 
bool hideMerman
 
bool hideWolf
 
bool forceMerman
 
bool forceWerewolf
 
bool rulerGrid
 
bool rulerLine
 
bool bleed
 
bool confused
 
bool accMerman
 
bool merman
 
bool trident
 
bool brokenArmor
 
bool silence
 
bool slow
 
bool gross
 
bool tongued
 
bool kbGlove
 
bool autoReuseGlove
 
bool meleeScaleGlove
 
bool kbBuff
 
bool remoteVisionForDrone
 
Item starCloakItem
 
Item starCloakItem_manaCloakOverrideItem
 
Item starCloakItem_starVeilOverrideItem
 
Item starCloakItem_beeCloakOverrideItem
 
bool longInvince
 
bool pStone
 
bool manaFlower
 
bool moonLeech
 
bool vortexDebuff
 
bool trapDebuffSource
 
bool witheredArmor
 
bool witheredWeapon
 
bool slowOgreSpit
 
bool parryDamageBuff
 
bool ballistaPanic
 
bool JustDroppedAnItem
 
StatModifier arrowDamage = StatModifier.Default
 
StatModifier bulletDamage = StatModifier.Default
 
StatModifier specialistDamage = StatModifier.Default
 
float moveSpeed = 1f
 The multiplier on this player's F:Terraria.Player.maxRunSpeed and F:Terraria.Player.runAcceleration.
 
float pickSpeed = 1f
 
float wallSpeed = 1f
 
float tileSpeed = 1f
 
bool autoPaint
 
bool autoActuator
 
int SpawnX = -1
 
int SpawnY = -1
 
Vector2? PotionOfReturnOriginalUsePosition
 
Vector2? PotionOfReturnHomePosition
 
int[] spX = new int[200]
 
int[] spY = new int[200]
 
string[] spN = new string[200]
 
int[] spI = new int[200]
 
int lastTileRangeX
 
int lastTileRangeY
 
float gravity = defaultGravity
 
float maxFallSpeed = 10f
 
float maxRunSpeed = 3f
 The maximum speed, in pixels/tick, that this player can reach by just running.
 
float runAcceleration = 0.08f
 The acceleration, in pixels/ticks^2, that this player experiences while running.
 
float runSlowdown = 0.2f
 
bool adjWater
 
bool adjHoney
 
bool adjShimmer
 
bool adjLava
 
bool oldAdjWater
 
bool oldAdjHoney
 
bool oldAdjLava
 
bool oldAdjShimmer
 
int hairDye
 
Color hairDyeColor = Color.Transparent
 
float hairDyeVar
 
int skinDyePacked
 
Color hairColor = new Color(215, 90, 55)
 
Color skinColor = new Color(255, 125, 90)
 
Color eyeColor = new Color(105, 90, 75)
 
Color shirtColor = new Color(175, 165, 140)
 
Color underShirtColor = new Color(160, 180, 215)
 
Color pantsColor = new Color(255, 230, 175)
 
Color shoeColor = new Color(160, 105, 60)
 
int hair
 
bool hostile
 
SoundPlaySet hermesStepSound = new SoundPlaySet()
 
Vector2 instantMovementAccumulatedThisFrame
 
int accCompass
 
int accWatch
 
int accDepthMeter
 
bool accFishFinder
 
bool accWeatherRadio
 
bool accJarOfSouls
 
bool accCalendar
 
int lastCreatureHit = -1
 
bool accThirdEye
 
byte accThirdEyeCounter
 
byte accThirdEyeNumber
 
bool accStopwatch
 
bool accOreFinder
 
bool accCritterGuide
 
byte accCritterGuideCounter
 
byte accCritterGuideNumber
 
bool accDreamCatcher
 
bool hasFootball
 
bool drawingFootball
 
bool ActuationRodLock
 
bool ActuationRodLockSetting
 
bool InfoAccMechShowWires
 
DateTime dpsStart
 
DateTime dpsEnd
 
DateTime dpsLastHit
 
int dpsDamage
 
bool dpsStarted
 
string displayedFishingInfo = ""
 
bool discountEquipped
 
bool discountAvailable
 
bool hasLuckyCoin
 
Item boneGloveItem
 
bool goldRing
 
bool accDivingHelm
 
bool hasLuck_LuckyCoin
 
bool hasLuck_LuckyHorseshoe
 
bool isPerformingPogostickTricks
 
bool autoJump
 
bool justJumped
 
float jumpSpeedBoost
 How much to directly increase F:Terraria.Player.jumpSpeed, in pixels/tick.
 
int extraFall
 The number of extra tiles this player can fall before they start taking fall damage.
 
bool canFloatInWater
 
bool hasFloatingTube
 
bool frogLegJumpBoost
 
bool skyStoneEffects
 
bool spawnMax
 
int blockRange
 
int[] grappling = new int[20]
 
int grapCount
 
int rocketTime
 
int rocketTimeMax = 7
 
int rocketDelay
 
int rocketDelay2
 
int rocketSoundDelay
 
bool rocketRelease
 
bool rocketFrame
 
int rocketBoots
 
int vanityRocketBoots
 
bool canRocket
 
bool jumpBoost
 
bool noFallDmg
 If true, this player will take no fall damage.
 
int swimTime
 
bool killGuide
 
bool killClothier
 
float equipmentBasedLuckBonus
 
float lastEquipmentBasedLuckBonus
 
bool hasCreditsSceneMusicBox
 
bool lavaImmune
 
bool gills
 
bool slowFall
 
bool findTreasure
 
bool biomeSight
 
bool invis
 
bool detectCreature
 
bool nightVision
 
bool enemySpawns
 
float thorns
 
bool turtleArmor
 
bool turtleThorns
 
bool cactusThorns
 
bool spiderArmor
 
bool anglerSetSpawnReduction
 
bool CanSeeInvisibleBlocks
 
bool setSolar
 
bool setVortex
 
bool setNebula
 
int nebulaCD
 
bool setStardust
 
bool setForbidden
 
bool setForbiddenCooldownLocked
 
bool setSquireT3
 
bool setHuntressT3
 
bool setApprenticeT3
 
bool setMonkT3
 
bool setSquireT2
 
bool setHuntressT2
 
bool setApprenticeT2
 
bool setMonkT2
 
int maxTurrets = 1
 
int maxTurretsOld = 1
 
bool vortexStealthActive
 
bool waterWalk
 
bool waterWalk2
 
int forcedGravity
 
bool gravControl
 
bool gravControl2
 
Item honeyCombItem
 If not null, this player will create damaging bee projectiles when taking damage.
 
int wireOperationsCooldown
 
int lastChest
 
TrackedProjectileReference piggyBankProjTracker
 
TrackedProjectileReference voidLensChest
 
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 F:Terraria.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
 
int fallStart
 
int fallStart2
 
int potionDelayTime = Item.potionDelay
 
int restorationDelayTime = Item.restorationDelay
 
int mushroomDelayTime = Item.mushroomDelay
 
bool isPettingAnimal
 
bool isTheAnimalBeingPetSmall
 
PlayerSittingHelper sitting
 
PlayerSleepingHelper sleeping
 
PlayerEyeHelper eyeHelper
 
PlayerInteractionAnchor tileEntityAnchor
 
DoorOpeningHelper doorHelper
 
ShoppingSettings currentShoppingSettings = ShoppingSettings.NotInShop
 
int cHead
 The armor shader ID applied to the F:Terraria.ModLoader.EquipType.Head equip texture by a dye item (F:Terraria.Item.dye) in the dye slot.
 
int cBody
 The armor shader ID applied to the F:Terraria.ModLoader.EquipType.Body equip texture by a dye item (F:Terraria.Item.dye) in the dye slot.
 
int cLegs
 The armor shader ID applied to the F:Terraria.ModLoader.EquipType.Legs equip texture by a dye item (F:Terraria.Item.dye) in the dye slot.
 
int cHandOn
 
int cHandOff
 
int cBack
 
int cFront
 
int cShoe
 
int cWaist
 
int cShield
 
int cNeck
 
int cFace
 
int cFaceHead
 
int cFaceFlower
 
int cBalloon
 
int cBalloonFront
 
int cWings
 
int cCarpet
 
int cFloatingTube
 
int cBackpack
 
int cTail
 
int cShieldFallback
 
int cGrapple
 The armor shader ID applied to the Hook equipment slot by a dye item (F:Terraria.Item.dye) in the dye slot.
 
int cMount
 The armor shader ID applied to the Mount equipment slot by a dye item (F:Terraria.Item.dye) in the dye slot.
 
int cMinecart
 The armor shader ID applied to the Minecart equipment slot by a dye item (F:Terraria.Item.dye) in the dye slot.
 
int cPet
 The armor shader ID applied to the Pet equipment slot by a dye item (F:Terraria.Item.dye) in the dye slot.
 
int cLight
 The armor shader ID applied to the Light Pet equipment slot by a dye item (F:Terraria.Item.dye) in the dye slot.
 
int cYorai
 
int cPortableStool
 
int cUnicornHorn
 
int cAngelHalo
 
int cBeard
 
int cMinion
 
int cLeinShampoo
 
int cFlameWaker
 
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 M:Terraria.ModLoader.ModItem.CanUseItem(Terraria.Player) could prevent a player using the item if the projectile the item spawns is already in the game world for the player.
 
bool[] npcTypeNoAggro = new bool[NPCID.Count]
 
int lastPortalColorIndex
 
int _portalPhysicsTime
 
bool portalPhysicsFlag
 
int lastTeleportPylonStyleUsed
 
float MountFishronSpecialCounter
 
Vector2 MinionRestTargetPoint = Vector2.Zero
 
int MinionAttackTargetNPC = -1
 
List< Point > TouchedTiles = new List<Point>()
 
int itemAnimation
 
int itemAnimationMax
 
int itemTime
 
int itemTimeMax
 
int toolTime
 
bool equippedAnyTileRangeAcc
 
bool equippedAnyTileSpeedAcc
 
bool equippedAnyWallSpeedAcc
 
bool behindBackWall
 
int _funkytownAchievementCheckCooldown
 
float torchLuck
 
bool happyFunTorchTime
 
double ladyBugLuckTimeLeft
 
float luck
 
float luckMinimumCap = -0.7f
 
float luckMaximumCap = 1f
 
float coinLuck
 
bool luckNeedsSync
 
int disableVoidBag = -1
 
PlayerMovementAccsCache movementAbilitiesCache
 
float wingAccRunSpeed = -1f
 
float wingRunAccelerationMult = 1f
 
bool hasRaisableShield
 
bool shieldRaised
 
int shieldParryTimeLeft
 
int shield_parry_cooldown
 
int[] hurtCooldowns = new int[5]
 
int[] meleeNPCHitCooldown = new int[200]
 
float musicDist
 
EquipmentLoadout[] Loadouts
 
int CurrentLoadoutIndex
 
SavedPlayerDataWithAnnoyingRules savedPerPlayerFieldsThatArentInThePlayerClass
 
Item equippedWings
 
bool selectItemOnNextUse
 Causes M:Terraria.Player.SmartSelectLookup to run the next time an item animation is finished, even if F:Terraria.Player.controlUseItem is held.
Used internally by tML to when a hotbar key is pressed while using an item.
 
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 whoAmI
 The index of this Entity within its specific array. These arrays track the entities in the world.
Item: unused
Projectile: F:Terraria.Main.projectile
NPC: F:Terraria.Main.npc
Player: F:Terraria.Main.player
 
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.
 
Vector2 position
 The position of this Entity in world coordinates.
 
Vector2 velocity
 The velocity of this Entity in world coordinates per tick.
 
Vector2 oldPosition
 
Vector2 oldVelocity
 
int oldDirection
 
int direction = 1
 
int width
 The width of this Entity's hitbox, in pixels.
 
int height
 The height of this Entity's hitbox, in pixels.
 
bool wet
 The Entity is currently in water.
Projectile: Affects movement speed and some projectiles die when wet. F:Terraria.Projectile.ignoreWater prevents this.
 
bool shimmerWet
 
bool honeyWet
 
byte wetCount
 
bool lavaWet
 

Static Public Attributes

static double taxRate = 3600.0
 
static int crystalLeafDamage = 100
 
static int crystalLeafKB = 10
 
const int maxSolarShields = 3
 
const int nebulaMaxLevel = 3
 
static int manaSickTime = 300
 
static int manaSickTimeMax = 600
 
static float manaSickLessDmg = 0.25f
 
static int nameLen = 20
 
const int SupportedSlotsArmor = 3
 
const int SupportedSlotsAccs = 7
 
const int SupportedSlotSets = 10
 
const int InitialAccSlotCount = 5
 
const int miscSlotPet = 0
 
const int miscSlotLight = 1
 
const int miscSlotCart = 2
 
const int miscSlotMount = 3
 
const int miscSlotHook = 4
 
const int SupportedMiscSlotCount = 5
 
const int fartKartCloudDelayMax = 20
 
static bool deadForGood = false
 
const int respawnTimerMax = 3600
 
const int defaultWidth = 20
 
const int defaultHeight = 42
 
const int shadowMax = 3
 
static readonly float PhilosopherStoneDurationMultiplier = 0.75f
 
static int tileRangeX = 5
 
static int tileRangeY = 4
 
static int tileTargetX
 
static int tileTargetY
 
static float defaultGravity = 0.4f
 
static int jumpHeight = 15
 
static float jumpSpeed = 5.01f
 The speed, in pixels/tick, that this players jumps at.
 
static int defaultItemGrabRange = 42
 
static int BlockInteractionWithProjectiles = 3
 
const int SafeItemAnimationTimeForPreventingExploits = 20
 
static float airLightDecay = 1f
 
static float solidLightDecay = 1f
 
const int ChairSittingMaxDistance = 40
 
const int SHIELD_PARRY_DURATION = 20
 
const int SHIELD_PARRY_DURATION_DRAWING_TWEAKER = 20
 
const int SHIELD_PARRY_DAMAGE_BUFF_MULTIPLIER = 5
 
static int FlexibleWandRandomSeed
 
static int FlexibleWandCycleOffset
 
static Point FlexibleWandLastPosition
 
static bool lastPound = true
 
static int musicNotes = 6
 
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.
 

Package Functions

void UpdateItemDye (bool isNotInVanitySlot, bool isSetToHidden, Item armorItem, Item dyeItem)
 
IEntitySource GetProjectileSource_Buff (int buffIndex)
 
IEntitySource GetProjectileSource_Item (Item item)
 
IEntitySource GetItemSource_OpenItem (int itemType)
 
IEntitySource GetItemSource_Death ()
 
IEntitySource GetItemSource_Misc (int itemSourceId)
 
IEntitySource GetProjectileSource_Item_WithPotentialAmmo (Item item, int ammoItemId)
 
IEntitySource GetProjectileSource_OnHit (Entity victim, int projectileSourceId)
 
IEntitySource GetProjectileSource_OnHurt (Entity attacker, int projectileSourceId)
 
IEntitySource GetProjectileSource_Accessory (Item item)
 
IEntitySource GetProjectileSource_Misc (int projectileSourceId)
 
IEntitySource GetProjectileSource_TileInteraction (int tileCoordsX, int tileCoordsY)
 
IEntitySource GetItemSource_TileInteraction (int tileCoordsX, int tileCoordsY)
 
IEntitySource GetNPCSource_TileInteraction (int tileCoordsX, int tileCoordsY)
 
IEntitySource GetItemSource_OnHit (Entity victim, int itemSourceId)
 
IEntitySource GetProjectileSource_SetBonus (int projectileSourceId)
 
double Hurt (PlayerDeathReason damageSource, int Damage, int hitDirection, bool pvp, bool quiet, bool Crit, int cooldownCounter, bool dodgeable=true, float armorPenetration=0f)
 
bool HasAmmo (Item sItem, bool canUse)
 
void PickAmmo (Item sItem, ref int projToShoot, ref float speed, ref bool canShoot, ref int totalDamage, ref float KnockBack, out int usedAmmoItemId, bool dontConsume=false)
 
void ResetDamageClassData ()
 

Package Attributes

Item[] _temporaryItemSlots = new Item[4]
 
IList< string > usedMods
 
string modPack
 
ModPlayer[] modPlayers = Array.Empty<ModPlayer>()
 
BitArray modBiomeFlags = new BitArray(0)
 Stores whether or not the player is in a modbiome using boolean bits.
 
long entityId
 

Static Package Attributes

static byte[] ENCRYPTION_KEY = new UnicodeEncoding().GetBytes("h3y_gUyZ")
 

Properties

bool sandStorm [get, set]
 
static int maxBuffs [get]
 
static int MaxBuffs [get]
 
ref float armorPenetration [get]
 
ref float allCrit [get]
 
ref float meleeCrit [get]
 
ref float magicCrit [get]
 
ref float rangedCrit [get]
 
ref StatModifier allDamage [get]
 
ref StatModifier meleeDamage [get]
 
ref StatModifier magicDamage [get]
 
ref StatModifier rangedDamage [get]
 
ref StatModifier arrowDamageAdditiveStack [get]
 
ref StatModifier minionDamage [get]
 
ref StatModifier allKB [get]
 
ref float minionKB [get]
 
ref float meleeSpeed [get]
 
float inverseMeleeSpeed [get]
 
ref float summonerWeaponSpeedBonus [get]
 
bool[] adjTile [get, set]
 
bool[] oldAdjTile [get, set]
 
bool accFlipper [get, set]
 
bool hasJumpOption_Cloud [set]
 
bool hasJumpOption_Sandstorm [set]
 
bool hasJumpOption_Blizzard [set]
 
bool hasJumpOption_Fart [set]
 
bool hasJumpOption_Sail [set]
 
bool hasJumpOption_Unicorn [set]
 
bool hasJumpOption_Santank [set]
 
bool hasJumpOption_WallOfFleshGoat [set]
 
bool hasJumpOption_Basilisk [set]
 
Vector2 BlehOldPositionFixer [get]
 
float HeightOffsetVisual [get]
 
float HeightOffsetHitboxCenter [get]
 
float MountXOffset [get]
 
int HeightOffsetBoost [get]
 
int HeightMapOffset [get]
 
Rectangle HitboxForBestiaryNearbyCheck [get]
 
bool IsStandingStillForSpecialEffects [get]
 
Vector2 MountedCenter [get, set]
 Returns the player's center adjusted for mount and step stool usage. Typically used in conjunction with M:Terraria.Player.RotatedRelativePoint(Microsoft.Xna.Framework.Vector2,System.Boolean,System.Boolean) to retrieve a suitable position for positioning items and effects originating from the player.
 
bool TileReplacementEnabled [get]
 
override Vector2 VisualPosition [get]
 
bool CCed [get]
 Checks if the player is currently "crowd controlled", meaning the player is F:Terraria.Player.frozen, F:Terraria.Player.webbed, or F:Terraria.Player.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.
 
float miscCounterNormalized [get]
 
bool Male [get, set]
 
bool ZoneDungeon [get, set]
 
bool ZoneCorrupt [get, set]
 
bool ZoneHallow [get, set]
 
bool ZoneMeteor [get, set]
 
bool ZoneJungle [get, set]
 
bool ZoneSnow [get, set]
 
bool ZoneCrimson [get, set]
 
bool ZoneWaterCandle [get, set]
 
bool ZonePeaceCandle [get, set]
 
bool ZoneTowerSolar [get, set]
 
bool ZoneTowerVortex [get, set]
 
bool ZoneTowerNebula [get, set]
 
bool ZoneTowerStardust [get, set]
 
bool ZoneDesert [get, set]
 
bool ZoneGlowshroom [get, set]
 
bool ZoneUndergroundDesert [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 ZoneOverworldHeight [get, set]
 If true, then this player is above ground (F:Terraria.Main.worldSurface) but not in space (P:Terraria.Player.ZoneSkyHeight).
 
bool ZoneDirtLayerHeight [get, set]
 If true, then this player is underground (F:Terraria.Main.worldSurface) but above the Caverns layer (F:Terraria.Main.rockLayer).
 
bool ZoneRockLayerHeight [get, set]
 If true, then this player is in the Caverns layer (F:Terraria.Main.rockLayer) but not in the Underworld (P:Terraria.Main.UnderworldLayer).
 
bool ZoneUnderworldHeight [get, set]
 If true, then this player is in the Underworld (P:Terraria.Main.UnderworldLayer).
 
bool ZoneBeach [get, set]
 
bool ZoneRain [get, set]
 
bool ZoneSandstorm [get, set]
 
bool ZoneOldOneArmy [get, set]
 
bool ZoneGranite [get, set]
 
bool ZoneMarble [get, set]
 
bool ZoneHive [get, set]
 
bool ZoneGemCave [get, set]
 
bool ZoneLihzhardTemple [get, set]
 
bool ZoneGraveyard [get, set]
 
bool ZoneShadowCandle [get, set]
 
bool ZoneShimmer [get, set]
 
bool ShoppingZone_AnyBiome [get]
 
bool ShoppingZone_BelowSurface [get]
 
bool ShoppingZone_Forest [get]
 
Vector2 Directions [get]
 
Item HeldItem [get]
 
int breathCDMax [get]
 
bool ShouldFloatInWater [get]
 
bool CanBeTalkedTo [get]
 
bool IsVoidVaultEnabled [get, set]
 
bool DeadOrGhost [get]
 
bool TryingToHoverUp [get]
 
bool TryingToHoverDown [get]
 
Vector2 DefaultSize [get]
 
bool UsingBiomeTorches [get, set]
 
bool UsingSuperCart [get, set]
 If true, then any minecart (F:Terraria.ID.MountID.Sets.Cart) this player rides in will be significantly faster and fire lasers.
Cannot be true if F:Terraria.Player.unlockedSuperCart is false.
 
bool ShouldNotDraw [get]
 
int talkNPC [get, private set]
 
NPC TalkNPC [get]
 The NPC instance the player is talking to, or null if P:Terraria.Player.talkNPC is -1.
 
bool isLockedToATile [get]
 
bool PortalPhysicsEnabled [get]
 
bool MountFishronSpecial [get]
 
bool HasMinionRestTarget [get]
 
bool HasMinionAttackTargetNPC [get]
 
bool ItemTimeIsZero [get]
 
bool ItemAnimationJustStarted [get]
 Returns true if the item animation is in its first frame.
 
float NormalizedLuck [get]
 
bool SlimeDontHyperJump [get]
 
Vector2? MouthPosition [get]
 
Vector2? HandPosition [get]
 
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.
 
RefReadOnlyArray< ModPlayerModPlayers [get]
 
RefReadOnlyArray< ModPlayer > IEntityWithInstances< ModPlayer >. Instances [get]
 
HashSet< int > NearbyModTorch = new HashSet<int>() [get, private set]
 
float ThrownVelocity [get, set]
 Multiplier to shot projectile velocity before throwing. Result will be capped to 16f.
Only applies to items counted as the P:Terraria.ModLoader.DamageClass.Throwing damage type.
 
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 P:Terraria.ModLoader.DamageClass.Throwing damage type.
Projectiles spawned from a player who holds such item will set F:Terraria.Projectile.noDropItem to prevent duplication.
Stacks with P:Terraria.Player.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 P:Terraria.ModLoader.DamageClass.Throwing damage type.
Projectiles spawned from a player who holds such item will set F:Terraria.Projectile.noDropItem to prevent duplication.
Stacks with P:Terraria.Player.ThrownCost33 multiplicatively.
 
bool AnyThrownCostReduction [get]
 Returns true if either P:Terraria.Player.ThrownCost33 or P:Terraria.Player.ThrownCost50 are true.
 
SceneEffectLoader.SceneEffectInstance CurrentSceneEffect = new SceneEffectLoader.SceneEffectInstance() [get, set]
 Container for current SceneEffect client properties such as: Backgrounds, music, and water styling.
 
bool ZonePurity [get, set]
 The zone property storing if the player is not in any particular biome. Updated in M:Terraria.Player.UpdateBiomes Does NOT account for height. Please use ZoneForest / ZoneNormalX for height based derivatives.
 
bool ZoneForest [get]
 Shorthand for.
 
bool ZoneNormalCaverns [get]
 Shorthand for.
 
bool ZoneNormalUnderground [get]
 Shorthand for.
 
bool ZoneNormalSpace [get]
 Shorthand for.
 
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.
 
int ItemUsesThisAnimation [get, private set]
 The number of times the item has been used/fired this animation (swing)
 
Span< ExtraJumpStateExtraJumps [get]
 
Vector2 Center [get, set]
 
Vector2 Left [get, set]
 
Vector2 Right [get, set]
 
Vector2 Top [get, set]
 
Vector2 TopLeft [get, set]
 
Vector2 TopRight [get, set]
 
Vector2 Bottom [get, set]
 
Vector2 BottomLeft [get, set]
 
Vector2 BottomRight [get, set]
 
Vector2 Size [get, set]
 
Rectangle Hitbox [get, set]
 

Private Member Functions

void DropSelectedItem_InterruptActionsThatUseAnimations ()
 
bool AddBuff_ActuallyTryToAddTheBuff (int type, int time)
 
void AddBuff_RemoveOldMeleeBuffsOfMatchingType (int type)
 
void AddBuff_RemoveOldPetBuffsOfMatchingType (int type)
 
bool AddBuff_TryUpdatingExistingBuffTime (int type, int time)
 
int AddBuff_DetermineBuffTimeToAdd (int type, int time1)
 
Item QuickBuff_PickBestFoodItem ()
 
int QuickBuff_FindFoodPriority (int buffType)
 
bool QuickBuff_ShouldBotherUsingThisBuff (int attemptedType)
 
void QuickMinecart ()
 
bool QuickMinecartSnap ()
 
void TrySyncingInput ()
 
void OnHit_Inner (float x, float y, Entity victim)
 
void UpdateProjectileCaches (int i)
 
void ResetProjectileCaches ()
 
void UpdateAbigailStatus ()
 
void UpdateStormTigerStatus ()
 
int GetDesiredStormTigerMinionRank ()
 
void RefreshInfoAccsFromItemType (int accType)
 
bool UpdateEquips_CanItemGrantBenefits (int itemSlot, Item item)
 
void SpawnHallucination (Item item)
 
void ApplyEquipVanity (int itemSlot, Item currentItem)
 
void DoEyebrellaRainEffect ()
 
void ApplyWilsonBeard (Item currentItem)
 
void ApplyMusicBox (Item currentItem)
 
void UpdateGraveyard (bool now=false)
 
void TrySpawningFaelings ()
 
void TryOpeningInGameOptionsBasedOnInput ()
 
void SmartInteractLookup_PrepareCommonlyUsedInfo (out Vector2 mousevec, out int LX, out int HX, out int LY, out int HY)
 
void SmartSelectLookup_GetTargetTile (out int tX, out int tY)
 
void SmartSelect_PickToolForStrategy (int tX, int tY, int toolStrategy, bool wetTile)
 
void SmartSelect_SelectItem (int t)
 
void SmartSelect_GetToolStrategy (int tX, int tY, out int toolStrategy, out bool wetTile)
 
void SmartSelect_GetAvailableToolRanges (out int pickRange, out int axeRange, out int hammerRange, out int cannonRange, out int extractItemRange, out int paintScraperRange)
 
void EndOngoingTorchGodEvent ()
 
void TryRecalculatingTorchLuck ()
 
void RelightTorches ()
 
void TorchAttack ()
 
void UpdateTorchLuck_ConsumeCountersAndCalculate ()
 
void UpdateCoinLuck ()
 
float CalculateCoinLuck ()
 
float GetLadyBugLuck ()
 
void UpdateLadyBugLuckTime ()
 
void TryToPoop ()
 
void TryUsingDiggerCart ()
 
void SpawnFastRunParticles ()
 
void MowTheLawn ()
 
void MowGrassTile (Vector2 thePos)
 
void SolarDashStart (int dashDirection)
 
void DoCommonDashHandle (out int dir, out bool dashing, DashStartAction dashStartAction=null)
 
void GetGrapplingForces (Vector2 fromPosition, out int? preferredPlayerDirectionToSet, out float preferedPlayerVelocityX, out float preferedPlayerVelocityY)
 
void RefreshDoubleJumps ()
 
void TryFloatingInFluid ()
 
bool TouchBlockSurfaceCenter (int x, int y, Tile tile, out int exitNormalX, out int exitNormalY, out Vector2 surfaceCenter)
 
void MakeFloorDust (bool Falling, int type, int paintColor)
 
bool CanMoveForwardOnRope (int dir, int x, int y)
 
void TryToToggleSmartCursor (ref bool smartCursorWanted)
 
void TryToShimmerUnstuck ()
 
void ShimmerUnstuck ()
 
Vector2? TryFindingShimmerFreeSpot ()
 
void AdjustRemainingPotionSickness ()
 
Collision.HurtTile GetHurtTile ()
 
void ApplyTouchDamage (int tileId, int x, int y)
 
void CapAttackSpeeds ()
 
float TurnAttackSpeedToUseTimeMultiplier (float speed)
 
void ResetControls ()
 
void UpdateControlHolds ()
 
void UpdatePortableStoolUsage ()
 
void ResizeHitbox ()
 
void UpdateReleaseUseTile ()
 
void GetMinecartDamage (float currentSpeed, out int damage, out float knockback)
 
void WingAirLogicTweaks ()
 
void RocketBootVisuals ()
 
void WingAirVisuals ()
 
void HandleBeingInChestRange ()
 
void PurgeDD2EnergyCrystals ()
 
void HandleHotbar ()
 
void ItemCheckWrapped (int i)
 
void ForceForwardCursor (bool state)
 
void ForceSmartSelectCursor (bool state)
 
void TryInteractingWithMinecartTrackInNearbyArea (int selectedTargetX, int selectedTargetY)
 
void TileInteractionsCheckLongDistance (int myX, int myY)
 
void TileInteractionsUse (int myX, int myY)
 
void GetPettingInfo (int animalNpcIndex, out int targetDirection, out Vector2 playerPositionWhenPetting, out bool isPetSmall)
 
void TryAllowingSnappingToPosition (ref bool canSnapToPosition, Vector2 pos1, Vector2 pos2)
 
void StopPettingAnimal ()
 
void UpdatePettingAnimal ()
 
void LaunchMinecartHook (int myX, int myY)
 
void TileInteractionsMouseOver (int myX, int myY)
 
void TileInteractionsMouseOver_Containers (int myX, int myY)
 
void TryLandingOnDetonator ()
 
void TryBouncingBlocks (bool Falling)
 
void GrabItems (int i)
 
void PullItem_ToVoidVault (Item itemToPickUp)
 
void PullItem_Common (Item itemToPickUp, float xPullSpeed)
 
void PullItem_Pickup (Item itemToPickUp, float speed, int acc)
 
Item PickupItem (int playerIndex, int worldItemArrayIndex, Item itemToPickUp)
 
void RefreshItems (Item[] array, bool onlyIfVariantChanged)
 
void CancelAllJumpVisualEffects ()
 
void CancelAllBootRunVisualEffects ()
 
void UpdateFishingBobber (Item item)
 
void UpdateBootVisualEffects (Item item)
 
void UpdateVisibleAccessories ()
 
bool IsVisibleCapeBad (int accFrontSlot)
 
void Spawn_SetPositionAtWorldSpawn ()
 
bool Spawn_IsAreaAValidWorldSpawn (int floorX, int floorY)
 
void Spawn_SetPosition (int floorX, int floorY)
 
void PutHallowedArmorSetBonusOnCooldown ()
 
void OnHurt_Part1 (HurtInfo info)
 
void ApplyVanillaHurtEffectModifiers (ref HurtModifiers modifiers)
 
void OnHurt_Part2 (HurtInfo info)
 
bool TeammateHasPalidinShieldAndCanTakeDamage ()
 
void OnHurt_Part3 (HurtInfo info)
 
int GetRespawnTime (bool pvp)
 
bool GetItem_VoidVault (int plr, Item[] inventory, Item newItem, GetItemSettings settings, Item returnItem)
 
bool CanVoidVaultAccept (Item item)
 
bool GetItem_FillIntoOccupiedSlot_VoidBag (int plr, Item[] inv, Item newItem, GetItemSettings settings, Item returnItem, int i)
 
bool GetItem_FillIntoOccupiedSlot (int plr, Item newItem, GetItemSettings settings, Item returnItem, int i)
 
bool GetItem_FillEmptyInventorySlot_VoidBag (int plr, Item[] inv, Item newItem, GetItemSettings settings, Item returnItem, int i)
 
bool GetItem_FillEmptyInventorySlot (int plr, Item newItem, GetItemSettings settings, Item returnItem, int i)
 
void PlaceThing_Walls ()
 
void PlaceThing_Walls_FillEmptySpace ()
 
void PlaceThing_Tiles ()
 
bool ModifyFlexibleWandPlacementInfo (ref int tileType, ref int tileStyle, ref int? forcedRandom)
 
bool PlaceThing_TryReplacingWalls (bool canUse)
 
bool PlaceThing_ValidWallForReplacement ()
 
bool PlaceThing_TryReplacingTiles (bool canUse)
 
bool PlaceThing_ValidTileForReplacement ()
 
bool PlaceThing_CheckSpecificValidtyCaseForBlockSwap (int tileTypeBeingPlaced, int tileTypeCurrentlyPlaced)
 
TileObject PlaceThing_Tiles_PlaceIt (bool newObjectType, TileObject data, int tileToCreate)
 
int[,] PlaceThing_Tiles_GetAutoAccessoryCache ()
 
int PlaceThing_Tiles_PlaceIt_GetLegacyTileStyle (int style)
 
void PlaceThing_Tiles_PlaceIt_UnslopeForSolids ()
 
void PlaceThing_Tiles_PlaceIt_KillGrassForSolids ()
 
void PlaceThing_Tiles_PlaceIt_AutoPaintAndActuate (int[,] typeCaches, int tileToCreate)
 
void PlaceThing_Tiles_PlaceIt_SpinSmartPlatform ()
 
void PlaceThing_Tiles_PlaceIt_TriggerLogicLamp ()
 
void PlaceThing_Tiles_PlaceIt_SpinBedsAndBaths ()
 
void PlaceThing_Tiles_PlaceIt_SpinChairs ()
 
void PlaceThing_Tiles_PlaceIt_SpinTraps ()
 
void PlaceThing_Tiles_PlaceIt_AdjustPlants ()
 
bool PlaceThing_Tiles_PlaceIt_StaffOfRegrowthCheck (bool placed)
 
bool PlaceThing_Tiles_BlockPlacementForAssortedThings (bool canPlace)
 
bool PlaceThing_Tiles_CheckLavaBlocking ()
 
bool PlaceThing_Tiles_CheckRopeUsability (bool canUse)
 
bool PlaceThing_Tiles_CheckFlexibleWand (bool canUse)
 
bool PlaceThing_Tiles_CheckWandUsability (bool canUse)
 
bool PlaceThing_Tiles_CheckGamepadTorchUsability (bool canUse)
 
void PlaceThing_LockChest ()
 
void PlaceThing_ItemInExtractinator (ref ItemCheckContext context)
 
void PlaceThing_XMasTreeTops ()
 
void PlaceThing_CannonBall ()
 
void PlaceThing_PaintScrapper ()
 
void PlaceThing_PaintScrapper_LongMoss (int x, int y)
 
void PlaceThing_PaintScrapper_TryScrapping (int x, int y)
 
void PlaceThing_PaintRoller ()
 
void PlaceThing_Paintbrush ()
 
void TryPainting (int x, int y, bool paintingAWall=false, bool applyItemAnimation=true)
 
void ApplyCoating (int x, int y, bool paintingAWall, bool applyItemAnimation, Item targetItem)
 
void ApplyPaint (int x, int y, bool paintingAWall, bool applyItemAnimation, Item targetItem)
 
void ShootFromCannon (int x, int y)
 
void ExtractinatorUse (int extractType, int extractinatorBlockType)
 
void DropItemFromExtractinator (int itemType, int stack)
 
float Fishing_GetPowerMultiplier (Item pole, Item bait)
 
void Fishing_GetBait (out Item bait)
 
void Fishing_GetBestFishingPole (out Item pole)
 
void PayDD2CrystalsBeforeUse (Item item)
 
bool CheckDD2CrystalPaymentLock (Item item)
 
int GetRequiredDD2CrystalsToUse (Item item)
 
void ItemCheck_Inner ()
 
void UpdatePlacementPreview (Item sItem)
 
void FigureOutWhatToPlace (Tile targetTile, Item sItem, out int tileToCreate, out int previewPlaceStyle, out bool? overrideCanPlace, out int? forcedRandom)
 
void ItemCheck_OwnerOnlyCode (ref ItemCheckContext context, Item sItem, int weaponDamage, Rectangle heldItemFrame)
 
void ItemCheck_EmitFoodParticles (Item sItem)
 
void ItemCheck_EmitDrinkParticles (Item sItem)
 
void ItemCheck_UseBossSpawners (int onWhichPlayer, Item sItem)
 
void ItemCheck_UseEventItems (Item sItem)
 
void ItemCheck_ReleaseCritter (Item sItem)
 
void ItemCheck_MeleeHitPVP (Item sItem, Rectangle itemRectangle, int damage, float knockBack)
 
void Volcano_TrySpawningVolcano (NPC npc, Item sItem, float damage, float knockBack, Rectangle itemRectangle)
 
void TentacleSpike_TrySpiking (NPC npc, Item sItem, float damage, float knockBack)
 
void BloodButcherer_TryButchering (NPC npc, Item sItem, float damage, float knockBack)
 
void BatBat_TryLifeLeeching (Entity entity)
 
void ItemCheck_MeleeHitNPCs (Item sItem, Rectangle itemRectangle, int originalDamage, float knockBack)
 
void ProcessHitAgainstNPC (Item sItem, Rectangle itemRectangle, int originalDamage, float knockBack, int npcIndex)
 
void ApplyNPCOnHitEffects (Item sItem, Rectangle itemRectangle, int damage, float knockBack, int npcIndex, int dmgRandomized, int dmgDone)
 
void ItemCheck_EmitHammushProjectiles (int i, Item sItem, Rectangle itemRectangle, int damage)
 
bool[] ItemCheck_GetTileCutIgnoreList (Item sItem)
 
void ItemCheck_CutTiles (Item sItem, Rectangle itemRectangle, bool[] shouldIgnore)
 
Rectangle ItemCheck_CatchCritters (Item sItem, Rectangle itemRectangle)
 
void GetPointOnSwungItemPath (float spriteWidth, float spriteHeight, float normalizedPointOnPath, float itemScale, out Vector2 location, out Vector2 outwardDirection)
 
Rectangle ItemCheck_EmitUseVisuals (Item sItem, Rectangle itemRectangle)
 
void ItemCheck_GetMeleeHitbox (Item sItem, Rectangle heldItemFrame, out bool dontAttack, out Rectangle itemRectangle)
 
void ItemCheck_UseDemonHeart (Item sItem)
 
void ItemCheck_UseMinecartPowerUp (Item sItem)
 
void ItemCheck_UseArtisanLoaf (Item sItem)
 
void ItemCheck_UseTorchGodsFavor (Item sItem)
 
void ItemCheck_TryDestroyingDrones (Item sItem)
 
void ItemCheck_UseManaCrystal (Item sItem)
 
void ItemCheck_UseLifeFruit (Item sItem)
 
void ItemCheck_UseLifeCrystal (Item sItem)
 
void ItemCheck_UseCombatBook (Item sItem)
 
void ItemCheck_UsePetLicenses (Item sItem)
 
void ItemCheck_UsePeddlersSatchel (Item sItem)
 
void ItemCheck_UseShimmerPermanentItems (Item sItem)
 
void LicenseOrExchangePet (Item sItem, ref bool petBoughtFlag, int npcType, string textKeyForLicense, int netMessageData)
 
void ItemCheck_UseTeleportRod (Item sItem)
 
bool IsTilePoundable (Tile targetTile)
 
void UseShovel (Player user, Item item, int sX, int sY)
 
void DamageTileWithShovel (Player user, Item item, int x, int y)
 
void ItemCheck_UseMiningTools (Item sItem)
 
void ItemCheck_UseMiningTools_ActuallyUseMiningTool (Item sItem, out bool canHitWalls, int x, int y)
 
bool IsBottomOfTreeTrunkNoRoots (int x, int y)
 
void TryReplantingTree (int x, int y)
 
void ItemCheck_UseMiningTools_TryHittingWall (Item sItem, int wX, int wY)
 
void ItemCheck_UseMiningTools_TryPoundingTile (Item sItem, int tileHitId, ref bool hitWall, int x, int y)
 
void ItemCheck_UseBuckets (Item sItem)
 
void ItemCheck_PlayInstruments (Item sItem)
 
bool GetSparkleGuitarTarget (out List< NPC > validTargets)
 
bool GetZenithTarget (Vector2 searchCenter, float maxDistance, out int npcTargetIndex)
 
void ItemCheck_UseWiringTools (Item sItem)
 
void ItemCheck_UseLawnMower (Item sItem)
 
void DestroyOldestProximityMinesOverMinesCap (int minesCap)
 
void ItemCheck_Shoot (int i, Item sItem, int weaponDamage)
 
Point FindSharpTearsSpot (Vector2 targetSpot)
 
bool FindSharpTearsOpening (int x, int y, bool acceptLeft, bool acceptRight, bool acceptUp, bool acceptDown)
 
void ItemCheck_MinionAltFeatureUse (Item sItem, bool cShoot)
 
void ItemCheck_TurretAltFeatureUse (Item sItem, bool cShoot)
 
void EmitMaxManaEffect ()
 
void ItemCheck_EmitHeldItemLight (Item sItem)
 
void ItemCheck_ApplyHoldStyle (float mountOffset, Item sItem, Rectangle heldItemFrame)
 
void ItemCheck_ApplyHoldStyle_Inner (float mountOffset, Item sItem, Rectangle heldItemFrame)
 
void ItemCheck_ApplyManaRegenDelay (Item sItem)
 
void ItemCheck_ApplyUseStyle_Inner (float mountOffset, Item sItem, Rectangle heldItemFrame)
 
void ItemCheck_StartActualUse (Item sItem)
 
void FreeUpPetsAndMinions (Item sItem)
 
void ApplyPotionDelay (Item sItem)
 
void ApplyLifeAndOrMana (Item item)
 
bool ItemCheck_CheckCanUse (Item sItem)
 
bool ItemCheck_CheckUsabilityOfProjectiles (bool canUse)
 
bool ItemCheck_CheckFishingBobbers (bool canUse)
 
void ItemCheck_CheckFishingBobber_PullBobber (Projectile bobber, int baitTypeUsed)
 
void ItemCheck_CheckFishingBobber_PickAndConsumeBait (Projectile bobber, out bool pullTheBobber, out int baitTypeUsed)
 
bool ItemCheck_PayMana (Item sItem, bool canUse)
 
void ItemCheck_TryPlacingWearablesOnMannequins (Item sItem)
 
void ApplyReuseDelay ()
 
void ItemCheck_HackHoldStyles (Item sItem)
 
void ItemCheck_HandleMPItemAnimation (Item sItem)
 
void TryAllowingItemReuse (Item sItem)
 
void ItemCheck_HandleMount ()
 
void ItemCheck_ApplyPetBuffs (Item sItem)
 
bool PickAmmo_TryFindingSpecificMatches (int launcher, int ammo, out int pickedProjectileId)
 
void ClearMiningCacheAt (int x, int y, int hitTileCacheType)
 
int GetPickaxeDamage (int x, int y, int pickPower, int hitBufferIndex, Tile tileTarget)
 
bool DoesPickTargetTransformOnKill (HitTile hitCounter, int damage, int x, int y, int pickPower, int bufferIndex, Tile tileTarget)
 
IEnumerable< ItemDropItems_GetDefaults ()
 
void DropItems_End (IList< Item > startInventory)
 
void CloneLoadouts (Player clonePlayer)
 
void SaveTemporaryItemSlotContents (BinaryWriter writer)
 
void LoadTemporaryItemSlotContents (BinaryReader reader)
 
void FixLoadedData_Items (Item[] items)
 
void GetAnglerReward_MainReward (List< Item > rewardItems, IEntitySource source, int questsDone, float rarityReduction, int questItemType, ref GetItemSettings anglerRewardSettings)
 
void GetAnglerReward_Decoration (List< Item > rewardItems, IEntitySource source, int questsDone, float rarityReduction, ref GetItemSettings anglerRewardSettings)
 
void GetAnglerReward_Bait (List< Item > rewardItems, IEntitySource source, int questsDone, float rarityReduction, ref GetItemSettings anglerRewardSettings)
 
void GetAnglerReward_Money (List< Item > rewardItems, IEntitySource source, int questsDone, float rarityReduction, ref GetItemSettings anglerRewardSettings)
 
void RemoveAnglerAccOptionsFromRewardPool (List< int > itemIdsOfAccsWeWant, Item itemToTestAgainst)
 

Static Private Member Functions

static void OpenInventory ()
 
static int ClampHotbarOffset (int Offset)
 
static bool TryPurchasing (long price, List< Item[]> inv, List< Point > slotCoins, List< Point > slotsEmpty, List< Point > slotEmptyBank, List< Point > slotEmptyBank2, List< Point > slotEmptyBank3, List< Point > slotEmptyBank4)
 
static int Spawn_DescendFromDefaultSpace (int x, int y)
 
static void Spawn_ForceClearArea (int floorX, int floorY)
 
static float VanillaBaseDefenseEffectiveness ()
 
static bool AllowShimmerDodge (PlayerDeathReason damageSource, int cooldownCounter, bool dodgeable)
 
static void PlaceThing_Tiles_BlockPlacementForRepeatedPumpkins (ref bool canPlace, ref TileObject data)
 
static void PlaceThing_Tiles_BlockPlacementForRepeatedCoralAndBeachPiles (ref bool canPlace, ref TileObject data)
 
static void PlaceThing_Tiles_BlockPlacementForRepeatedPigronatas (ref bool canPlace, ref TileObject data)
 
static void PlaceThing_Tiles_BlockPlacementIfOverPlayers (ref bool canPlace, ref TileObject data)
 
static ItemTrader TryGettingItemTraderFromBlock (Tile targetBlock)
 
static void ItemCheck_UseMiningTools_TryFindingWallToHammer (out int wX, out int wY)
 
static bool ItemCheck_IsValidDirtRodTarget (Tile t)
 
static bool CheckSpawn_Internal (int x, int y)
 
static void InternalSavePlayerFile (PlayerFileData playerFile)
 
static void Serialize (PlayerFileData playerFile, Player newPlayer, BinaryWriter fileIO)
 
static void Deserialize (PlayerFileData data, Player newPlayer, BinaryReader fileIO, int release, out bool gotToReadName)
 
static void Deserialize (PlayerFileData data, Player newPlayer, BinaryReader fileIO, TagCompound modData, int release, out bool gotToReadName)
 
static void AdjustRespawnTimerForWorldJoining (Player newPlayer)
 
static void LoadPlayer_LastMinuteFixes (Player newPlayer)
 
static void LoadPlayer_LastMinuteFixes (Player newPlayer, Item item)
 
static void LoadPlayer_Finish (Player newPlayer)
 

Private Attributes

bool dontConsumeWand
 
bool _sandStormLogicEnabled
 
bool _wasInShimmerZone
 
int _timeSinceLastImmuneGet
 
int _immuneStrikes
 
ChannelCancelKey _channelShotCache
 
EntityShadowInfo[] _advancedShadows = new EntityShadowInfo[60]
 
int _lastAddedAvancedShadow
 
bool[] _adjTile = new bool[TileLoader.TileCount]
 
bool[] _oldAdjTile = new bool[TileLoader.TileCount]
 
bool _batbatCanHeal
 
bool _spawnTentacleSpikes
 
bool _spawnBloodButcherer
 
bool _spawnVolcanoExplosion
 
bool _spawnMuramasaCut
 
HashSet< Point > _blackListedTileCoordsForGrappling = new HashSet<Point>()
 
bool makeStrongBee
 
float _stormShaderObstruction = 1f
 
float _shaderObstructionInternalValue = 1f
 
int graveImmediateTime
 
float _deerclopsBlizzardSmoothedEffect
 
int _lastSmartCursorToolStrategy = -1
 
bool[] nearbyTorch = new bool[TorchID.Count]
 
bool dryCoralTorch
 
int luckyTorchCounter
 
int nearbyTorches
 
Vector2 _nextTorchLuckCheckCenter
 
int torchFunTimer
 
int torchGodCooldown
 
int numberOfTorchAttacksMade
 
int[] unlitTorchX = new int[maxTorchAttacks]
 
int[] unlitTorchY = new int[maxTorchAttacks]
 
int _quickGrappleCooldown
 
bool _forceForwardCursor
 
Point _inputMouseCoordsForward
 
Point _mainMouseCoordsForward
 
bool _forceSmartSelectCursor
 
Point _inputMouseCoordsSmartSelect
 
Point _mainMouseCoordsSmartSelect
 
Point _tileTargetSmartSelect
 
bool botherWithUnaimedMinecartTracks = true
 
List< int > _projectilesToInteractWith = new List<int>()
 
int _lockTileInteractionsTimer
 
Player _clientClone
 
int consumedLifeCrystals
 
int consumedLifeFruit
 
int consumedManaCrystals
 
DamageClassData[] damageData
 
ExtraJumpState[] extraJumps = new ExtraJumpState[ExtraJumpLoader.ExtraJumpCount]
 

Static Private Attributes

static bool disabledBlizzardGraphic = false
 
static bool disabledBlizzardSound = false
 
static float _blizzardSoundVolume
 
static SlotId _strongBlizzardSound = SlotId.Invalid
 
static SlotId _insideBlizzardSound = SlotId.Invalid
 
const int MaxAdvancedShadows = 60
 
static float itemGrabSpeed = 0.45f
 
static float itemGrabSpeedMax = 4f
 
static List< NPC_hallucinationCandidates = new List<NPC>()
 
static SmartInteractSystem _smartInteractSys = new SmartInteractSystem()
 
static int maxTorchAttacks = 200
 
static int[] _torchAttackPosX = new int[400]
 
static int[] _torchAttackPosY = new int[400]
 
static Point[] _tentacleSpikesMax5 = (Point[])(object)new Point[5]
 
static Point[] _bloodButchererMax5 = (Point[])(object)new Point[5]
 
static List< Projectile_oldestProjCheckList = new List<Projectile>()
 
const int SaveSlotIndex_MouseItem = 0
 
const int SaveSlotIndex_CreativeSacrifice = 1
 
const int SaveSlotIndex_GuideItem = 2
 
const int SaveSlotIndex_TinkererItem = 3
 
const int SaveSlotIndexCount = 4
 
static readonly PlayerFileData _visualCloneDummyData = new PlayerFileData()
 
static readonly MemoryStream _visualCloneStream = new MemoryStream()
 
static readonly BinaryWriter _visualCloneWriter = new BinaryWriter(_visualCloneStream)
 
static readonly BinaryReader _visualCloneReader = new BinaryReader(_visualCloneStream)
 

Detailed Description

Definition at line 50 of file Player.cs.


The documentation for this class was generated from the following file: