tModLoader v2023.01
A mod to make and play Terraria mods
Terraria.Player Class Reference

Inherits Terraria.Entity, and IEntityWithInstances< ModPlayer >.

Classes

class  BuilderAccToggleIDs
 
struct  CompositeArmData
 
class  Hooks
 
struct  ItemSpaceStatus
 
struct  OverheadMessage
 
struct  RabbitOrderFrameHelper
 
class  RandomTeleportationAttemptSettings
 
class  SavedPlayerDataWithAnnoyingRules
 
class  SelectionRadial
 
class  Settings
 
class  SmartCursorSettings
 

Public Types

enum  CompositeArmStretchAmount { Full , None , Quarter , ThreeQuarters }
 

Public Member Functions

void AccumulateGolfingScore (int score)
 
void AddBuff (int type, int timeToAdd, bool quiet=true, bool foodHack=false)
 Gives the player the provided buff. This accounts for if the player is immune to the buff. This also accounts for adjusting the buff time for different game modes. If the player already has the buff, the re-apply logic will happen. Vanilla buff types are found in BuffID and modded buffs are typically retrieved using ModContent.BuffType<T>. The quiet parameter will determine if the network sync message should happen. This should only be set to false in non-deterministic situations (such as random chance) and code that only runs locally. Other situations, run on all clients so the buff should automatically be applied on all clients, keeping the player buff data in sync without burdening the network. When in doubt, consult vanilla source code examples or test your code. More...
 
void addDPS (int dmg)
 
void AddImmuneTime (int cooldownCounterId, int immuneTime)
 Adds to either Player.immuneTime or Player.hurtCooldowns based on the cooldownCounterId More...
 
void AdjTiles ()
 
void ApplyArmorSoundAndDustChanges ()
 
void ApplyDamageToNPC (NPC npc, int damage, float knockback, int direction, bool crit)
 
void ApplyEquipFunctional (Item currentItem, bool hideVisual)
 
void ApplyEquipVanity (Item currentItem)
 
void ApplyItemAnimation (Item sItem)
 
void ApplyItemAnimation (Item sItem, float multiplier, int? itemReuseDelay=null)
 
void ApplyItemTime (Item sItem, float multiplier=1, bool? callUseItem=null)
 
Vector2 ApplyRangeCompensation (float rangeCompensation, Vector2 startPos, Vector2 targetPos)
 
int ArmorSetDye ()
 
void AutoFinchStaff ()
 
int beeDamage (int dmg)
 
float beeKB (float KB)
 
int beeType ()
 
int BiomeTorchHoldStyle (int style)
 
int BiomeTorchPlaceStyle (int style)
 
void BordersMovement ()
 
void BrainOfConfusionDodge ()
 
void BuffHandle_SpawnPetIfNeeded (ref bool petBool, int petProjID, int buffIndex)
 
void BuffHandle_SpawnPetIfNeededAndSetTime (int buffIndex, ref bool petBool, int petProjID, int buffTimeToGive=18000)
 
bool BuyItem (int price, int customCurrency=-1)
 
bool CanAcceptItemIntoInventory (Item item)
 
bool CanAutoReuseItem (Item sItem)
 
bool CanBuyItem (int price, int customCurrency=-1)
 
bool CanDemonHeartAccessoryBeShown ()
 
bool CanFitSpace (int heightBoost)
 
bool CanGoIntoAmmoOnPickup (Item theSlot, Item theItemToAccept)
 
bool CanHit (Entity ent)
 
bool CanItemSlotAccept (Item theSlot, Item theItemToAccept)
 
bool CanMasterModeAccessoryBeShown ()
 
bool CanNPCBeHitByPlayerOrPlayerProjectile (NPC npc, Projectile projectile=null)
 
bool CanParryAgainst (Rectangle blockingPlayerRect, Rectangle enemyRect, Vector2 enemyVelocity)
 
bool CanPullItem (Item item, ItemSpaceStatus status)
 
bool CanSnapToPosition (Vector2 offset)
 
bool CanVisuallyHoldItem (Item item)
 
void CarpetMovement ()
 
void ChangeDir (int dir)
 
void ChangeSpawn (int x, int y)
 
Color ChatColor ()
 
void CheckCrackedBrickBreak ()
 
void checkDPSTime ()
 
void CheckDrowning ()
 
Vector2 CheckForGoodTeleportationSpot (ref bool canSpawn, int teleportStartX, int teleportRangeX, int teleportStartY, int teleportRangeY, RandomTeleportationAttemptSettings settings)
 
void CheckIceBreak ()
 
bool CheckMana (int amount, bool pay=false, bool blockQuickMana=false)
 
bool CheckMana (Item item, int amount=-1, bool pay=false, bool blockQuickMana=false)
 
Item ChooseAmmo (Item weapon)
 Attempts to select an ammo item stack from this player's inventory to shoot with the given weapon. More...
 
void ClearBuff (int type)
 Removes the provided buff type from the player and shuffles the remaining buff indexes down to fill the gap. Use Player.DelBuff(int) if you only know the buff index More...
 
void ClearGrapplingBlacklist ()
 
object clientClone ()
 
object Clone ()
 
void CloseSign ()
 
void CollectTaxes ()
 
int CollideWithNPCs (Rectangle myRect, float Damage, float Knockback, int NPCImmuneTime, int PlayerImmuneTime)
 
void CommandForbiddenStorm ()
 
bool ConsumeItem (int type, bool reverseOrder=false)
 
bool ConsumeSolarFlare ()
 
void CopyVisuals (Player other)
 
int CountBuffs ()
 
void Counterweight (Vector2 hitPos, int dmg, float kb)
 
int CountItem (int type, int stopCountingAt=0)
 
void DashMovement ()
 
delegate void DashStartAction (int dashDirection)
 
void DelBuff (int b)
 Removes the buff at the provided index and shuffles the remaining buff indexes down to fill the gap. Use Player.ClearBuff if you only know the buff type More...
 
void DemonConch ()
 
void DisplayDollUpdate ()
 
void DoBootsEffect (Utils.TileActionAttempt theEffectMethod)
 
bool DoBootsEffect_PlaceFlamesOnTile (int X, int Y)
 
bool DoBootsEffect_PlaceFlowersOnTile (int X, int Y)
 
void DoCoins (int i)
 
void DoPotionOfReturnReturnToOriginalUsePosition ()
 
void DoPotionOfReturnTeleportationAndSetTheComebackPoint ()
 
void DoQueenSlimeHookTeleport (Vector2 targetPosition)
 
void DoubleJumpVisuals ()
 
bool DropAnglerAccByMissing (List< int > itemIdsOfAccsWeWant, int randomChanceForASingleAcc, out bool botheredRollingForADrop, out int itemIdToDrop)
 
int DropCoins ()
 
void DropFromItem (int itemType)
 
void DropItem (IEntitySource source, Vector2 position, ref Item item)
 Drops the ref'd item from the player at the position, and than turns the ref'd Item to air.
 
void dropItemCheck ()
 
void DropItems ()
 
void DropSelectedItem ()
 
void DropTombstone (int coinsOwned, NetworkText deathText, int hitDirection)
 
void DryCollision (bool fallThrough, bool ignorePlats)
 
Item FillAmmo (int plr, Item newItem, GetItemSettings settings)
 
int FindBuffIndex (int type)
 
int FindItem (bool[] validtypes)
 
int FindItem (int netid)
 
int FindItem (List< int > netids)
 
void FindPulley ()
 
void FindSentryRestingSpot (int checkProj, out int worldX, out int worldY, out int pushYUp)
 
void FindSpawn ()
 
void FlipItemLocationAndRotationForGravity ()
 
void FloorVisuals (bool Falling)
 
void ForceUpdateBiomes ()
 
void GamepadEnableGrappleCooldown ()
 
float GetAdjustedItemScale (Item item)
 Used to determine what the overall scale of an item should be.
CombinedHooks.ModifyItemScale is called here. More...
 
EntityShadowInfo GetAdvancedShadow (int shadowIndex)
 
int GetAmountOfExtraAccessorySlotsToShow ()
 
void GetAnglerReward (NPC angler)
 
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 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. More...
 
ref float GetAttackSpeed (DamageClass damageClass)
 Gets the attack speed modifier for this damage type on this player. This returns a reference, and as such, you can freely modify this method's return values with operators.
 
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. More...
 
Vector2 GetBackHandPosition (CompositeArmStretchAmount stretch, float rotation)
 
Item GetBestPickaxe ()
 
ref float GetCritChance (DamageClass damageClass)
 Gets the crit chance modifier for this damage type on this player. This returns a reference, and as such, you can freely modify this method's return value with operators.
 
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. More...
 
ref StatModifier GetDamage (DamageClass damageClass)
 Gets the damage modifier for this damage type on this player. This returns a reference, and as such, you can freely modify this method's return value with operators.
 
ref StatModifier GetDamage< T > ()
 Gets the damage modifier for this damage type on this player. This returns a reference, and as such, you can freely modify this method's return value with operators. More...
 
Color GetDeathAlpha (Color newColor)
 
int getDPS ()
 
void GetDyeTraderReward (NPC dyeTrader)
 
Vector2 GetFaceHeadOffsetFromHelmet ()
 
Vector2 GetFarthestSpawnPositionOnLine (Vector2 startPos, float speedX, float speedY)
 
PlayerFishingConditions GetFishingConditions ()
 
Vector2 GetFrontHandPosition (CompositeArmStretchAmount stretch, float rotation)
 
Color GetHairColor (bool useLighting=true)
 
Vector2 GetHairDrawOffset (int hairID, bool hatHair)
 
void GetHairSettings (out bool fullHair, out bool hatHair, out bool hideHair, out bool backHairDraw, out bool drawsBackHairWithoutHeadgear)
 
int GetHealLife (Item item, bool quickHeal=false)
 
int GetHealMana (Item item, bool quickHeal=false)
 
Vector2 GetHelmetDrawOffset ()
 
Vector2 GetHelmetOffsetAddonFromFaceHead (Vector2 headOffset)
 
Color GetImmuneAlpha (Color newColor, float alphaReduction)
 
Color GetImmuneAlphaPure (Color newColor, float alphaReduction)
 
Item GetItem (int plr, Item newItem, GetItemSettings settings)
 
Rectangle GetItemDrawFrame (int type)
 
void GetItemExpectedPrice (Item item, out int calcForSelling, out int calcForBuying)
 
int GetItemGrabRange (Item item)
 Fetches the range at which the given item begins to gravitate towards the player.
This range, referred to as item grab range, is measured in pixels. More...
 
ref 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.
 
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. More...
 
Vector2 GetLegsDrawOffset ()
 
List< int > GetListOfProjectilesToInteractWithHack ()
 
int GetManaCost (Item item)
 
GetModPlayer< T > ()
 Gets the instance of the specified ModPlayer type. This will throw exceptions on failure. More...
 
GetModPlayer< T > (T baseInstance)
 Gets the local instance of the type of the specified ModPlayer instance. This will throw exceptions on failure. More...
 
List< int > GetNearbyContainerProjectilesList ()
 
void GetOtherPlayersPickTile (int x, int y, int pickDamage)
 
void GetPreferredGolfBallToUse (out int projType)
 
Rectangle getRect ()
 
IEntitySource GetSource_Buff (int buffIndex)
 
float GetTotalArmorPenetration (DamageClass damageClass)
 
float GetTotalArmorPenetration< T > ()
 
float GetTotalAttackSpeed (DamageClass damageClass)
 
float GetTotalAttackSpeed< T > ()
 
float GetTotalCritChance (DamageClass damageClass)
 
float GetTotalCritChance< T > ()
 
StatModifier GetTotalDamage (DamageClass damageClass)
 
StatModifier GetTotalDamage< T > ()
 
StatModifier GetTotalKnockback (DamageClass damageClass)
 
StatModifier GetTotalKnockback< T > ()
 
int GetWeaponArmorPenetration (Item sItem)
 
float GetWeaponAttackSpeed (Item sItem)
 
int GetWeaponCrit (Item sItem)
 
int GetWeaponDamage (Item sItem, bool forTooltip=false)
 
float GetWeaponKnockback (Item sItem)
 
float GetWeaponKnockback (Item sItem, float baseKnockback)
 
WingStats GetWingStats (int wingID)
 
void Ghost ()
 
void GiveImmuneTimeForCollisionAttack (int time)
 
void GrappleMovement ()
 
bool HasAmmo (Item sItem)
 Whether or not the player has ammunition available for the given weapon. More...
 
bool HasBuff (int type)
 Returns whether or not this Player currently has a (de)buff of the provided type.
 
bool HasBuff< T > ()
 
bool HasEnoughPickPowerToHurtTile (int x, int y)
 
bool HasItem (int type)
 
bool HasLockedInventory ()
 
bool HasNPCBannerBuff (int bannerType)
 
bool HasUnityPotion ()
 
void Heal (int amount)
 Heals the player for a certain amount. More...
 
void HealEffect (int healAmount, bool broadcast=true)
 
void HoneyCollision (bool fallThrough, bool ignorePlats)
 
void HorizontalMovement ()
 
double Hurt (PlayerDeathReason damageSource, int Damage, int hitDirection, bool pvp=false, bool quiet=false, bool Crit=false, int cooldownCounter=-1)
 
bool InInteractionRange (int interactX, int interactY)
 
bool InModBiome (ModBiome baseInstance)
 Determines if the player is in specified ModBiome. This will throw exceptions on failure. More...
 
bool InModBiome< T > ()
 
bool InOpposingTeam (Player otherPlayer)
 
void InterruptItemUsageIfOverTile (int tileTypeToBeOver)
 
bool InZonePurity ()
 Calculates whether or not the player is in the purity/forest biome.
 
bool IsAmmoFreeThisShot (Item weapon, Item ammo, int projToShoot)
 Determines whether or not the given ammunition should be conserved, based on the given weapon as wielded by this player. More...
 
bool IsAValidEquipmentSlotForIteration (int slot)
 
bool IsBlacklistedForGrappling (Point p)
 
bool IsColorfulDye (int dye)
 
bool IsInInteractionRangeToMultiTileHitbox (int chestPointX, int chestPointY)
 
bool IsInTileInteractionRange (int targetX, int targetY)
 
bool isNearFairy ()
 
bool isNearNPC (int type, float range=-1f)
 
bool IsProjectileInteractibleAndInInteractionRange (Projectile proj, ref Vector2 compareSpot)
 
bool IsStackingItems ()
 
bool IsTargetTileInItemRange (Item sItem)
 
bool IsTileTypeInInteractionRange (int targetTileType)
 
bool IsWithinSnappngRangeToTile (int x, int y, int distanceInPixels)
 
void ItemCheck (int i)
 
void ItemCheck_ApplyUseStyle (float mountOffset, Item sItem, Rectangle heldItemFrame)
 
void ItemCheck_ApplyUseStyle_Inner (float mountOffset, Item sItem, Rectangle heldItemFrame)
 
void ItemCheck_ManageRightClickFeatures ()
 
void ItemCheck_ManageRightClickFeatures_ShieldRaise (bool theGeneralCheck)
 
bool ItemFitsItemFrame (Item i)
 
bool ItemFitsWeaponRack (Item i)
 
bool ItemIsVisuallyIncompatible (Item item)
 
ItemSpaceStatus ItemSpace (Item newItem)
 
bool ItemSpaceForCofveve (Item newItem)
 
void JumpMovement ()
 
void KeyDoubleTap (int keyDir)
 
void KeyHoldDown (int keyDir, int holdTime)
 
void KillMe (PlayerDeathReason damageSource, double dmg, int hitDirection, bool pvp=false)
 
void KillMeForGood ()
 
void LimitPointToPlayerReachableArea (ref Vector2 pointPoisition)
 
void LockGamepadTileInteractions ()
 
void LookForTileInteractions ()
 
void MagicConch ()
 
void ManaEffect (int manaAmount)
 
void ManageSpecialBiomeVisuals (string biomeName, bool inZone, Vector2 activationSource=default(Vector2))
 
void MinionNPCTargetAim (bool doNotDisableIfTheTargetIsTheSame)
 
void MinionRestTargetAim ()
 
void MoonLeechRope ()
 
void NebulaLevelup (int type)
 
void NinjaDodge ()
 
void OnHit (float x, float y, Entity victim)
 
void OnKillNPC (ref NPCKillAttempt attempt, object externalKillingBlowSource)
 
void OpenBossBag (int type)
 
void OpenCanofWorms (int sourceItemType)
 
void OpenCapricornLegs (int sourceItemType)
 
void OpenCapricornTail (int sourceItemType)
 
void OpenChest (int x, int y, int newChest)
 Handles boilerplate for gamepad and UI when opening or closing a container.
Sets Player.chestX, and Player.chestY, and Player.chest to the given coordinates. More...
 
void OpenFishingCrate (int crateItemID)
 
void OpenGoodieBag (int itemType)
 
void OpenHerbBag (int bagType)
 
void OpenLockBox (int lockboxItemType)
 
void OpenOyster (int sourceItemType)
 
void OpenPresent (int itemType)
 
void OpenShadowLockbox (int boxType)
 
void PetAnimal (int animalNpcIndex)
 
bool PickAmmo (Item weapon, out int projToShoot, out float speed, out int damage, out float knockBack, out int usedAmmoItemId, bool dontConsume=false)
 A more-convenient-to-call variant of the vanilla PickAmmo method, which handles most vanilla ammunition logic to decide various common stats related to ammunition-consuming weapons.
The stats output by this method take into account any extra stats which the ammunition it finds may provide (read: it accounts for ammo damage and knockback).
More...
 
void PickTile (int x, int y, int pickPower)
 
void PlaceThing ()
 
void PlaceWeapon (int x, int y)
 
void PlayDroppedItemAnimation (int time)
 
void PlayDrums (float range)
 
void PlayerFrame ()
 
void PlayGuitarChord (float range)
 
void PutItemInInventoryFromItemUsage (int type, int theSelectedItem=-1)
 
void QuickBuff ()
 
void QuickGrapple ()
 
Item QuickGrapple_GetItemToUse ()
 
void QuickHeal ()
 
Item QuickHeal_GetItemToUse ()
 
void QuickMana ()
 
Item QuickMana_GetItemToUse ()
 
void QuickMount ()
 
Item QuickMount_GetItemToUse ()
 
int QuickSpawnClonedItem (IEntitySource source, Item item, int stack=1)
 Will spawn an item like Player.QuickSpawnItem(IEntitySource, int, int), but clones it (handy when you need to retain item infos) More...
 
Item QuickSpawnClonedItemDirect (IEntitySource source, Item item, int stack=1)
 
int QuickSpawnItem (IEntitySource source, int item, int stack=1)
 Spawns an item into the world at this players position. This is a simpler alternative to Item.NewItem(IEntitySource, int, int, int, int, int, int, bool, int, bool, bool). This method can be called from multiplayer client code without necessitating manually syncing the item.
Use QuickSpawnItem(IEntitySource, Item, int) if a specific instance of an Item needs to be spawned into the world to preserve modded data. More...
 
int QuickSpawnItem (IEntitySource source, Item item, int stack=1)
 
Item QuickSpawnItemDirect (IEntitySource source, int type, int stack=1)
 
Item QuickSpawnItemDirect (IEntitySource source, Item item, int stack=1)
 
void QuickStackAllChests ()
 
void RecalculateLuck ()
 
void RefreshItems ()
 
void RefreshMovementAbilities (bool doubleJumps=true)
 
void RemoveAllFishingBobbers ()
 
void RemoveAllGrapplingHooks ()
 
void RemoveSpawn ()
 
void ResetAdvancedShadows ()
 
void ResetEffects ()
 
void ResetFloorFlags ()
 
void ResetVisibleAccessories ()
 
int RollLuck (int range)
 
Vector2 RotatedRelativePoint (Vector2 pos, bool reverseRotation=false, bool addGfxOffY=true)
 
Vector2 RotatedRelativePointOld (Vector2 pos, bool rotateForward=true)
 
void RotateRelativePoint (ref float x, ref float y)
 
void ScrollHotbar (int Offset)
 
bool SellItem (Item item, int stack=-1)
 
void SetArmorEffectVisuals (Player drawPlayer)
 
void SetCompositeArmBack (bool enabled, CompositeArmStretchAmount stretch, float rotation)
 
void SetCompositeArmFront (bool enabled, CompositeArmStretchAmount stretch, float rotation)
 
void SetDummyItemTime (int frames)
 
void SetImmuneTimeForAllTypes (int time)
 
void SetItemAnimation (int frames)
 
void SetItemTime (int frames)
 
void SetPlayerDataToOutOfClassFields ()
 
void SetTalkNPC (int npcIndex, bool fromNet=false)
 
void ShadowDodge ()
 
bool ShouldDrawFootball ()
 
bool ShouldDrawWingsThatAreAlwaysAnimated ()
 
void SlopeDownMovement ()
 
void SlopingCollision (bool fallThrough, bool ignorePlats)
 
void SmartInteractLookup ()
 
void SmartSelectLookup ()
 
void Spawn (PlayerSpawnContext context)
 
int SpawnMinionOnCursor (IEntitySource projectileSource, int ownerIndex, int minionProjectileId, int originalDamageNotScaledByMinionDamage, float KnockBack, Vector2 offsetFromCursor=default(Vector2), Vector2 velocityOnSpawn=default(Vector2))
 
void SporeSac (Item sourceItem)
 
void StatusFromNPC (NPC npc)
 
void StatusToNPC (int type, int i)
 
void StatusToPlayerPvP (int type, int i)
 
void StickyMovement ()
 
void StopVanityActions (bool multiplayerBroadcast=true)
 
bool SummonItemCheck ()
 
void TakeUnityPotion ()
 
bool TeamChangeAllowed ()
 
void Teleport (Vector2 newPos, int Style=0, int extraInfo=0)
 
void TeleportationPotion ()
 
void TileInteractionsCheck (int myX, int myY)
 
void ToggleCreativeMenu ()
 
void ToggleInv ()
 
void ToggleLight ()
 
void TogglePet ()
 
bool TryGetModPlayer< T > (out T result)
 Gets the instance of the specified ModPlayer type. More...
 
bool TryGetModPlayer< T > (T baseInstance, out T result)
 Safely attempts to get the local instance of the type of the specified ModPlayer instance. More...
 
void TryGettingDevArmor (IEntitySource source)
 
void TryInterruptingItemUsage ()
 
void TryOpeningFullscreenMap ()
 
bool TryPlacingAGolfBallNearANearbyTee (Vector2 placePosition)
 
void TryPortalJumping ()
 
void TryTogglingShield (bool shouldGuard)
 
void UnityTeleport (Vector2 telePos)
 
void Update (int i)
 
void Update_NPCCollision ()
 
void UpdateAdvancedShadows ()
 
void UpdateArmorLights ()
 
void UpdateArmorSets (int i)
 
void UpdateBiomes ()
 
void UpdateBlacklistedTilesForGrappling ()
 
void UpdateBuffs (int i)
 
void UpdateDead ()
 
void UpdateDyes ()
 
void UpdateEquips (int i)
 
void UpdateForbiddenSetLock ()
 
void UpdateHairDyeDust ()
 
void UpdateHungerBuffs ()
 
void UpdateImmunity ()
 
void UpdateJumpHeight ()
 
void UpdateLifeRegen ()
 
void UpdateLuckFactors ()
 
void UpdateManaRegen ()
 
void UpdateMaxTurrets ()
 
void UpdateMinionTarget ()
 
void UpdateMiscCounter ()
 
void UpdateNearbyInteractibleProjectilesList ()
 
void UpdatePet (int i)
 
void UpdatePetLight (int i)
 
void UpdateSocialShadow ()
 
void UpdateStarvingState (bool withEmote)
 
void UpdateTeleportVisuals ()
 
void UpdateTouchingTiles ()
 
void UpdateVisibleAccessories (Item item, bool invisible, int slot=-1, bool modded=false)
 Invoked in UpdateVisibleAccessories. Runs common code for both modded slots and vanilla slots based on provided Items.
 
void UpdateVisibleAccessory (int itemSlot, Item item, bool modded=false)
 
void UseHealthMaxIncreasingItem (int increase)
 
void UseManaMaxIncreasingItem (int increase)
 
void VanillaPostUpdateInventory ()
 
void VanillaPreUpdateInventory ()
 
void VanillaUpdateEquip (Item item)
 
void VanillaUpdateInventory (Item item)
 
void VolatileGelatin (Item sourceItem)
 
void WallslideMovement ()
 
void WaterCollision (bool fallThrough, bool ignorePlats)
 
void WingFrame (bool wingFlap, bool isCustomWings=false)
 
void WingMovement ()
 
void WipeOldestTurret ()
 
void WOFTongue ()
 
void Yoraiz0rEye ()
 
- Public Member Functions inherited from Terraria.Entity
float AngleFrom (Vector2 Source)
 
float AngleTo (Vector2 Destination)
 
Vector2 DirectionFrom (Vector2 Source)
 
Vector2 DirectionTo (Vector2 Destination)
 
float Distance (Vector2 Other)
 
float DistanceSQ (Vector2 Other)
 
IEntitySource GetSource_Accessory (Item item, string? context=null)
 
IEntitySource GetSource_CatchEntity (Entity caughtEntity, string? context=null)
 
IEntitySource GetSource_Death (string? context=null)
 
IEntitySource GetSource_DropAsItem (string? context=null)
 
IEntitySource GetSource_FromAI (string? context=null)
 
IEntitySource GetSource_FromThis (string? context=null)
 
IEntitySource GetSource_GiftOrReward (string? context=null)
 
IEntitySource GetSource_ItemUse (Item item, string? context=null)
 
IEntitySource GetSource_ItemUse_WithPotentialAmmo (Item item, int ammoItemId, string? context=null)
 
IEntitySource GetSource_Loot (string? context=null)
 
IEntitySource GetSource_Misc (string context)
 
IEntitySource GetSource_OnHit (Entity victim, string? context=null)
 
IEntitySource GetSource_OnHurt (Entity attacker, string? context=null)
 
IEntitySource GetSource_OpenItem (int itemType, string? context=null)
 
IEntitySource GetSource_ReleaseEntity (string? context=null)
 
IEntitySource GetSource_TileInteraction (int tileCoordsX, int tileCoordsY, string? context=null)
 
bool WithinRange (Vector2 Target, float MaxRange)
 

Static Public Member Functions

static bool CheckSpawn (int x, int y)
 
static void ClearPlayerTempInfo ()
 
static byte FindClosest (Vector2 Position, int Width, int Height)
 
static float GetClosestPlayersLuck (Point Position)
 
static float GetClosestPlayersLuck (Vector2 Position)
 
static float GetClosestRollLuck (int x, int y, int range)
 
static float GetClosestRollLuck (Vector2 position, int range)
 
static PlayerFileData GetFileData (string file, bool cloudSave)
 
static int GetFloorTileType (int x, int y)
 
static int GetMouseScrollDelta ()
 
static void InternalSaveMap (bool isCloudSave)
 
static bool IsHoveringOverABottomSideOfABed (int myX, int myY)
 
static PlayerFileData LoadPlayer (string playerPath, bool cloudSave)
 
static void LoadPlayer_LastMinuteFixes (Item item, Player newPlayer)
 Invoked at the end of loading vanilla player data from files to fix stuff that isn't initialized coming out of load. Only run on the Player select screen during loading of data. Primarily meant to prevent unwarranted first few frame fall damage/lava damage if load lagging Corrects the player.lavaMax time, wingsLogic, and no fall dmg to be accurate for the provided items in accessory slots.
 
static void SavePlayer (PlayerFileData playerFile, bool skipMapSave=false)
 
static int SetMatch (int armorslot, int type, bool male, ref bool somethingSpecial)
 
static bool WouldSpotOverlapWithSentry (int worldX, int worldY, bool lightningAura)
 
- Static Public Member Functions inherited from Terraria.Entity
static IEntitySource GetSource_NaturalSpawn ()
 
static ? IEntitySource GetSource_None ()
 
static IEntitySource GetSource_TownSpawn ()
 
static ? IEntitySource InheritSource (Entity entity)
 

Public Attributes

int _framesLeftEligibleForDeadmansChestDeathAchievement
 
int _funkytownAchievementCheckCooldown
 
int _portalPhysicsTime
 
bool abigailMinion
 
bool accCalendar
 
int accCompass
 
bool accCritterGuide
 
byte accCritterGuideCounter
 
byte accCritterGuideNumber
 
int accDepthMeter
 
bool accDivingHelm
 
bool accDreamCatcher
 
bool accFishFinder
 
bool accFishingLine
 
bool accFlipper
 
bool accJarOfSouls
 
bool accLavaFishing
 
bool accMerman
 
bool accOreFinder
 
float accRunSpeed
 
bool accStopwatch
 
bool accTackleBox
 
bool accThirdEye
 
byte accThirdEyeCounter
 
byte accThirdEyeNumber
 
int accWatch
 
bool accWeatherRadio
 
bool ActuationRodLock
 
bool ActuationRodLockSetting
 
bool adjHoney
 
bool adjLava
 
bool adjWater
 
int afkCounter
 
int aggro
 
bool alchemyTable
 
int altFunctionUse
 
bool ammoBox
 
bool ammoCost75
 
bool ammoCost80
 
bool ammoPotion
 
int anglerQuestsFinished
 
bool archery
 
bool arcticDivingGear
 
Item[] armor = new Item[20]
 
bool armorEffectDrawOutlines
 
bool armorEffectDrawOutlinesForbidden
 
bool armorEffectDrawShadow
 
bool armorEffectDrawShadowBasilisk
 
bool armorEffectDrawShadowEOCShield
 
bool armorEffectDrawShadowLokis
 
bool armorEffectDrawShadowSubtle
 
StatModifier arrowDamage = StatModifier.Default
 
int attackCD
 
bool autoActuator
 
bool autoJump
 
bool autoPaint
 
bool autoReuseGlove
 
int availableAdvancedShadowsCount
 
bool babyBird
 
bool babyFaceMonster
 
sbyte back = -1
 
sbyte backpack = -1
 
bool ballistaPanic
 
sbyte balloon = -1
 
sbyte balloonFront = -1
 
Chest bank = new Chest(bank: true)
 
Chest bank2 = new Chest(bank: true)
 
Chest bank3 = new Chest(bank: true)
 
Chest bank4 = new Chest(bank: true)
 
int bartenderQuestLog
 
float basiliskCharge
 
bool batsOfLight
 
sbyte beard = -1
 
int beardGrowthTimer
 
bool beetleBuff
 
int beetleCountdown
 
float beetleCounter
 
bool beetleDefense
 
int beetleFrame
 
int beetleFrameCounter
 
bool beetleOffense
 
int beetleOrbs
 
Vector2[] beetlePos = new Vector2[3]
 
Vector2[] beetleVel = new Vector2[3]
 
bool behindBackWall
 
bool blackBelt
 
bool blackCat
 
bool blackout
 
bool bleed
 
bool blind
 
int blockRange
 
bool blueFairy
 
int body = -1
 
Rectangle bodyFrame
 
double bodyFrameCounter
 
Vector2 bodyPosition
 
float bodyRotation
 
Vector2 bodyVelocity
 
bool boneArmor
 
Item boneGloveItem
 
int boneGloveTimer
 
int brainOfConfusionDodgeAnimationCounter
 
Item brainOfConfusionItem
 
int breath = 200
 
int breathCD
 
int breathMax = 200
 
bool brokenArmor
 
bool[] buffImmune = new bool[338]
 
int[] buffTime = new int[22]
 
int[] buffType = new int[22]
 
int[] builderAccStatus
 
StatModifier bulletDamage = StatModifier.Default
 
bool bunny
 
bool burned
 
bool cactusThorns
 
bool calmed
 
bool canCarpet
 
bool canFloatInWater
 
int cAngelHalo
 
bool canJumpAgain_Basilisk
 
bool canJumpAgain_Blizzard
 
bool canJumpAgain_Cloud
 
bool canJumpAgain_Fart
 
bool canJumpAgain_Sail
 
bool canJumpAgain_Sandstorm
 
bool canJumpAgain_Santank
 
bool canJumpAgain_Unicorn
 
bool canJumpAgain_WallOfFleshGoat
 
bool canRocket
 
bool CanSeeInvisibleBlocks
 
bool carpet
 
int carpetFrame = -1
 
float carpetFrameCounter
 
int carpetTime
 
bool cartFlip
 
int cartRampTime
 
int cBack
 
int cBackpack
 
int cBalloon
 
int cBalloonFront
 
int cBeard
 
int cBody
 
int cCarpet
 
int cFace
 
int cFaceFlower
 
int cFaceHead
 
int cFloatingTube
 
int cFront
 
int cGrapple
 
int cHandOff
 
int cHandOn
 
int changeItem = -1
 
bool channel
 
bool chaosState
 
OverheadMessage chatOverhead
 
int cHead
 
int chest = -1
 
int chestX
 
int chestY
 
bool chilled
 
bool chloroAmmoCost80
 
SelectionRadial CircularRadial = new SelectionRadial(SelectionRadial.SelectionMode.RadialCircular)
 
int cLegs
 
int cLeinShampoo
 
int cLight
 
int cMinecart
 
int cMinion
 
int cMount
 
int cNeck
 
bool coldDash
 
bool companionCube
 
CompositeArmData compositeBackArm
 
CompositeArmData compositeFrontArm
 
bool confused
 
bool controlCreativeMenu
 
bool controlDown
 
bool controlHook
 
bool controlInv
 
bool controlJump
 
bool controlLeft
 
bool controlMap
 
bool controlMount
 
bool controlQuickHeal
 
bool controlQuickMana
 
bool controlRight
 
bool controlSmart
 
bool controlThrow
 
bool controlTorch
 
bool controlUp
 
bool controlUseItem
 
bool controlUseTile
 
bool coolWhipBuff
 
bool cordage
 
int counterWeight
 
int cPet
 
int cPortalbeStool
 
bool cratePotion
 
bool creativeGodMode
 
bool creativeInterface
 
CreativeUnlocksTracker creativeTracker
 
bool crimsonHeart
 
bool crimsonRegen
 
bool crystalLeaf
 
bool cSapling
 
int cShield
 
int cShieldFallback
 
int cShoe
 
int cTail
 
int cUnicornHorn
 
ShoppingSettings currentShoppingSettings = ShoppingSettings.NotInShop
 
bool cursed
 
bool cursorItemIconEnabled
 
int cursorItemIconID
 
bool cursorItemIconReversed
 
string cursorItemIconText = ""
 
int cWaist
 
int cWings
 
int cYorai
 
bool dangerSense
 
int dash
 The current vanilla dash that the player is VISIBLY using.
Unlike dashType, this does not update if a dash cannot currently be input.

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

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

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

 
bool dazed
 
bool dd2Accessory
 
bool dead
 
bool DeadlySphereMinion
 
bool defendedByPaladin
 
bool delayUseItem
 
bool desertBoots
 
bool desertDash
 
bool detectCreature
 
byte difficulty
 
bool dino
 
bool discount
 
string displayedFishingInfo = ""
 
bool dontHurtCritters
 
bool dontStarveShader
 
DoorOpeningHelper doorHelper
 
int[] doubleTapCardinalTimer = new int[4]
 
bool downedDD2EventAnyDifficulty
 
SelectionRadial DpadRadial = new SelectionRadial()
 
int dpsDamage
 
DateTime dpsEnd
 
DateTime dpsLastHit
 
DateTime dpsStart
 
bool dpsStarted
 
float drainBoost
 
bool drawingFootball
 
bool dripping
 
bool drippingSlime
 
bool drippingSparkleSlime
 
bool dryadWard
 
Item[] dye = new Item[10]
 
bool eater
 
bool editedChestName
 
bool electrified
 
int emoteTime
 
bool empressBlade
 
bool empressBrooch
 
float endurance
 
bool enemySpawns
 
int environmentBuffImmunityTimer
 
int eocDash
 
int eocHit
 
bool equippedAnyTileRangeAcc
 
bool equippedAnyTileSpeedAcc
 
bool equippedAnyWallSpeedAcc
 
Item equippedWings = null
 
bool extraAccessory
 
int extraAccessorySlots = 2
 
int extraFall
 
bool eyebrellaCloud
 
Color eyeColor = new Color(105, 90, 75)
 
PlayerEyeHelper eyeHelper
 
bool eyeSpring
 
sbyte face = -1
 
sbyte faceFlower = -1
 
sbyte faceHead = -1
 
bool fairyBoots
 
int fallStart
 
int fallStart2
 
bool findTreasure
 
bool fireWalk
 
float firstFractalAfterImageOpacity
 
int fishingSkill
 
byte flameRingAlpha
 
byte flameRingFrame
 
float flameRingRot
 
float flameRingScale = 1f
 
bool flapSound
 
bool flinxMinion
 
bool flowerBoots
 
bool forceMerman
 
bool forceWerewolf
 
bool frogLegJumpBoost
 
sbyte front = -1
 
bool frostArmor
 
bool frostBurn
 
bool frozen
 
float fullRotation
 
Vector2 fullRotationOrigin = Vector2.Zero
 
int gem = -1
 
int gemCount
 
float gfxOffY
 
bool ghost
 
float ghostDir = 1f
 
float ghostDmg
 
float ghostFade
 
int ghostFrame
 
int ghostFrameCounter
 
bool ghostHeal
 
bool ghostHurt
 
bool gills
 
bool GoingDownWithGrapple
 
bool goldRing
 
int golferScoreAccumulated
 
int grapCount
 
int[] grappling = new int[20]
 
bool gravControl
 
bool gravControl2
 
float gravDir = 1f
 
float gravity = defaultGravity
 
bool greenFairy
 
bool grinch
 
bool gross
 
int hair
 
Color hairColor = new Color(215, 90, 55)
 
int hairDye
 
Color hairDyeColor = Color.Transparent
 
float hairDyeVar
 
Rectangle hairFrame
 
sbyte handoff = -1
 
sbyte handon = -1
 
bool happyFunTorchTime
 
bool hasAngelHalo
 
bool hasCreditsSceneMusicBox
 
bool hasFloatingTube
 
bool hasFootball
 
bool HasGardenGnomeNearby
 
bool hasJumpOption_Basilisk
 
bool hasJumpOption_Blizzard
 
bool hasJumpOption_Cloud
 
bool hasJumpOption_Fart
 
bool hasJumpOption_Sail
 
bool hasJumpOption_Sandstorm
 
bool hasJumpOption_Santank
 
bool hasJumpOption_Unicorn
 
bool hasJumpOption_WallOfFleshGoat
 
bool hasLuckyCoin
 
bool hasLucyTheAxe
 
bool hasMagiluminescence
 
bool hasMoltenQuiver
 
bool hasPaladinShield
 
bool hasRainbowCursor
 
bool hasRaisableShield
 
bool hasTitaniumStormBuff
 
bool hasUnicornHorn
 
bool hbLocked
 
int head = -1
 
bool headcovered
 
Rectangle headFrame
 
double headFrameCounter
 
Vector2 headPosition
 
float headRotation
 
Vector2 headVelocity
 
bool heartyMeal
 
int heldProj = -1
 
SoundPlaySet hermesStepSound = new SoundPlaySet()
 
bool[] hideInfo = new bool[InfoDisplayLoader.InfoDisplayCount]
 
bool hideMerman
 
BitsByte hideMisc = (byte)0
 
bool[] hideVisibleAccessory = new bool[10]
 
bool hideWolf
 
int highestAbigailCounterOriginalDamage
 
int highestStormTigerGemOriginalDamage
 
HitTile hitReplace
 
HitTile hitTile
 
int[] holdDownCardinalTimer = new int[4]
 
bool honey
 
Item honeyCombItem
 
bool hornet
 
bool hornetMinion
 
bool hostile
 
int HotbarOffset
 
bool hungry
 
bool huntressAmmoCost90
 
int[] hurtCooldowns = new int[5]
 
bool iceBarrier
 
byte iceBarrierFrame
 
byte iceBarrierFrameCounter
 
bool iceSkate
 
bool ichor
 
bool ignoreWater
 
bool immune
 
int immuneAlpha
 
int immuneAlphaDirection
 
bool immuneNoBlink
 
int immuneTime
 
bool impMinion
 
bool inferno
 
int infernoCounter
 
bool InfoAccMechShowWires
 
int insanityShadowCooldown
 
Vector2 instantMovementAccumulatedThisFrame
 
Item[] inventory = new Item[59]
 
bool[] inventoryChestStack = new bool[59]
 
bool invis
 
bool isControlledByFilm
 
bool isDisplayDollOrInanimate
 
bool isFirstFractalAfterImage
 
bool isHatRackDoll
 
bool isPerformingJump_Basilisk
 
bool isPerformingJump_Blizzard
 
bool isPerformingJump_Cloud
 
bool isPerformingJump_Fart
 
bool isPerformingJump_Sail
 
bool isPerformingJump_Sandstorm
 
bool isPerformingJump_Santank
 
bool isPerformingJump_Unicorn
 
bool isPerformingJump_WallOfFleshGoat
 
bool isPerformingPogostickTricks
 
bool isPettingAnimal
 
bool isTheAnimalBeingPetSmall
 
int itemAnimation
 
int itemAnimationMax
 
int itemFlameCount
 
Vector2[] itemFlamePos = new Vector2[7]
 
int itemHeight
 
Vector2 itemLocation
 
float itemRotation
 
int itemTime
 
int itemTimeMax
 
int itemWidth
 
int jump
 
bool jumpBoost
 
float jumpSpeedBoost
 
bool JustDroppedAnItem
 
bool justJumped
 
bool kbBuff
 
bool kbGlove
 
bool killClothier
 
bool killGuide
 
double ladyBugLuckTimeLeft
 
Vector2 lastBoost = Vector2.Zero
 
int lastChest
 
int lastCreatureHit = -1
 
Vector2 lastDeathPostion
 
DateTime lastDeathTime
 
bool lastMouseInterface
 
int lastPortalColorIndex
 
bool lastStoned
 
int lastTeleportPylonStyleUsed
 
int lastTileRangeX
 
int lastTileRangeY
 
long lastTimePlayerWasSaved
 
Item lastVisualizedSelectedItem
 
int lavaCD
 
bool lavaImmune
 
int lavaMax
 
bool lavaRose
 
int lavaTime
 
int leftTimer
 
Rectangle legFrame
 
double legFrameCounter
 
Vector2 legPosition
 
float legRotation
 
int legs = -1
 
Vector2 legVelocity
 
bool leinforsHair
 
bool lifeForce
 
bool lifeMagnet
 
int lifeRegen
 
int lifeRegenCount
 
int lifeRegenTime
 
float lifeSteal = 99999f
 
bool lightOrb
 
bool lizard
 
int loadStatus
 
bool longInvince
 
int lostCoins
 
string lostCoinString = ""
 
bool loveStruck
 
float luck
 
float luckMaximumCap = 1f
 
float luckMinimumCap = -0.7f
 
bool luckNeedsSync
 
byte luckPotion
 
bool magicCuffs
 
bool magicLantern
 
bool magicQuiver
 
bool magmaStone
 
float manaCost = 1f
 
bool manaFlower
 
bool manaMagnet
 
int manaRegen
 
int manaRegenBonus
 
bool manaRegenBuff
 
int manaRegenCount
 
int manaRegenDelay
 
int manaRegenDelayBonus
 
bool manaSick
 
float manaSickReduction
 
bool mapAlphaDown
 
bool mapAlphaUp
 
bool mapFullScreen
 
bool mapStyle
 
bool mapZoomIn
 
bool mapZoomOut
 
float maxFallSpeed = 10f
 
int maxMinions = 1
 
float maxRegenDelay
 
float maxRunSpeed = 3f
 
int maxTurrets = 1
 
int maxTurretsOld = 1
 
byte meleeEnchant
 The vanilla flask effect which the player currently has active; these affect all melee weapons and whips.
Defaults to 0, which denotes that the player does not currently have a flask active.
The following values correspond to vanilla flasks:
1 => Flask of Venom (affected weapons proc Acid Venom on hit)
2 => Flask of Cursed Flames (affected weapons proc Cursed Inferno on hit)
3 => Flask of Fire (affected weapons proc On Fire! on hit)
4 => Flask of Gold (affected weapons proc Midas on hit)
5 => Flask of Ichor (affected weapons proc Ichor on hit)
6 => Flask of Nanites (affected weapons proc Confused on hit)
7 => Flask of Party (affected weapons sometimes release confetti explosions on hit)
8 => Flask of Poison (affected weapons proc Poisoned on hit)

 
bool meleeScaleGlove
 
bool merman
 
bool minecartLeft
 
bool miniMinotaur
 
int MinionAttackTargetNPC = -1
 
Vector2 MinionRestTargetPoint = Vector2.Zero
 
int miscCounter
 
Item[] miscDyes = new Item[5]
 
Item[] miscEquips = new Item[5]
 
int miscTimer
 
bool moonLeech
 
bool moonLordLegs
 
Mount mount
 
float MountFishronSpecialCounter
 
bool mouseInterface
 
PlayerMovementAccsCache movementAbilitiesCache
 
float moveSpeed = 1f
 
int mushroomDelayTime = Item.mushroomDelay
 
string name = ""
 
float nearbyActiveNPCs
 
int nebulaCD
 
int nebulaLevelDamage
 
int nebulaLevelLife
 
int nebulaLevelMana
 
int nebulaManaCounter
 
sbyte neck = -1
 
bool netLife
 
int netLifeTime
 
bool netMana
 
int netManaTime
 
int netSkip
 
int nextCycledSpiderMinionType
 
bool nightVision
 
bool noBuilding
 
bool noFallDmg
 
bool noItems
 
bool noKnockback
 
int nonTorch = -1
 
int noThrow
 
bool[] npcTypeNoAggro = new bool[670]
 
int numMinions
 
bool oldAdjHoney
 
bool oldAdjLava
 
bool oldAdjWater
 
byte oldLuckPotion
 
int oldSelectItem
 
bool onFire
 
bool onFire2
 
bool onFire3
 
bool onFrostBurn
 
bool onFrostBurn2
 
bool onHitDodge
 
bool onHitPetal
 
bool onHitRegen
 
bool onHitTitaniumStorm
 
bool onTrack
 
bool onWrongGround
 
float opacityForCreditsRoll = 1f
 
bool outOfRange
 
BitsByte ownedLargeGems
 
int[] ownedProjectileCounts = new int[972]
 
bool palladiumRegen
 
bool panic
 
Color pantsColor = new Color(255, 230, 175)
 
bool parrot
 
bool parryDamageBuff
 
bool penguin
 
int petalTimer
 
bool petFlagBabyImp
 
bool petFlagBabyRedPanda
 
bool petFlagBabyShark
 
bool petFlagBabyWerewolf
 
bool petFlagBerniePet
 
bool petFlagBrainOfCthulhuPet
 
bool petFlagChesterPet
 
bool petFlagDD2BetsyPet
 
bool petFlagDD2Dragon
 
bool petFlagDD2Gato
 
bool petFlagDD2Ghost
 
bool petFlagDD2OgrePet
 
bool petFlagDeerclopsPet
 
bool petFlagDestroyerPet
 
bool petFlagDukeFishronPet
 
bool petFlagDynamiteKitten
 
bool petFlagEaterOfWorldsPet
 
bool petFlagEverscreamPet
 
bool petFlagEyeOfCthulhuPet
 
bool petFlagFairyQueenPet
 
bool petFlagFennecFox
 
bool petFlagGlitteryButterfly
 
bool petFlagGlommerPet
 
bool petFlagGolemPet
 
bool petFlagIceQueenPet
 
bool petFlagKingSlimePet
 
bool petFlagLilHarpy
 
bool petFlagLunaticCultistPet
 
bool petFlagMartianPet
 
bool petFlagMoonLordPet
 
bool petFlagPigPet
 
bool petFlagPlanteraPet
 
bool petFlagPlantero
 
bool petFlagPumpkingPet
 
bool petFlagQueenBeePet
 
bool petFlagQueenSlimePet
 
bool petFlagShadowMimic
 
bool petFlagSkeletronPet
 
bool petFlagSkeletronPrimePet
 
bool petFlagSugarGlider
 
bool petFlagTwinsPet
 
bool petFlagUpbeatStar
 
bool petFlagVoltBunny
 
int phantasmTime
 
int phantomPhoneixCounter
 
float pickSpeed = 1f
 
TrackedProjectileReference piggyBankProjTracker
 
bool pirateMinion
 
bool poisoned
 
PortableStoolUsage portableStoolInfo
 
bool portalPhysicsFlag
 
int potionDelay
 
int potionDelayTime = Item.potionDelay
 
Vector2? PotionOfReturnHomePosition
 
Vector2? PotionOfReturnOriginalUsePosition
 
bool poundRelease
 
bool powerrun
 
bool preventAllItemPickups
 
bool pStone
 
bool pulley
 
byte pulleyDir
 
int pulleyFrame
 
float pulleyFrameCounter
 
bool puppy
 
bool pvpDeath
 
bool pygmy
 
SelectionRadial QuicksRadial = new SelectionRadial(SelectionRadial.SelectionMode.RadialQuicks)
 
RabbitOrderFrameHelper rabbitOrderFrame
 
bool rabid
 
bool raven
 
bool redFairy
 
bool releaseCreativeMenu
 
bool releaseDown
 
bool releaseHook
 
bool releaseInventory
 
bool releaseJump
 
bool releaseLeft
 
bool releaseMapFullscreen
 
bool releaseMapStyle
 
bool releaseMount
 
bool releaseQuickHeal
 
bool releaseQuickMana
 
bool releaseRight
 
bool releaseSmart
 
bool releaseThrow
 
bool releaseUp
 
bool releaseUseItem
 
bool releaseUseTile
 
bool resistCold
 
int respawnTimer
 
int restorationDelayTime = Item.restorationDelay
 
int reuseDelay
 
int rightTimer
 
int rocketBoots
 
StatModifier rocketDamage = StatModifier.Default
 
int rocketDelay
 
int rocketDelay2
 
bool rocketFrame
 
bool rocketRelease
 
int rocketSoundDelay
 
int rocketTime
 
int rocketTimeMax = 7
 
int ropeCount
 
bool rulerGrid
 
bool rulerLine
 
float runAcceleration = 0.08f
 
bool runningOnSand
 
float runSlowdown = 0.2f
 
int runSoundDelay
 
bool sailDash
 
bool sandStorm
 
bool sapling
 
SavedPlayerDataWithAnnoyingRules savedPerPlayerFieldsThatArentInThePlayerClass
 
bool scope
 
int selectedItem
 
bool setApprenticeT2
 
bool setApprenticeT3
 
string setBonus = ""
 
bool setForbidden
 
bool setForbiddenCooldownLocked
 
bool setHuntressT2
 
bool setHuntressT3
 
bool setMonkT2
 
bool setMonkT3
 
bool setNebula
 
bool setSolar
 
bool setSquireT2
 
bool setSquireT3
 
bool setStardust
 
bool setVortex
 
int shadowCount
 
int[] shadowDirection = new int[3]
 
bool shadowDodge
 
float shadowDodgeCount
 
int shadowDodgeTimer
 
Vector2[] shadowOrigin = new Vector2[3]
 
Vector2[] shadowPos = new Vector2[3]
 
float[] shadowRotation = new float[3]
 
bool sharknadoMinion
 
sbyte shield = -1
 
int shield_parry_cooldown
 
int shieldParryTimeLeft
 
bool shieldRaised
 
bool shinyStone
 
Color shirtColor = new Color(175, 165, 140)
 
sbyte shoe = -1
 
Color shoeColor = new Color(160, 105, 60)
 
bool showLastDeath
 
bool shroomiteStealth
 
int sign = -1
 
bool silence
 
PlayerSittingHelper sitting
 
bool skeletron
 
Color skinColor = new Color(255, 125, 90)
 
int skinDyePacked
 
int skinVariant
 
bool skipAnimatingValuesInPlayerFrame
 
bool skyStoneEffects
 
PlayerSleepingHelper sleeping
 
int slideDir
 
bool sliding
 
bool slime
 
bool slippy
 
bool slippy2
 
bool sloping
 
float slotsMinions
 
bool slow
 
bool slowFall
 
bool slowOgreSpit
 
bool smolstar
 
int snowBallLauncherInteractionCooldown
 
bool snowman
 
bool socialGhost
 
bool socialIgnoreLight
 
bool socialShadowRocketBoots
 
int solarCounter
 
bool solarDashConsumedFlare
 
bool solarDashing
 
Vector2[] solarShieldPos = new Vector2[3]
 
int solarShields
 
Vector2[] solarShieldVel = new Vector2[3]
 
bool sonarPotion
 
int soulDrain
 
bool spaceGun
 
bool spawnMax
 
int SpawnX = -1
 
int SpawnY = -1
 
float[] speedSlice = new float[60]
 
byte spelunkerTimer
 
int[] spI = new int[200]
 
bool spider
 
bool spiderArmor
 
bool spiderMinion
 
int spikedBoots
 Used by the Shoe Spikes and Climbing Claws to allow for holding onto walls (of tiles, not to be confused with actual walls).
Defaults to 0. Any value higher than 0 allows the player to wall-jump.
A value of 1 causes the player to slowly slide down them while holding onto them.
A value of 2 or more doesn't give this limitation, allowing the player to stay holding onto a wall indefinitely.
 
string[] spN = new string[200]
 
bool sporeSac
 
int[] spX = new int[200]
 
int[] spY = new int[200]
 
bool squashling
 
bool stairFall
 
int starCloakCooldown
 
Item starCloakItem
 
Item starCloakItem_beeCloakOverrideItem
 
Item starCloakItem_manaCloakOverrideItem
 
Item starCloakItem_starVeilOverrideItem
 
bool stardustDragon
 
bool stardustGuardian
 
bool stardustMinion
 
bool starving
 
int statDefense
 
int statLife = 100
 
int statLifeMax = 100
 
int statLifeMax2 = 100
 
int statMana
 
int statManaMax
 
int statManaMax2
 
float stealth = 1f
 
int stealthTimer
 
int step = -1
 
float stepSpeed = 1f
 
bool sticky
 
int stickyBreak
 
bool stinky
 
bool stoned
 
bool stormTiger
 
int stringColor
 
bool strongBees
 
byte suffocateDelay
 
bool suffocating
 
bool sunflower
 
bool suspiciouslookingTentacle
 
int swimTime
 
sbyte tail = -1
 
int tankPet = -1
 
bool tankPetReset
 
int taxMoney
 
double taxTimer
 
int team
 
bool teleporting
 
int teleportStyle
 
float teleportTime
 
float thorns
 
bool tiki
 
PlayerInteractionAnchor tileEntityAnchor
 
bool tileInteractAttempted
 
bool tileInteractionHappened
 
float tileSpeed = 1f
 
int timeSinceLastDashStarted
 The amount of time that has passed, in ticks, since this player last performed a dash.
 
bool tipsy
 
bool tongued
 
int toolTime
 
float torchLuck
 
List< Point > TouchedTiles = new List<Point>()
 
float townNPCs
 
float trackBoost
 
bool trapDebuffSource
 
Item trashItem = new Item()
 
bool treasureMagnet
 
bool trident
 
bool truffle
 
bool tryKeepingHoveringDown
 
bool tryKeepingHoveringUp
 
bool turtle
 
bool turtleArmor
 
bool turtleThorns
 
bool twinsMinion
 
bool UFOMinion
 
Color underShirtColor = new Color(160, 180, 215)
 
bool unlockedBiomeTorches
 
bool vampireFrog
 
int vanityRocketBoots
 
bool venom
 
TrackedProjectileReference voidLensChest
 
BitsByte voidVaultInfo
 
bool volatileGelatin
 
int volatileGelatinCounter
 
bool vortexDebuff
 
bool vortexStealthActive
 
sbyte waist = -1
 
float wallSpeed = 1f
 
bool waterWalk
 
bool waterWalk2
 
bool wearsRobe
 
bool webbed
 
bool wellFed
 
bool wereWolf
 
byte wetSlime
 
float whipRangeMultiplier
 
bool windPushed
 
float wingAccRunSpeed = -1f
 
int wingFrame
 
int wingFrameCounter
 
float wingRunAccelerationMult = 1f
 
int wings
 
int wingsLogic
 
float wingTime
 
int wingTimeMax
 
int wireOperationsCooldown
 
bool wisp
 
bool witheredArmor
 
bool witheredWeapon
 
bool wolfAcc
 
bool yoraiz0rDarkness
 
int yoraiz0rEye
 
bool yoyoGlove
 
bool yoyoString
 
bool zephyrfish
 
BitsByte zone1 = (byte)0
 
BitsByte zone2 = (byte)0
 
BitsByte zone3 = (byte)0
 
BitsByte zone4 = (byte)0
 
- Public Attributes inherited from Terraria.Entity
bool active
 
int direction = 1
 
int height
 
bool honeyWet
 
bool lavaWet
 
int oldDirection
 
Vector2 oldPosition
 
Vector2 oldVelocity
 
Vector2 position
 
Vector2 velocity
 
bool wet
 
byte wetCount
 
int whoAmI
 
int width
 

Static Public Attributes

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

Properties

bool[] adjTile [get, set]
 
bool AnyThrownCostReduction [get]
 Returns true if either ThrownCost33 or ThrownCost50 are true
 
Vector2 BlehOldPositionFixer [get]
 
int breathCDMax [get]
 
bool CanBeTalkedTo [get]
 
bool CCed [get]
 
int ConsumedLifeCrystals [get, set]
 How many Life Crystals this player has consumed
 
int ConsumedLifeFruit [get, set]
 How many Life Fruit this player has consumed
 
int ConsumedManaCrystals [get, set]
 How many Mana Crystals this player has consumed
 
SceneEffectLoader.SceneEffectInstance CurrentSceneEffect = new SceneEffectLoader.SceneEffectInstance() [get, set]
 Container for current SceneEffect client properties such as: Backgrounds, music, and water styling
 
bool DeadOrGhost [get]
 
Vector2 DefaultSize [get]
 
Vector2 Directions [get]
 
bool HasMinionAttackTargetNPC [get]
 
bool HasMinionRestTarget [get]
 
int HeightMapOffset [get]
 
int HeightOffsetBoost [get]
 
float HeightOffsetHitboxCenter [get]
 
float HeightOffsetVisual [get]
 
Item HeldItem [get]
 
Rectangle HitboxForBestiaryNearbyCheck [get]
 
bool isLockedToATile [get]
 
bool IsVoidVaultEnabled [get, set]
 
bool ItemAnimationActive [get]
 Returns true if an item animation is currently running.
 
bool ItemAnimationEndingOrEnded [get]
 Returns true if the item animation is on or after its last frame. Meaning it could (if the player clicks etc) start again next frame.
Vanilla uses it to despawn spears, but it's not recommended because it will desync in multiplayer
(a remote player could get the packet for a new projectile just as they're finishing a swing).
It is recommended to use ai counters for the lifetime of animation bound projectiles instead.
 
bool ItemAnimationJustStarted [get]
 Returns true if the item animation is in its first frame.
 
bool ItemTimeIsZero [get]
 
int ItemUsesThisAnimation [get]
 The number of times the item has been used/fired this animation (swing)
 
bool Male [get, set]
 
static int MaxBuffs [get]
 
float miscCounterNormalized [get]
 
RefReadOnlyArray< ModPlayerModPlayers [get]
 
Vector2 MountedCenter [get, set]
 
bool MountFishronSpecial [get]
 
HashSet< int > NearbyModTorch = new HashSet<int>() [get]
 
float NormalizedLuck [get]
 
bool[] oldAdjTile [get, set]
 
bool PortalPhysicsEnabled [get]
 
bool ShoppingZone_AnyBiome [get]
 
bool ShoppingZone_BelowSurface [get]
 
bool ShoppingZone_Forest [get]
 
bool ShouldFloatInWater [get]
 
bool ShouldNotDraw [get]
 
bool SlimeDontHyperJump [get]
 
int talkNPC [get]
 
bool ThrownCost33 [get, set]
 If true, player has a 33% chance of not consuming the thrown item.
Only applies to consumable items and projectiles counted as the DamageClass.Throwing damage type.
Projectiles spawned from a player who holds such item will set Projectile.noDropItem to prevent duplication.
Stacks with ThrownCost50 multiplicatively
 
bool ThrownCost50 [get, set]
 If true, player has a 50% chance of not consuming the thrown item.
Only applies to consumable items counted as the DamageClass.Throwing damage type.
Projectiles spawned from a player who holds such item will set Projectile.noDropItem to prevent duplication.
Stacks with ThrownCost33 multiplicatively
 
float ThrownVelocity [get, set]
 Multiplier to shot projectile velocity before throwing. Result will be capped to 16f.
Only applies to items counted as the DamageClass.Throwing damage type
 
bool TileReplacementEnabled [get]
 
bool TryingToHoverDown [get]
 
bool TryingToHoverUp [get]
 
bool UsingBiomeTorches [get, set]
 
override Vector2 VisualPosition [get]
 
bool ZoneBeach [get, set]
 
bool ZoneCorrupt [get, set]
 
bool ZoneCrimson [get, set]
 
bool ZoneDesert [get, set]
 
bool ZoneDirtLayerHeight [get, set]
 
bool ZoneDungeon [get, set]
 
bool ZoneForest [get]
 Shorthand for More...
 
bool ZoneGemCave [get, set]
 
bool ZoneGlowshroom [get, set]
 
bool ZoneGranite [get, set]
 
bool ZoneGraveyard [get, set]
 
bool ZoneHallow [get, set]
 
bool ZoneHive [get, set]
 
bool ZoneJungle [get, set]
 
bool ZoneLihzhardTemple [get, set]
 
bool ZoneMarble [get, set]
 
bool ZoneMeteor [get, set]
 
bool ZoneNormalCaverns [get]
 Shorthand for More...
 
bool ZoneNormalSpace [get]
 Shorthand for More...
 
bool ZoneNormalUnderground [get]
 Shorthand for More...
 
bool ZoneOldOneArmy [get, set]
 
bool ZoneOverworldHeight [get, set]
 
bool ZonePeaceCandle [get, set]
 
bool ZonePurity = false [get, set]
 The zone property storing if the player is not in any particular biome. Updated in UpdateBiomes Does NOT account for height. Please use ZoneForest / ZoneNormalX for height based derivatives.
 
bool ZoneRain [get, set]
 
bool ZoneRockLayerHeight [get, set]
 
bool ZoneSandstorm [get, set]
 
bool ZoneSkyHeight [get, set]
 
bool ZoneSnow [get, set]
 
bool ZoneTowerNebula [get, set]
 
bool ZoneTowerSolar [get, set]
 
bool ZoneTowerStardust [get, set]
 
bool ZoneTowerVortex [get, set]
 
bool ZoneUndergroundDesert [get, set]
 
bool ZoneUnderworldHeight [get, set]
 
bool ZoneWaterCandle [get, set]
 
- Properties inherited from Terraria.Entity
Vector2 Bottom [get, set]
 
Vector2 BottomLeft [get, set]
 
Vector2 BottomRight [get, set]
 
Vector2 Center [get, set]
 
Rectangle Hitbox [get, set]
 
Vector2 Left [get, set]
 
Vector2 Right [get, set]
 
Vector2 Size [get, set]
 
Vector2 Top [get, set]
 
Vector2 TopLeft [get, set]
 
Vector2 TopRight [get, set]
 
virtual Vector2 VisualPosition [get]
 

Member Function Documentation

◆ AddBuff()

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

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

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

◆ AddImmuneTime()

void Terraria.Player.AddImmuneTime ( int  cooldownCounterId,
int  immuneTime 
)

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

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

◆ ChooseAmmo()

Item Terraria.Player.ChooseAmmo ( Item  weapon)

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

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

◆ ClearBuff()

void Terraria.Player.ClearBuff ( int  type)

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

Parameters
typeThe buff type

◆ DelBuff()

void Terraria.Player.DelBuff ( int  b)

Removes the buff at the provided index and shuffles the remaining buff indexes down to fill the gap. Use Player.ClearBuff if you only know the buff type

Parameters
bThe index of the buff to remove.

◆ GetAdjustedItemScale()

float Terraria.Player.GetAdjustedItemScale ( Item  item)

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

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

◆ GetArmorPenetration< T >()

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.

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

◆ GetAttackSpeed< T >()

ref float Terraria.Player.GetAttackSpeed< T > ( )

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

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

◆ GetCritChance< T >()

ref float Terraria.Player.GetCritChance< T > ( )

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

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

◆ GetDamage< T >()

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

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

◆ GetItemGrabRange()

int Terraria.Player.GetItemGrabRange ( Item  item)

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

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

◆ 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.

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

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

T Terraria.Player.GetModPlayer< T > ( )

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

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

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

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

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

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

◆ GetTotalArmorPenetration< T >()

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

◆ GetTotalAttackSpeed< T >()

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

◆ GetTotalCritChance< T >()

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

◆ GetTotalDamage< T >()

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

◆ GetTotalKnockback< T >()

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

◆ HasAmmo()

bool Terraria.Player.HasAmmo ( Item  sItem)

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

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

◆ HasBuff< T >()

bool Terraria.Player.HasBuff< T > ( )

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

◆ Heal()

void Terraria.Player.Heal ( int  amount)

Heals the player for a certain amount.

Parameters
amountThe amount to heal the player by.

◆ InModBiome()

bool Terraria.Player.InModBiome ( ModBiome  baseInstance)

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

Exceptions
IndexOutOfRangeException
Exceptions
NullReferenceException

◆ InModBiome< T >()

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

◆ IsAmmoFreeThisShot()

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

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

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

◆ OpenChest()

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

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

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

◆ PickAmmo()

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

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

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

◆ QuickSpawnClonedItem()

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

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

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

◆ QuickSpawnClonedItemDirect()

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

Returns
Returns the Item instance

◆ QuickSpawnItem()

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

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

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

◆ QuickSpawnItemDirect() [1/2]

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

Returns
Returns the Item instance

◆ QuickSpawnItemDirect() [2/2]

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

Returns
Returns the Item instance

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

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

Gets the instance of the specified ModPlayer type.

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

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

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

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

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

Member Data Documentation

◆ builderAccStatus

int [] Terraria.Player.builderAccStatus
Initial value:
= new int[12] {
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
}

Property Documentation

◆ ZoneForest

bool Terraria.Player.ZoneForest
get

Shorthand for

ZonePurity && ZoneOverworldHeight

◆ ZoneNormalCaverns

bool Terraria.Player.ZoneNormalCaverns
get

Shorthand for

ZonePurity && ZoneRockLayerHeight

◆ ZoneNormalSpace

bool Terraria.Player.ZoneNormalSpace
get

Shorthand for

ZonePurity && ZoneSkyHeight

◆ ZoneNormalUnderground

bool Terraria.Player.ZoneNormalUnderground
get

Shorthand for

ZonePurity && ZoneDirtLayerHeight