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

This is where all ModPlayer hooks are gathered and called. More...

Static Public Member Functions

static T AddModHook< T > (T hook)
 
static void AnglerQuestReward (Player player, float rareMultiplier, List< Item > rewardItems)
 
static ? bool CanAutoReuseItem (Player player, Item item)
 
static bool CanBeHitByNPC (Player player, NPC npc, ref int cooldownSlot)
 
static bool CanBeHitByProjectile (Player player, Projectile proj)
 
static bool CanBuyItem (Player player, NPC npc, Item[] shopInventory, Item item)
 
static ? bool CanCatchNPC (Player player, NPC target, Item item)
 
static bool CanConsumeAmmo (Player player, Item weapon, Item ammo)
 
static ? bool CanConsumeBait (Player player, Item bait)
 
static ? bool CanHitNPC (Player player, Item item, NPC target)
 
static ? bool CanHitNPCWithProj (Projectile proj, NPC target)
 
static bool CanHitPvp (Player player, Item item, Player target)
 
static bool CanHitPvpWithProj (Projectile proj, Player target)
 
static bool CanSellItem (Player player, NPC npc, Item[] shopInventory, Item item)
 
static bool CanShoot (Player player, Item item)
 
static bool CanUseItem (Player player, Item item)
 
static void CatchFish (Player player, FishingAttempt attempt, ref int itemDrop, ref int enemySpawn, ref AdvancedPopupRequest sonar, ref Vector2 sonarPosition)
 
static void clientClone (Player player, Player clientClone)
 
static void DrawEffects (PlayerDrawSet drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright)
 
static void FrameEffects (Player player)
 
static void GetDyeTraderReward (Player player, List< int > rewardPool)
 
static void GetFishingLevel (Player player, Item fishingRod, Item bait, ref float fishingLevel)
 
static void GetHealLife (Player player, Item item, bool quickHeal, ref int healValue)
 
static void GetHealMana (Player player, Item item, bool quickHeal, ref int healValue)
 
static List< ItemGetStartingItems (Player player, IEnumerable< Item > vanillaItems, bool mediumCoreDeath=false)
 
static void HideDrawLayers (PlayerDrawSet drawInfo)
 
static bool HoverSlot (Player player, Item[] inventory, int context, int slot)
 
static void Hurt (Player player, bool pvp, bool quiet, double damage, int hitDirection, bool crit, int cooldownCounter)
 
static void Kill (Player player, double damage, int hitDirection, bool pvp, PlayerDeathReason damageSource)
 
static void MeleeEffects (Player player, Item item, Rectangle hitbox)
 
static void ModifyCaughtFish (Player player, Item fish)
 
static void ModifyDrawInfo (ref PlayerDrawSet drawInfo)
 
static void ModifyDrawLayerOrdering (IDictionary< PlayerDrawLayer, PlayerDrawLayer.Position > positions)
 
static void ModifyFishingAttempt (Player player, ref FishingAttempt attempt)
 
static void ModifyHitByNPC (Player player, NPC npc, ref int damage, ref bool crit)
 
static void ModifyHitByProjectile (Player player, Projectile proj, ref int damage, ref bool crit)
 
static void ModifyHitNPC (Player player, Item item, NPC target, ref int damage, ref float knockback, ref bool crit)
 
static void ModifyHitNPCWithProj (Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
 
static void ModifyHitPvp (Player player, Item item, Player target, ref int damage, ref bool crit)
 
static void ModifyHitPvpWithProj (Projectile proj, Player target, ref int damage, ref bool crit)
 
static void ModifyItemScale (Player player, Item item, ref float scale)
 
static void ModifyLuck (Player player, ref float luck)
 
static void ModifyManaCost (Player player, Item item, ref float reduce, ref float mult)
 
static void ModifyMaxStats (Player player)
 Reset this player's Player.statLifeMax and Player.statManaMax to their vanilla defaults, applies ModPlayer.ModifyMaxStats(out StatModifier, out StatModifier) to them, then modifies Player.statLifeMax2 and Player.statManaMax2 More...
 
static bool ModifyNurseHeal (Player player, NPC npc, ref int health, ref bool removeDebuffs, ref string chat)
 
static void ModifyNursePrice (Player player, NPC npc, int health, bool removeDebuffs, ref int price)
 
static void ModifyScreenPosition (Player player)
 
static void ModifyShootStats (Player player, Item item, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback)
 
static void ModifyWeaponCrit (Player player, Item item, ref float crit)
 
static void ModifyWeaponDamage (Player player, Item item, ref StatModifier damage)
 Calls ModItem.HookModifyWeaponDamage, then all GlobalItem.HookModifyWeaponDamage hooks.
 
static void ModifyWeaponKnockback (Player player, Item item, ref StatModifier knockback)
 
static void ModifyZoom (Player player, ref float zoom)
 
static void NaturalLifeRegen (Player player, ref float regen)
 
static void OnCatchNPC (Player player, NPC target, Item item, bool failed)
 
static void OnConsumeAmmo (Player player, Item weapon, Item ammo)
 
static void OnConsumeMana (Player player, Item item, int manaConsumed)
 
static void OnEnterWorld (int playerIndex)
 
static void OnHitAnything (Player player, float x, float y, Entity victim)
 
static void OnHitByNPC (Player player, NPC npc, int damage, bool crit)
 
static void OnHitByProjectile (Player player, Projectile proj, int damage, bool crit)
 
static void OnHitNPC (Player player, Item item, NPC target, int damage, float knockback, bool crit)
 
static void OnHitNPCWithProj (Projectile proj, NPC target, int damage, float knockback, bool crit)
 
static void OnHitPvp (Player player, Item item, Player target, int damage, bool crit)
 
static void OnHitPvpWithProj (Projectile proj, Player target, int damage, bool crit)
 
static void OnMissingMana (Player player, Item item, int manaNeeded)
 
static void OnRespawn (Player player)
 
static void PlayerConnect (int playerIndex)
 
static void PlayerDisconnect (int playerIndex)
 
static void PostBuyItem (Player player, NPC npc, Item[] shopInventory, Item item)
 
static void PostHurt (Player player, bool pvp, bool quiet, double damage, int hitDirection, bool crit, int cooldownCounter)
 
static void PostItemCheck (Player player)
 
static void PostNurseHeal (Player player, NPC npc, int health, bool removeDebuffs, int price)
 
static void PostSavePlayer (Player player)
 
static void PostSellItem (Player player, NPC npc, Item[] shopInventory, Item item)
 
static void PostUpdate (Player player)
 
static void PostUpdateBuffs (Player player)
 
static void PostUpdateEquips (Player player)
 
static void PostUpdateMiscEffects (Player player)
 
static void PostUpdateRunSpeeds (Player player)
 
static bool PreHurt (Player player, bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource, ref int cooldownCounter)
 
static bool PreItemCheck (Player player)
 
static bool PreKill (Player player, double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
 
static bool PreModifyLuck (Player player, ref float luck)
 
static void PreSavePlayer (Player player)
 
static void PreUpdate (Player player)
 
static void PreUpdateBuffs (Player player)
 
static void PreUpdateMovement (Player player)
 
static void ProcessTriggers (Player player, TriggersSet triggersSet)
 
static void ResetEffects (Player player)
 
static void ResetMaxStatsToVanilla (Player player)
 Resets Player.statLifeMax and Player.statManaMax to their expected values by vanilla More...
 
static void SendClientChanges (Player player, Player clientPlayer)
 
static void SetControls (Player player)
 
static void SetStartInventory (Player player, IList< Item > items)
 
static bool ShiftClickSlot (Player player, Item[] inventory, int context, int slot)
 
static bool Shoot (Player player, Item item, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
 
static void SyncPlayer (Player player, int toWho, int fromWho, bool newPlayer)
 
static void UpdateAutopause (Player player)
 
static void UpdateBadLifeRegen (Player player)
 
static void UpdateDead (Player player)
 
static void UpdateDyes (Player player)
 
static void UpdateEquips (Player player)
 
static void UpdateLifeRegen (Player player)
 
static void UpdateVisibleAccessories (Player player)
 
static void UpdateVisibleVanityAccessories (Player player)
 
static float UseAnimationMultiplier (Player player, Item item)
 
static float UseSpeedMultiplier (Player player, Item item)
 
static float UseTimeMultiplier (Player player, Item item)
 

Detailed Description

This is where all ModPlayer hooks are gathered and called.

Member Function Documentation

◆ AddModHook< T >()

static T Terraria.ModLoader.PlayerLoader.AddModHook< T > ( hook)
static
Type Constraints
T :HookList 

◆ ModifyMaxStats()

static void Terraria.ModLoader.PlayerLoader.ModifyMaxStats ( Player  player)
static

Reset this player's Player.statLifeMax and Player.statManaMax to their vanilla defaults, applies ModPlayer.ModifyMaxStats(out StatModifier, out StatModifier) to them, then modifies Player.statLifeMax2 and Player.statManaMax2

Parameters
player

◆ ResetMaxStatsToVanilla()

static void Terraria.ModLoader.PlayerLoader.ResetMaxStatsToVanilla ( Player  player)
static

Resets Player.statLifeMax and Player.statManaMax to their expected values by vanilla

Parameters
player