tModLoader v2024.05
A mod to make and play Terraria mods
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, NPC target)
 
static ? bool CanHitNPCWithItem (Player player, Item item, NPC target)
 
static ? bool CanHitNPCWithProj (Player player, Projectile proj, NPC target)
 
static bool CanHitPvp (Player player, Item item, Player target)
 
static bool CanHitPvpWithProj (Projectile proj, Player target)
 
static ? bool CanMeleeAttackCollideWithNPC (Player player, Item item, Rectangle meleeAttackHitbox, NPC target)
 
static bool CanSellItem (Player player, NPC npc, Item[] shopInventory, Item item)
 
static bool CanShoot (Player player, Item item)
 
static bool CanShowExtraJumpVisuals (ExtraJump jump, Player player)
 
static bool CanStartExtraJump (ExtraJump jump, Player player)
 
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 bool ConsumableDodge (Player player, in Player.HurtInfo info)
 
static void CopyClientState (Player player, Player targetCopy)
 
static void DrawEffects (PlayerDrawSet drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright)
 
static void ExtraJumpVisuals (ExtraJump jump, Player player)
 
static void FrameEffects (Player player)
 
static bool FreeDodge (Player player, in Player.HurtInfo info)
 
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 IEnumerable<(IEnumerable< Item >, ModPlayer.ItemConsumedCallback)> GetModdedCraftingMaterials (Player player)
 
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 bool ImmuneTo (Player player, PlayerDeathReason damageSource, int cooldownCounter, bool dodgeable)
 
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 ModifyExtraJumpDurationMultiplier (ExtraJump jump, Player player, ref float duration)
 
static void ModifyFishingAttempt (Player player, ref FishingAttempt attempt)
 
static void ModifyHitByNPC (Player player, NPC npc, ref Player.HurtModifiers modifiers)
 
static void ModifyHitByProjectile (Player player, Projectile proj, ref Player.HurtModifiers modifiers)
 
static void ModifyHitNPC (Player player, NPC target, ref NPC.HitModifiers modifiers)
 
static void ModifyHitNPCWithItem (Player player, Item item, NPC target, ref NPC.HitModifiers modifiers)
 
static void ModifyHitNPCWithProj (Player player, Projectile proj, NPC target, ref NPC.HitModifiers modifiers)
 
static void ModifyHurt (Player player, ref Player.HurtModifiers modifiers)
 
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 OnExtraJumpEnded (ExtraJump jump, Player player)
 
static void OnExtraJumpRefreshed (ExtraJump jump, Player player)
 
static void OnExtraJumpStarted (ExtraJump jump, Player player, ref bool playSound)
 
static void OnHitAnything (Player player, float x, float y, Entity victim)
 
static void OnHitByNPC (Player player, NPC npc, in Player.HurtInfo hurtInfo)
 
static void OnHitByProjectile (Player player, Projectile proj, in Player.HurtInfo hurtInfo)
 
static void OnHitNPC (Player player, NPC target, in NPC.HitInfo hit, int damageDone)
 
static void OnHitNPCWithItem (Player player, Item item, NPC target, in NPC.HitInfo hit, int damageDone)
 
static void OnHitNPCWithProj (Player player, Projectile proj, NPC target, in NPC.HitInfo hit, int damageDone)
 
static void OnHurt (Player player, Player.HurtInfo info)
 
static void OnMissingMana (Player player, Item item, int manaNeeded)
 
static bool OnPickup (Player player, Item item)
 
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, Player.HurtInfo info)
 
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 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 RefreshInfoAccessoriesFromTeamPlayers (Player player, Player otherPlayer)
 
static void ResetEffects (Player player)
 
static void ResetInfoAccessories (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 PlayerLoader.AddModHook< T > ( hook)
static
Type Constraints
T :HookList 

◆ ModifyMaxStats()

static void 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 PlayerLoader.ResetMaxStatsToVanilla ( Player  player)
static

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

Parameters
player