Terraria ModLoader  0.11.1
A framework for Terraria mods
Terraria.ModLoader.ItemLoader Class Reference

This serves as the central class from which item-related functions are carried out. It also stores a list of mod items by ID. More...

+ Collaboration diagram for Terraria.ModLoader.ItemLoader:

Classes

class  HookList
 

Static Public Member Functions

static bool AltFunctionUse (Item item, Player player)
 Calls ModItem.AltFunctionUse, then all GlobalItem.AltFunctionUse hooks, until one of them returns true. Returns whether any of the hooks returned true. More...
 
static string AnglerChat (int type)
 
static void ArmorArmGlowMask (int slot, Player drawPlayer, float shadow, ref int glowMask, ref Color color)
 Calls the item's body equipment texture's ArmorArmGlowMask hook, then all GlobalItem.ArmorArmGlowMask hooks. More...
 
static void ArmorSetShadows (Player player)
 If the player's head texture's IsVanitySet returns true, calls the equipment texture's ArmorSetShadows. This is then repeated for the player's body, then the legs. Then for each GlobalItem, if GlobalItem.IsVanitySet returns a non-empty string, calls GlobalItem.ArmorSetShadows, using player.head, player.body, and player.legs. More...
 
static void AutoLightSelect (Item item, ref bool dryTorch, ref bool wetTorch, ref bool glowstick)
 
static bool CanEquipAccessory (Item item, int slot)
 
static bool CanHitNPC (Item item, Player player, NPC target)
 Gathers the results of ModItem.CanHitNPC and all GlobalItem.CanHitNPC hooks. If any of them returns false, this returns false. Otherwise, if any of them returns true then this returns true. If all of them return null, this returns null. More...
 
static bool CanHitPvp (Item item, Player player, Player target)
 Calls all GlobalItem.CanHitPvp hooks, then ModItem.CanHitPvp, until one of them returns false. If all of them return true, this returns true. More...
 
static bool CanPickup (Item item, Player player)
 
static bool CanRightClick (Item item)
 Calls ModItem.CanRightClick, then all GlobalItem.CanRightClick hooks, until one of the returns true. If one of the returns true, returns Main.mouseRight. Otherwise, returns false. More...
 
static bool CanUseItem (Item item, Player player)
 Returns the "and" operation on the results of ModItem.CanUseItem and all GlobalItem.CanUseItem hooks. Does not fail fast (every hook is called). More...
 
static void CaughtFishStack (Item item)
 
static bool CheckProjOnSwing (Player player, Item item)
 If the item is a modded item, ModItem.checkProjOnSwing is true, and the player is not at the beginning of the item's use animation, sets canShoot to false. More...
 
static int ChoosePrefix (Item item, UnifiedRandom rand)
 
static bool ConsumeAmmo (Item item, Item ammo, Player player)
 Calls ModItem.ConsumeAmmo for the weapon, ModItem.ConsumeAmmo for the ammo, then each GlobalItem.ConsumeAmmo hook for the weapon and ammo, until one of them returns false. If all of them return true, returns true. More...
 
static bool ConsumeItem (Item item, Player player)
 If ModItem.ConsumeItem or any of the GlobalItem.ConsumeItem hooks returns false, sets consume to false. More...
 
static void DrawArmorColor (EquipType type, int slot, Player drawPlayer, float shadow, ref Color color, ref int glowMask, ref Color glowMaskColor)
 Calls the item's equipment texture's DrawArmorColor hook, then all GlobalItem.DrawArmorColor hooks. More...
 
static bool DrawBody (Player player)
 Calls the item's body equipment texture's DrawBody hook, then all GlobalItem.DrawBody hooks, until one of them returns false. Returns true if none of them return false. More...
 
static void DrawHair (Player player, ref bool drawHair, ref bool drawAltHair)
 Calls the item's head equipment texture's DrawHair hook, then all GlobalItem.DrawHair hooks. More...
 
static void DrawHands (Player player, ref bool drawHands, ref bool drawArms)
 Calls the item's body equipment texture's DrawHands hook, then all GlobalItem.DrawHands hooks. More...
 
static bool DrawHead (Player player)
 Calls the item's head equipment texture's DrawHead hook, then all GlobalItem.DrawHead hooks, until one of them returns false. Returns true if none of them return false. More...
 
static bool DrawLegs (Player player)
 Calls the item's leg equipment texture's DrawLegs hook, then the item's shoe equipment texture's DrawLegs hook, then all GlobalItem.DrawLegs hooks, until one of them returns false. Returns true if none of them return false. More...
 
static void ExtractinatorUse (ref int resultType, ref int resultStack, int extractType)
 
static Color GetAlpha (Item item, Color lightColor)
 Calls all GlobalItem.GetAlpha hooks then ModItem.GetAlpha, until one of them returns a color, and returns that color. Returns null if all of the hooks return null. More...
 
static void GetHealLife (Item item, Player player, bool quickHeal, ref int healValue)
 Calls ModItem.GetHealLife, then all GlobalItem.GetHealLife hooks. More...
 
static void GetHealMana (Item item, Player player, bool quickHeal, ref int healValue)
 Calls ModItem.GetHealMana, then all GlobalItem.GetHealMana hooks. More...
 
static ModItem GetItem (int type)
 Gets the ModItem instance corresponding to the specified type. Returns null if no modded item has the given type. More...
 
static void GetWeaponCrit (Item item, Player player, ref int crit)
 Calls ModItem.GetWeaponCrit, then all GlobalItem.GetWeaponCrit hooks. More...
 
static void GetWeaponDamage (Item item, Player player, ref int damage)
 Calls ModItem.GetWeaponDamage, then all GlobalItem.GetWeaponDamage hooks. More...
 
static void GetWeaponKnockback (Item item, Player player, ref float knockback)
 Calls ModItem.GetWeaponKnockback, then all GlobalItem.GetWeaponKnockback hooks. More...
 
static Item GetWing (Player player)
 s Returns the wing item that the player is functionally using. If player.wingsLogic has been modified, so no equipped wing can be found to match what the player is using, this creates a new Item object to return. More...
 
static void GrabRange (Item item, Player player, ref int grabRange)
 Calls ModItem.GrabRange, then all GlobalItem.GrabRange hooks. More...
 
static bool GrabStyle (Item item, Player player)
 Calls all GlobalItem.GrabStyle hooks then ModItem.GrabStyle, until one of them returns true. Returns whether any of the hooks returned true. More...
 
static void HoldItem (Item item, Player player)
 Calls ModItem.HoldItem and all GlobalItem.HoldItem hooks. More...
 
static bool HoldItemFrame (Item item, Player player)
 Calls ModItem.HoldItemFrame, then all GlobalItem.HoldItemFrame hooks, until one of them returns true. Returns whether any of the hooks returned true. More...
 
static void HoldoutOffset (float gravDir, int type, ref Vector2 offset)
 
static void HoldoutOrigin (Player player, ref Vector2 origin)
 
static void HoldStyle (Item item, Player player)
 If the player is not holding onto a rope and is not in the middle of using an item, calls ModItem.HoldStyle and all GlobalItem.HoldStyle hooks. More...
 
static void HorizontalWingSpeeds (Player player)
 If the player is using wings, this uses the result of GetWing, and calls ModItem.HorizontalWingSpeeds then all GlobalItem.HorizontalWingSpeeds hooks. More...
 
static void IsAnglerQuestAvailable (int itemID, ref bool notAvailable)
 
static bool IsModBossBag (Item item)
 Returns whether ModItem.bossBagNPC is greater than 0. Returns false if item is not a modded item. More...
 
static bool ItemSpace (Item item, Player player)
 
static void MeleeEffects (Item item, Player player, Rectangle hitbox)
 Calls ModItem.MeleeEffects and all GlobalItem.MeleeEffects hooks. More...
 
static float MeleeSpeedMultiplier (Item item, Player player)
 
static void ModifyHitNPC (Item item, Player player, NPC target, ref int damage, ref float knockBack, ref bool crit)
 Calls ModItem.ModifyHitNPC, then all GlobalItem.ModifyHitNPC hooks. More...
 
static void ModifyHitPvp (Item item, Player player, Player target, ref int damage, ref bool crit)
 Calls ModItem.ModifyHitPvp, then all GlobalItem.ModifyHitPvp hooks. More...
 
static void ModifyManaCost (Item item, Player player, ref float reduce, ref float mult)
 Calls ModItem.ModifyManaCost, then all GlobalItem.ModifyManaCost hooks. More...
 
static List< TooltipLineModifyTooltips (Item item, ref int numTooltips, string[] names, ref string[] text, ref bool[] modifier, ref bool[] badModifier, ref int oneDropLogo, out Color?[] overrideColor)
 
static void ModifyWeaponDamage (Item item, Player player, ref float add, ref float mult)
 Calls ModItem.HookModifyWeaponDamage, then all GlobalItem.HookModifyWeaponDamage hooks. More...
 
static bool NeedsModSaving (Item item)
 
static void OnConsumeAmmo (Item item, Item ammo, Player player)
 Calls ModItem.OnConsumeAmmo for the weapon, ModItem.OnConsumeAmmo for the ammo, then each GlobalItem.OnConsumeAmmo hook for the weapon and ammo. More...
 
static void OnConsumeItem (Item item, Player player)
 Calls ModItem.OnConsumeItem and all GlobalItem.OnConsumeItem hooks. More...
 
static void OnConsumeMana (Item item, Player player, int manaConsumed)
 Calls ModItem.OnConsumeMana, then all GlobalItem.OnConsumeMana hooks. More...
 
static void OnCraft (Item item, Recipe recipe)
 
static void OnHitNPC (Item item, Player player, NPC target, int damage, float knockBack, bool crit)
 Calls ModItem.OnHitNPC and all GlobalItem.OnHitNPC hooks. More...
 
static void OnHitPvp (Item item, Player player, Player target, int damage, bool crit)
 Calls ModItem.OnHitPvp and all GlobalItem.OnHitPvp hooks. More...
 
static void OnMissingMana (Item item, Player player, int neededMana)
 Calls ModItem.OnMissingMana, then all GlobalItem.OnMissingMana hooks. More...
 
static bool OnPickup (Item item, Player player)
 Calls all GlobalItem.OnPickup hooks then ModItem.OnPickup, until one of the returns false. Returns true if all of the hooks return true. More...
 
static void OpenBossBag (int type, Player player, ref int npc)
 If the item is a modded item and ModItem.bossBagNPC is greater than 0, calls ModItem.OpenBossBag and sets npc to ModItem.bossBagNPC. More...
 
static void OpenVanillaBag (string context, Player player, int arg)
 Calls all GlobalItem.OpenVanillaBag hooks. More...
 
static void PickAmmo (Item weapon, Item ammo, Player player, ref int type, ref float speed, ref int damage, ref float knockback)
 Calls ModItem.PickAmmo, then all GlobalItem.PickAmmo hooks. More...
 
static void PostDrawInInventory (Item item, SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
 Calls ModItem.PostDrawInInventory, then all GlobalItem.PostDrawInInventory hooks. More...
 
static void PostDrawInWorld (Item item, SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
 Calls ModItem.PostDrawInWorld, then all GlobalItem.PostDrawInWorld hooks. More...
 
static void PostDrawTooltip (Item item, ReadOnlyCollection< DrawableTooltipLine > lines)
 
static void PostDrawTooltipLine (Item item, DrawableTooltipLine line)
 
static void PostReforge (Item item)
 Calls ModItem.PostReforge, then all GlobalItem.PostReforge hooks. More...
 
static void PostUpdate (Item item)
 Calls ModItem.PostUpdate and all GlobalItem.PostUpdate hooks. More...
 
static bool PreDrawInInventory (Item item, SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
 Returns the "and" operator on the results of all GlobalItem.PreDrawInInventory hooks and ModItem.PreDrawInInventory. More...
 
static bool PreDrawInWorld (Item item, SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI)
 Returns the "and" operator on the results of ModItem.PreDrawInWorld and all GlobalItem.PreDrawInWorld hooks. More...
 
static bool PreDrawTooltip (Item item, ReadOnlyCollection< TooltipLine > lines, ref int x, ref int y)
 
static bool PreDrawTooltipLine (Item item, DrawableTooltipLine line, ref int yOffset)
 
static bool PreOpenVanillaBag (string context, Player player, int arg)
 Calls each GlobalItem.PreOpenVanillaBag hook until one of them returns false. Returns true if all of them returned true. More...
 
static bool PreReforge (Item item)
 Calls ModItem.PreReforge, then all GlobalItem.PreReforge hooks. More...
 
static void PreUpdateVanitySet (Player player)
 If the player's head texture's IsVanitySet returns true, calls the equipment texture's PreUpdateVanitySet. This is then repeated for the player's body, then the legs. Then for each GlobalItem, if GlobalItem.IsVanitySet returns a non-empty string, calls GlobalItem.PreUpdateVanitySet, using player.head, player.body, and player.legs. More...
 
static bool ReforgePrice (Item item, ref int reforgePrice, ref bool canApplyDiscount)
 Call all ModItem.ReforgePrice, then GlobalItem.ReforgePrice hooks. More...
 
static void RightClick (Item item, Player player)
 If Main.mouseRightRelease is true, the following steps are taken: More...
 
static void SetMatch (int armorSlot, int type, bool male, ref int equipSlot, ref bool robes)
 Calls EquipTexture.SetMatch, then all GlobalItem.SetMatch hooks. More...
 
static bool Shoot (Item item, Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
 Calls each GlobalItem.Shoot hook, then ModItem.Shoot, until one of them returns false. If all of them return true, returns true. More...
 
static void Update (Item item, ref float gravity, ref float maxFallSpeed)
 Calls ModItem.Update, then all GlobalItem.Update hooks. More...
 
static void UpdateAccessory (Item item, Player player, bool hideVisual)
 Calls ModItem.UpdateAccessory and all GlobalItem.UpdateAccessory hooks. More...
 
static void UpdateArmorSet (Player player, Item head, Item body, Item legs)
 If the head's ModItem.IsArmorSet returns true, calls the head's ModItem.UpdateArmorSet. This is then repeated for the body, then the legs. Then for each GlobalItem, if GlobalItem.IsArmorSet returns a non-empty string, calls GlobalItem.UpdateArmorSet with that string. More...
 
static void UpdateEquip (Item item, Player player)
 Calls ModItem.UpdateEquip and all GlobalItem.UpdateEquip hooks. More...
 
static void UpdateInventory (Item item, Player player)
 Calls ModItem.UpdateInventory and all GlobalItem.UpdateInventory hooks. More...
 
static void UpdateVanity (Player player)
 Calls each of the item's equipment texture's UpdateVanity hook. More...
 
static void UpdateVanitySet (Player player)
 If the player's head texture's IsVanitySet returns true, calls the equipment texture's UpdateVanitySet. This is then repeated for the player's body, then the legs. Then for each GlobalItem, if GlobalItem.IsVanitySet returns a non-empty string, calls GlobalItem.UpdateVanitySet, using player.head, player.body, and player.legs. More...
 
static bool UseItem (Item item, Player player)
 Returns true if any of ModItem.UseItem or GlobalItem.UseItem return true Does not fail fast (calls every hook) More...
 
static bool UseItemFrame (Item item, Player player)
 Calls ModItem.UseItemFrame, then all GlobalItem.UseItemFrame hooks, until one of them returns true. Returns whether any of the hooks returned true. More...
 
static void UseItemHitbox (Item item, Player player, ref Rectangle hitbox, ref bool noHitbox)
 Calls ModItem.UseItemHitbox, then all GlobalItem.UseItemHitbox hooks. More...
 
static void UseStyle (Item item, Player player)
 Calls ModItem.UseStyle and all GlobalItem.UseStyle hooks. More...
 
static float UseTimeMultiplier (Item item, Player player)
 
static void VerticalWingSpeeds (Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend)
 If the player is using wings, this uses the result of GetWing, and calls ModItem.VerticalWingSpeeds then all GlobalItem.VerticalWingSpeeds hooks. More...
 
static bool WingUpdate (Player player, bool inUse)
 If wings can be seen on the player, calls the player's wing's equipment texture's WingUpdate and all GlobalItem.WingUpdate hooks. More...
 

Static Public Attributes

static int ItemCount => nextItem
 

Private Member Functions

delegate void DelegateAnglerChat (int type, ref string chat, ref string catchLocation)
 
delegate void DelegateArmorArmGlowMask (int slot, Player drawPlayer, float shadow, ref int glowMask, ref Color color)
 
delegate void DelegateCaughtFishStack (int type, ref int stack)
 
delegate void DelegateDrawArmorColor (EquipType type, int slot, Player drawPlayer, float shadow, ref Color color, ref int glowMask, ref Color glowMaskColor)
 
delegate void DelegateDrawHair (int body, ref bool drawHair, ref bool drawAltHair)
 
delegate void DelegateDrawHands (int body, ref bool drawHands, ref bool drawArms)
 
delegate void DelegateExtractinatorUse (int extractType, ref int resultType, ref int resultStack)
 
delegate void DelegateGetHealLife (Item item, Player player, bool quickHeal, ref int healValue)
 
delegate void DelegateGetHealMana (Item item, Player player, bool quickHeal, ref int healValue)
 
delegate void DelegateGetWeaponCrit (Item item, Player player, ref int crit)
 
delegate void DelegateGetWeaponDamage (Item item, Player player, ref int damage)
 
delegate void DelegateGetWeaponKnockback (Item item, Player player, ref float knockback)
 
delegate void DelegateGrabRange (Item item, Player player, ref int grabRange)
 
delegate void DelegateHorizontalWingSpeeds (Item item, Player player, ref float speed, ref float acceleration)
 
delegate void DelegateModifyHitNPC (Item item, Player player, NPC target, ref int damage, ref float knockBack, ref bool crit)
 
delegate void DelegateModifyHitPvp (Item item, Player player, Player target, ref int damage, ref bool crit)
 
delegate void DelegateModifyManaCost (Item item, Player player, ref float reduce, ref float mult)
 
delegate void DelegateModifyWeaponDamage (Item item, Player player, ref float add, ref float mult)
 
delegate void DelegateOldPickAmmo (Item item, Player player, ref int type, ref float speed, ref int damage, ref float knockback)
 
delegate void DelegatePickAmmo (Item weapon, Item ammo, Player player, ref int type, ref float speed, ref int damage, ref float knockback)
 
delegate void DelegatePostDrawTooltip (Item item, ReadOnlyCollection< DrawableTooltipLine > lines)
 
delegate void DelegatePostDrawTooltipLine (Item item, DrawableTooltipLine line)
 
delegate bool DelegatePreDrawInWorld (Item item, SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI)
 
delegate bool DelegatePreDrawTooltip (Item item, ReadOnlyCollection< TooltipLine > lines, ref int x, ref int y)
 
delegate bool DelegatePreDrawTooltipLine (Item item, DrawableTooltipLine line, ref int yOffset)
 
delegate bool DelegateReforgePrice (Item item, ref int reforgePrice, ref bool canApplyDiscount)
 
delegate void DelegateSetMatch (int armorSlot, int type, bool male, ref int equipSlot, ref bool robes)
 
delegate bool DelegateShoot (Item item, Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
 
delegate void DelegateUpdate (Item item, ref float gravity, ref float maxFallSpeed)
 
delegate void DelegateUseItemHitbox (Item item, Player player, ref Rectangle hitbox, ref bool noHitbox)
 
delegate void DelegateVerticalWingSpeeds (Item item, Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend)
 

Static Private Member Functions

static HookList AddHook< F > (Expression< Func< GlobalItem, F >> func)
 
static Rectangle AnimatedItemFrame (Item item)
 
static void FindVanillaWings ()
 
static bool GeneralPrefix (Item item)
 
static bool HasMethod (Type t, string method, params Type[] args)
 

Static Private Attributes

static HookList HookAltFunctionUse = AddHook<Func<Item, Player, bool>>(g => g.AltFunctionUse)
 
static HookList HookAnglerChat = AddHook<DelegateAnglerChat>(g => g.AnglerChat)
 
static HookList HookArmorArmGlowMask = AddHook<DelegateArmorArmGlowMask>(g => g.ArmorArmGlowMask)
 
static HookList HookArmorSetShadows = AddHook<Action<Player, string>>(g => g.ArmorSetShadows)
 
static HookList HookCanEquipAccessory = AddHook<Func<Item, Player, int, bool>>(g => g.CanEquipAccessory)
 
static HookList HookCanHitNPC = AddHook<Func<Item, Player, NPC, bool?>>(g => g.CanHitNPC)
 
static HookList HookCanHitPvp = AddHook<Func<Item, Player, Player, bool>>(g => g.CanHitPvp)
 
static HookList HookCanPickup = AddHook<Func<Item, Player, bool>>(g => g.CanPickup)
 
static HookList HookCanRightClick = AddHook<Func<Item, bool>>(g => g.CanRightClick)
 
static HookList HookCanUseItem = AddHook<Func<Item, Player, bool>>(g => g.CanUseItem)
 
static HookList HookCaughtFishStack = AddHook<DelegateCaughtFishStack>(g => g.CaughtFishStack)
 
static HookList HookChoosePrefix = AddHook<Func<Item, UnifiedRandom, int>>(g => g.ChoosePrefix)
 
static HookList HookConsumeAmmo = AddHook<Func<Item, Player, bool>>(g => g.ConsumeAmmo)
 
static HookList HookConsumeItem = AddHook<Func<Item, Player, bool>>(g => g.ConsumeItem)
 
static HookList HookDrawArmorColor = AddHook<DelegateDrawArmorColor>(g => g.DrawArmorColor)
 
static HookList HookDrawBody = AddHook<Func<int, bool>>(g => g.DrawBody)
 
static HookList HookDrawHair = AddHook<DelegateDrawHair>(g => g.DrawHair)
 
static HookList HookDrawHands = AddHook<DelegateDrawHands>(g => g.DrawHands)
 
static HookList HookDrawHead = AddHook<Func<int, bool>>(g => g.DrawHead)
 
static HookList HookDrawLegs = AddHook<Func<int, int, bool>>(g => g.DrawLegs)
 
static HookList HookExtractinatorUse = AddHook<DelegateExtractinatorUse>(g => g.ExtractinatorUse)
 
static HookList HookGetAlpha = AddHook<Func<Item, Color, Color?>>(g => g.GetAlpha)
 
static HookList HookGetHealLife = AddHook<DelegateGetHealLife>(g => g.GetHealLife)
 
static HookList HookGetHealMana = AddHook<DelegateGetHealMana>(g => g.GetHealMana)
 
static HookList HookGetWeaponCrit = AddHook<DelegateGetWeaponCrit>(g => g.GetWeaponCrit)
 
static HookList HookGetWeaponDamage = AddHook<DelegateGetWeaponDamage>(g => g.GetWeaponDamage)
 
static HookList HookGetWeaponKnockback = AddHook<DelegateGetWeaponKnockback>(g => g.GetWeaponKnockback)
 
static HookList HookGrabRange = AddHook<DelegateGrabRange>(g => g.GrabRange)
 
static HookList HookGrabStyle = AddHook<Func<Item, Player, bool>>(g => g.GrabStyle)
 
static HookList HookHoldItem = AddHook<Action<Item, Player>>(g => g.HoldItem)
 
static HookList HookHoldItemFrame = AddHook<Func<Item, Player, bool>>(g => g.HoldItemFrame)
 
static HookList HookHoldoutOffset = AddHook<Func<int, Vector2?>>(g => g.HoldoutOffset)
 
static HookList HookHoldoutOrigin = AddHook<Func<int, Vector2?>>(g => g.HoldoutOrigin)
 
static HookList HookHoldStyle = AddHook<Action<Item, Player>>(g => g.HoldStyle)
 
static HookList HookHorizontalWingSpeeds = AddHook<DelegateHorizontalWingSpeeds>(g => g.HorizontalWingSpeeds)
 
static HookList HookIsAnglerQuestAvailable = AddHook<Func<int, bool>>(g => g.IsAnglerQuestAvailable)
 
static HookList HookItemSpace = AddHook<Func<Item, Player, bool>>(g => g.ItemSpace)
 
static HookList HookMeleeEffects = AddHook<Action<Item, Player, Rectangle>>(g => g.MeleeEffects)
 
static HookList HookMeleeSpeedMultiplier = AddHook<Func<Item, Player, float>>(g => g.MeleeSpeedMultiplier)
 
static HookList HookModifyHitNPC = AddHook<DelegateModifyHitNPC>(g => g.ModifyHitNPC)
 
static HookList HookModifyHitPvp = AddHook<DelegateModifyHitPvp>(g => g.ModifyHitPvp)
 
static HookList HookModifyManaCost = AddHook<DelegateModifyManaCost>(g => g.ModifyManaCost)
 
static HookList HookModifyTooltips = AddHook<Action<Item, List<TooltipLine>>>(g => g.ModifyTooltips)
 
static HookList HookModifyWeaponDamage = AddHook<DelegateModifyWeaponDamage>(g => g.ModifyWeaponDamage)
 
static HookList HookNeedsSaving = AddHook<Func<Item, bool>>(g => g.NeedsSaving)
 
static HookList HookOldPickAmmo = AddHook<DelegateOldPickAmmo>(g => g.PickAmmo)
 
static HookList HookOnConsumeAmmo = AddHook<Action<Item, Player>>(g => g.OnConsumeAmmo)
 
static HookList HookOnConsumeItem = AddHook<Action<Item, Player>>(g => g.OnConsumeItem)
 
static HookList HookOnConsumeMana = AddHook<Action<Item, Player, int>>(g => g.OnConsumeMana)
 
static HookList HookOnCraft = AddHook<Action<Item, Recipe>>(g => g.OnCraft)
 
static HookList HookOnHitNPC = AddHook<Action<Item, Player, NPC, int, float, bool>>(g => g.OnHitNPC)
 
static HookList HookOnHitPvp = AddHook<Action<Item, Player, Player, int, bool>>(g => g.OnHitPvp)
 
static HookList HookOnMissingMana = AddHook<Action<Item, Player, int>>(g => g.OnMissingMana)
 
static HookList HookOnPickup = AddHook<Func<Item, Player, bool>>(g => g.OnPickup)
 
static HookList HookOpenVanillaBag = AddHook<Action<string, Player, int>>(g => g.OpenVanillaBag)
 
static HookList HookPickAmmo = AddHook<DelegatePickAmmo>(g => g.PickAmmo)
 
static HookList HookPostDrawInInventory = AddHook<Action<Item, SpriteBatch, Vector2, Rectangle, Color, Color, Vector2, float>>(g => g.PostDrawInInventory)
 
static HookList HookPostDrawInWorld = AddHook<Action<Item, SpriteBatch, Color, Color, float, float, int>>(g => g.PostDrawInWorld)
 
static HookList HookPostDrawTooltip = AddHook<DelegatePostDrawTooltip>(g => g.PostDrawTooltip)
 
static HookList HookPostDrawTooltipLine = AddHook<DelegatePostDrawTooltipLine>(g => g.PostDrawTooltipLine)
 
static HookList HookPostReforge = AddHook<Action<Item>>(g => g.PostReforge)
 
static HookList HookPostUpdate = AddHook<Action<Item>>(g => g.PostUpdate)
 
static HookList HookPreDrawInInventory = AddHook<Func<Item, SpriteBatch, Vector2, Rectangle, Color, Color, Vector2, float, bool>>(g => g.PreDrawInInventory)
 
static HookList HookPreDrawInWorld = AddHook<DelegatePreDrawInWorld>(g => g.PreDrawInWorld)
 
static HookList HookPreDrawTooltip = AddHook<DelegatePreDrawTooltip>(g => g.PreDrawTooltip)
 
static HookList HookPreDrawTooltipLine = AddHook<DelegatePreDrawTooltipLine>(g => g.PreDrawTooltipLine)
 
static HookList HookPreOpenVanillaBag = AddHook<Func<string, Player, int, bool>>(g => g.PreOpenVanillaBag)
 
static HookList HookPreReforge = AddHook<Func<Item, bool>>(g => g.NewPreReforge)
 
static HookList HookPreUpdateVanitySet = AddHook<Action<Player, string>>(g => g.PreUpdateVanitySet)
 
static HookList HookReforgePrice = AddHook<DelegateReforgePrice>(g => g.ReforgePrice)
 
static HookList HookRightClick = AddHook<Action<Item, Player>>(g => g.RightClick)
 
static List< HookListhooks = new List<HookList>()
 
static HookList HookSetDefaults = AddHook<Action<Item>>(g => g.SetDefaults)
 
static HookList HookSetMatch = AddHook<DelegateSetMatch>(g => g.SetMatch)
 
static HookList HookShoot = AddHook<DelegateShoot>(g => g.Shoot)
 
static HookList HookUpdate = AddHook<DelegateUpdate>(g => g.Update)
 
static HookList HookUpdateAccessory = AddHook<Action<Item, Player, bool>>(g => g.UpdateAccessory)
 
static HookList HookUpdateArmorSet = AddHook<Action<Player, string>>(g => g.UpdateArmorSet)
 
static HookList HookUpdateEquip = AddHook<Action<Item, Player>>(g => g.UpdateEquip)
 
static HookList HookUpdateInventory = AddHook<Action<Item, Player>>(g => g.UpdateInventory)
 
static HookList HookUpdateVanitySet = AddHook<Action<Player, string>>(g => g.UpdateVanitySet)
 
static HookList HookUseItem = AddHook<Func<Item, Player, bool>>(g => g.UseItem)
 
static HookList HookUseItemFrame = AddHook<Func<Item, Player, bool>>(g => g.UseItemFrame)
 
static HookList HookUseItemHitbox = AddHook<DelegateUseItemHitbox>(g => g.UseItemHitbox)
 
static HookList HookUseStyle = AddHook<Action<Item, Player>>(g => g.UseStyle)
 
static HookList HookUseTimeMultiplier = AddHook<Func<Item, Player, float>>(g => g.UseTimeMultiplier)
 
static HookList HookVerticalWingSpeeds = AddHook<DelegateVerticalWingSpeeds>(g => g.VerticalWingSpeeds)
 
static HookList HookWingUpdate = AddHook<Func<int, Player, bool, bool>>(g => g.WingUpdate)
 
static int nextItem = ItemID.Count
 

Detailed Description

This serves as the central class from which item-related functions are carried out. It also stores a list of mod items by ID.

Definition at line 21 of file ItemLoader.cs.

Member Function Documentation

◆ AddHook< F >()

static HookList Terraria.ModLoader.ItemLoader.AddHook< F > ( Expression< Func< GlobalItem, F >>  func)
staticprivate

Definition at line 46 of file ItemLoader.cs.

46  {
47  var hook = new HookList(ModLoader.Method(func));
48  hooks.Add(hook);
49  return hook;
50  }
static List< HookList > hooks
Definition: ItemLoader.cs:44

◆ AltFunctionUse()

static bool Terraria.ModLoader.ItemLoader.AltFunctionUse ( Item  item,
Player  player 
)
static

Calls ModItem.AltFunctionUse, then all GlobalItem.AltFunctionUse hooks, until one of them returns true. Returns whether any of the hooks returned true.

Definition at line 802 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

802  {
803  if (item.IsAir)
804  return false;
805 
806  if (item.modItem != null && item.modItem.AltFunctionUse(player))
807  return true;
808 
809  foreach (var g in HookAltFunctionUse.arr)
810  if (g.Instance(item).AltFunctionUse(item, player))
811  return true;
812 
813  return false;
814  }
static HookList HookAltFunctionUse
Definition: ItemLoader.cs:798

◆ AnglerChat()

static string Terraria.ModLoader.ItemLoader.AnglerChat ( int  type)
static

Definition at line 1598 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

1598  {
1599  string chat = "";
1600  string catchLocation = "";
1601  GetItem(type)?.AnglerQuestChat(ref chat, ref catchLocation);
1602 
1603  foreach (var g in HookAnglerChat.arr)
1604  g.AnglerChat(type, ref chat, ref catchLocation);
1605 
1606  if (string.IsNullOrEmpty(chat) || string.IsNullOrEmpty(catchLocation))
1607  return null;
1608 
1609  return chat + "\n\n(" + catchLocation + ")";
1610  }
static ModItem GetItem(int type)
Gets the ModItem instance corresponding to the specified type. Returns null if no modded item has the...
Definition: ItemLoader.cs:76
static HookList HookAnglerChat
Definition: ItemLoader.cs:1597
virtual void AnglerQuestChat(ref string description, ref string catchLocation)
Allows you to set what the Angler says when he requests for this item. The description parameter is h...
Definition: ModItem.cs:957

◆ AnimatedItemFrame()

static Rectangle Terraria.ModLoader.ItemLoader.AnimatedItemFrame ( Item  item)
staticprivate

Definition at line 241 of file ItemLoader.cs.

241  {
242  int frameCount = Main.itemAnimations[item.type].FrameCount;
243  int frameDuration = Main.itemAnimations[item.type].TicksPerFrame;
244  return Main.itemAnimations[item.type].GetFrame(Main.itemTexture[item.type]);
245  }

◆ ArmorArmGlowMask()

static void Terraria.ModLoader.ItemLoader.ArmorArmGlowMask ( int  slot,
Player  drawPlayer,
float  shadow,
ref int  glowMask,
ref Color  color 
)
static

Calls the item's body equipment texture's ArmorArmGlowMask hook, then all GlobalItem.ArmorArmGlowMask hooks.

Definition at line 1227 of file ItemLoader.cs.

References Terraria.ModLoader.EquipTexture.ArmorArmGlowMask(), Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.EquipLoader.GetEquipTexture().

1227  {
1228  EquipTexture texture = EquipLoader.GetEquipTexture(EquipType.Body, slot);
1229  texture?.ArmorArmGlowMask(drawPlayer, shadow, ref glowMask, ref color);
1230 
1231  foreach (var g in HookArmorArmGlowMask.arr)
1232  g.ArmorArmGlowMask(slot, drawPlayer, shadow, ref glowMask, ref color);
1233  }
static HookList HookArmorArmGlowMask
Definition: ItemLoader.cs:1223
EquipType
This is an enum of all the types of equipment that exist. An equipment type is defined as a type or l...
Definition: EquipType.cs:6
+ Here is the call graph for this function:

◆ ArmorSetShadows()

static void Terraria.ModLoader.ItemLoader.ArmorSetShadows ( Player  player)
static

If the player's head texture's IsVanitySet returns true, calls the equipment texture's ArmorSetShadows. This is then repeated for the player's body, then the legs. Then for each GlobalItem, if GlobalItem.IsVanitySet returns a non-empty string, calls GlobalItem.ArmorSetShadows, using player.head, player.body, and player.legs.

Definition at line 953 of file ItemLoader.cs.

References Terraria.ModLoader.EquipTexture.ArmorSetShadows(), Terraria.ModLoader.GlobalItem.ArmorSetShadows(), Terraria.ModLoader.ItemLoader.HookList.arr, Terraria.ModLoader.EquipLoader.GetEquipTexture(), Terraria.ModLoader.EquipTexture.IsVanitySet(), and Terraria.ModLoader.GlobalItem.IsVanitySet().

953  {
954  EquipTexture headTexture = EquipLoader.GetEquipTexture(EquipType.Head, player.head);
955  EquipTexture bodyTexture = EquipLoader.GetEquipTexture(EquipType.Body, player.body);
956  EquipTexture legTexture = EquipLoader.GetEquipTexture(EquipType.Legs, player.legs);
957  if (headTexture != null && headTexture.IsVanitySet(player.head, player.body, player.legs))
958  headTexture.ArmorSetShadows(player);
959 
960  if (bodyTexture != null && bodyTexture.IsVanitySet(player.head, player.body, player.legs))
961  bodyTexture.ArmorSetShadows(player);
962 
963  if (legTexture != null && legTexture.IsVanitySet(player.head, player.body, player.legs))
964  legTexture.ArmorSetShadows(player);
965 
966  foreach (GlobalItem globalItem in HookArmorSetShadows.arr) {
967  string set = globalItem.IsVanitySet(player.head, player.body, player.legs);
968  if (!string.IsNullOrEmpty(set))
969  globalItem.ArmorSetShadows(player, set);
970  }
971  }
EquipType
This is an enum of all the types of equipment that exist. An equipment type is defined as a type or l...
Definition: EquipType.cs:6
static HookList HookArmorSetShadows
Definition: ItemLoader.cs:947
+ Here is the call graph for this function:

◆ AutoLightSelect()

static void Terraria.ModLoader.ItemLoader.AutoLightSelect ( Item  item,
ref bool  dryTorch,
ref bool  wetTorch,
ref bool  glowstick 
)
static

Definition at line 1564 of file ItemLoader.cs.

1564  {
1565  if (item.modItem != null) {
1566  item.modItem.AutoLightSelect(ref dryTorch, ref wetTorch, ref glowstick);
1567  if (wetTorch) {
1568  dryTorch = false;
1569  glowstick = false;
1570  }
1571  if (dryTorch) {
1572  glowstick = false;
1573  }
1574  }
1575  }

◆ CanEquipAccessory()

static bool Terraria.ModLoader.ItemLoader.CanEquipAccessory ( Item  item,
int  slot 
)
static

Definition at line 1543 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

1543  {
1544  Player player = Main.player[Main.myPlayer];
1545  if (item.modItem != null && !item.modItem.CanEquipAccessory(player, slot))
1546  return false;
1547 
1548  foreach (var g in HookCanEquipAccessory.arr)
1549  if (!g.Instance(item).CanEquipAccessory(item, player, slot))
1550  return false;
1551 
1552  return true;
1553  }
static HookList HookCanEquipAccessory
Definition: ItemLoader.cs:1540

◆ CanHitNPC()

static bool Terraria.ModLoader.ItemLoader.CanHitNPC ( Item  item,
Player  player,
NPC  target 
)
static

Gathers the results of ModItem.CanHitNPC and all GlobalItem.CanHitNPC hooks. If any of them returns false, this returns false. Otherwise, if any of them returns true then this returns true. If all of them return null, this returns null.

Definition at line 622 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.Item.

622  {
623  bool? canHit = item.modItem?.CanHitNPC(player, target);
624  if (canHit.HasValue && !canHit.Value) {
625  return false;
626  }
627  foreach (var g in HookCanHitNPC.arr) {
628  bool? globalCanHit = g.Instance(item).CanHitNPC(item, player, target);
629  if (globalCanHit.HasValue) {
630  if (globalCanHit.Value) {
631  canHit = true;
632  }
633  else {
634  return false;
635  }
636  }
637  }
638  return canHit;
639  }
static HookList HookCanHitNPC
Definition: ItemLoader.cs:611

◆ CanHitPvp()

static bool Terraria.ModLoader.ItemLoader.CanHitPvp ( Item  item,
Player  player,
Player  target 
)
static

Calls all GlobalItem.CanHitPvp hooks, then ModItem.CanHitPvp, until one of them returns false. If all of them return true, this returns true.

Definition at line 674 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.Item.

674  {
675  foreach (var g in HookCanHitPvp.arr)
676  if (!g.Instance(item).CanHitPvp(item, player, target))
677  return false;
678 
679  return item.modItem == null || item.modItem.CanHitPvp(player, target);
680  }
static HookList HookCanHitPvp
Definition: ItemLoader.cs:668

◆ CanPickup()

static bool Terraria.ModLoader.ItemLoader.CanPickup ( Item  item,
Player  player 
)
static

Definition at line 1381 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

1381  {
1382  foreach (var g in HookCanPickup.arr)
1383  if (!g.Instance(item).CanPickup(item, player))
1384  return false;
1385 
1386  return item.modItem?.CanPickup(player) ?? true;
1387  }
static HookList HookCanPickup
Definition: ItemLoader.cs:1378

◆ CanRightClick()

static bool Terraria.ModLoader.ItemLoader.CanRightClick ( Item  item)
static

Calls ModItem.CanRightClick, then all GlobalItem.CanRightClick hooks, until one of the returns true. If one of the returns true, returns Main.mouseRight. Otherwise, returns false.

Definition at line 992 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

992  {
993  if (item.IsAir || !Main.mouseRight)
994  return false;
995 
996  if (item.modItem != null && item.modItem.CanRightClick())
997  return true;
998 
999  foreach (var g in HookCanRightClick.arr)
1000  if (g.Instance(item).CanRightClick(item))
1001  return true;
1002 
1003  return false;
1004  }
static HookList HookCanRightClick
Definition: ItemLoader.cs:986

◆ CanUseItem()

static bool Terraria.ModLoader.ItemLoader.CanUseItem ( Item  item,
Player  player 
)
static

Returns the "and" operation on the results of ModItem.CanUseItem and all GlobalItem.CanUseItem hooks. Does not fail fast (every hook is called).

Parameters
itemThe item.
playerThe player holding the item.

Definition at line 272 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

272  {
273  bool flag = true;
274  if (item.modItem != null)
275  flag &= item.modItem.CanUseItem(player);
276 
277  foreach (var g in HookCanUseItem.arr)
278  flag &= g.Instance(item).CanUseItem(item, player);
279 
280  return flag;
281  }
static HookList HookCanUseItem
Definition: ItemLoader.cs:262

◆ CaughtFishStack()

static void Terraria.ModLoader.ItemLoader.CaughtFishStack ( Item  item)
static

Definition at line 1579 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

1579  {
1580  item.modItem?.CaughtFishStack(ref item.stack);
1581 
1582  foreach (var g in HookCaughtFishStack.arr)
1583  g.Instance(item).CaughtFishStack(item.type, ref item.stack);
1584  }
static HookList HookCaughtFishStack
Definition: ItemLoader.cs:1578

◆ CheckProjOnSwing()

static bool Terraria.ModLoader.ItemLoader.CheckProjOnSwing ( Player  player,
Item  item 
)
static

If the item is a modded item, ModItem.checkProjOnSwing is true, and the player is not at the beginning of the item's use animation, sets canShoot to false.

Definition at line 496 of file ItemLoader.cs.

References Terraria.ModLoader.Item.

496  {
497  return item.modItem == null || !item.modItem.OnlyShootOnSwing || player.itemAnimation == player.itemAnimationMax - 1;
498  }

◆ ChoosePrefix()

static int Terraria.ModLoader.ItemLoader.ChoosePrefix ( Item  item,
UnifiedRandom  rand 
)
static

Definition at line 249 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

249  {
250  foreach (var g in HookChoosePrefix.arr) {
251  int pre = g.Instance(item).ChoosePrefix(item, rand);
252  if (pre >= 0) {
253  return pre;
254  }
255  }
256  if (item.modItem != null) {
257  return item.modItem.ChoosePrefix(rand);
258  }
259  return -1;
260  }
static HookList HookChoosePrefix
Definition: ItemLoader.cs:247

◆ ConsumeAmmo()

static bool Terraria.ModLoader.ItemLoader.ConsumeAmmo ( Item  item,
Item  ammo,
Player  player 
)
static

Calls ModItem.ConsumeAmmo for the weapon, ModItem.ConsumeAmmo for the ammo, then each GlobalItem.ConsumeAmmo hook for the weapon and ammo, until one of them returns false. If all of them return true, returns true.

Definition at line 526 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

526  {
527  if (item.modItem != null && !item.modItem.ConsumeAmmo(player) ||
528  ammo.modItem != null && !ammo.modItem.ConsumeAmmo(player))
529  return false;
530 
531  foreach (var g in HookConsumeAmmo.arr) {
532  if (!g.Instance(item).ConsumeAmmo(item, player) ||
533  !g.Instance(ammo).ConsumeAmmo(ammo, player))
534  return false;
535  }
536 
537  return true;
538  }
static HookList HookConsumeAmmo
Definition: ItemLoader.cs:520

◆ ConsumeItem()

static bool Terraria.ModLoader.ItemLoader.ConsumeItem ( Item  item,
Player  player 
)
static

If ModItem.ConsumeItem or any of the GlobalItem.ConsumeItem hooks returns false, sets consume to false.

Definition at line 734 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

734  {
735  if (item.IsAir) return true;
736  if (item.modItem != null && !item.modItem.ConsumeItem(player))
737  return false;
738 
739  foreach (var g in HookConsumeItem.arr)
740  if (!g.Instance(item).ConsumeItem(item, player))
741  return false;
742 
743  OnConsumeItem(item, player);
744  return true;
745  }
static void OnConsumeItem(Item item, Player player)
Calls ModItem.OnConsumeItem and all GlobalItem.OnConsumeItem hooks.
Definition: ItemLoader.cs:751
static HookList HookConsumeItem
Definition: ItemLoader.cs:728

◆ DelegateAnglerChat()

delegate void Terraria.ModLoader.ItemLoader.DelegateAnglerChat ( int  type,
ref string  chat,
ref string  catchLocation 
)
private

◆ DelegateArmorArmGlowMask()

delegate void Terraria.ModLoader.ItemLoader.DelegateArmorArmGlowMask ( int  slot,
Player  drawPlayer,
float  shadow,
ref int  glowMask,
ref Color  color 
)
private

◆ DelegateCaughtFishStack()

delegate void Terraria.ModLoader.ItemLoader.DelegateCaughtFishStack ( int  type,
ref int  stack 
)
private

◆ DelegateDrawArmorColor()

delegate void Terraria.ModLoader.ItemLoader.DelegateDrawArmorColor ( EquipType  type,
int  slot,
Player  drawPlayer,
float  shadow,
ref Color  color,
ref int  glowMask,
ref Color  glowMaskColor 
)
private

◆ DelegateDrawHair()

delegate void Terraria.ModLoader.ItemLoader.DelegateDrawHair ( int  body,
ref bool  drawHair,
ref bool  drawAltHair 
)
private

◆ DelegateDrawHands()

delegate void Terraria.ModLoader.ItemLoader.DelegateDrawHands ( int  body,
ref bool  drawHands,
ref bool  drawArms 
)
private

◆ DelegateExtractinatorUse()

delegate void Terraria.ModLoader.ItemLoader.DelegateExtractinatorUse ( int  extractType,
ref int  resultType,
ref int  resultStack 
)
private

◆ DelegateGetHealLife()

delegate void Terraria.ModLoader.ItemLoader.DelegateGetHealLife ( Item  item,
Player  player,
bool  quickHeal,
ref int  healValue 
)
private

◆ DelegateGetHealMana()

delegate void Terraria.ModLoader.ItemLoader.DelegateGetHealMana ( Item  item,
Player  player,
bool  quickHeal,
ref int  healValue 
)
private

◆ DelegateGetWeaponCrit()

delegate void Terraria.ModLoader.ItemLoader.DelegateGetWeaponCrit ( Item  item,
Player  player,
ref int  crit 
)
private

◆ DelegateGetWeaponDamage()

delegate void Terraria.ModLoader.ItemLoader.DelegateGetWeaponDamage ( Item  item,
Player  player,
ref int  damage 
)
private

◆ DelegateGetWeaponKnockback()

delegate void Terraria.ModLoader.ItemLoader.DelegateGetWeaponKnockback ( Item  item,
Player  player,
ref float  knockback 
)
private

◆ DelegateGrabRange()

delegate void Terraria.ModLoader.ItemLoader.DelegateGrabRange ( Item  item,
Player  player,
ref int  grabRange 
)
private

◆ DelegateHorizontalWingSpeeds()

delegate void Terraria.ModLoader.ItemLoader.DelegateHorizontalWingSpeeds ( Item  item,
Player  player,
ref float  speed,
ref float  acceleration 
)
private

◆ DelegateModifyHitNPC()

delegate void Terraria.ModLoader.ItemLoader.DelegateModifyHitNPC ( Item  item,
Player  player,
NPC  target,
ref int  damage,
ref float  knockBack,
ref bool  crit 
)
private

◆ DelegateModifyHitPvp()

delegate void Terraria.ModLoader.ItemLoader.DelegateModifyHitPvp ( Item  item,
Player  player,
Player  target,
ref int  damage,
ref bool  crit 
)
private

◆ DelegateModifyManaCost()

delegate void Terraria.ModLoader.ItemLoader.DelegateModifyManaCost ( Item  item,
Player  player,
ref float  reduce,
ref float  mult 
)
private

◆ DelegateModifyWeaponDamage()

delegate void Terraria.ModLoader.ItemLoader.DelegateModifyWeaponDamage ( Item  item,
Player  player,
ref float  add,
ref float  mult 
)
private

◆ DelegateOldPickAmmo()

delegate void Terraria.ModLoader.ItemLoader.DelegateOldPickAmmo ( Item  item,
Player  player,
ref int  type,
ref float  speed,
ref int  damage,
ref float  knockback 
)
private

◆ DelegatePickAmmo()

delegate void Terraria.ModLoader.ItemLoader.DelegatePickAmmo ( Item  weapon,
Item  ammo,
Player  player,
ref int  type,
ref float  speed,
ref int  damage,
ref float  knockback 
)
private

◆ DelegatePostDrawTooltip()

delegate void Terraria.ModLoader.ItemLoader.DelegatePostDrawTooltip ( Item  item,
ReadOnlyCollection< DrawableTooltipLine lines 
)
private

◆ DelegatePostDrawTooltipLine()

delegate void Terraria.ModLoader.ItemLoader.DelegatePostDrawTooltipLine ( Item  item,
DrawableTooltipLine  line 
)
private

◆ DelegatePreDrawInWorld()

delegate bool Terraria.ModLoader.ItemLoader.DelegatePreDrawInWorld ( Item  item,
SpriteBatch  spriteBatch,
Color  lightColor,
Color  alphaColor,
ref float  rotation,
ref float  scale,
int  whoAmI 
)
private

◆ DelegatePreDrawTooltip()

delegate bool Terraria.ModLoader.ItemLoader.DelegatePreDrawTooltip ( Item  item,
ReadOnlyCollection< TooltipLine lines,
ref int  x,
ref int  y 
)
private

◆ DelegatePreDrawTooltipLine()

delegate bool Terraria.ModLoader.ItemLoader.DelegatePreDrawTooltipLine ( Item  item,
DrawableTooltipLine  line,
ref int  yOffset 
)
private

◆ DelegateReforgePrice()

delegate bool Terraria.ModLoader.ItemLoader.DelegateReforgePrice ( Item  item,
ref int  reforgePrice,
ref bool  canApplyDiscount 
)
private

◆ DelegateSetMatch()

delegate void Terraria.ModLoader.ItemLoader.DelegateSetMatch ( int  armorSlot,
int  type,
bool  male,
ref int  equipSlot,
ref bool  robes 
)
private

◆ DelegateShoot()

delegate bool Terraria.ModLoader.ItemLoader.DelegateShoot ( Item  item,
Player  player,
ref Vector2  position,
ref float  speedX,
ref float  speedY,
ref int  type,
ref int  damage,
ref float  knockBack 
)
private

◆ DelegateUpdate()

delegate void Terraria.ModLoader.ItemLoader.DelegateUpdate ( Item  item,
ref float  gravity,
ref float  maxFallSpeed 
)
private

◆ DelegateUseItemHitbox()

delegate void Terraria.ModLoader.ItemLoader.DelegateUseItemHitbox ( Item  item,
Player  player,
ref Rectangle  hitbox,
ref bool  noHitbox 
)
private

◆ DelegateVerticalWingSpeeds()

delegate void Terraria.ModLoader.ItemLoader.DelegateVerticalWingSpeeds ( Item  item,
Player  player,
ref float  ascentWhenFalling,
ref float  ascentWhenRising,
ref float  maxCanAscendMultiplier,
ref float  maxAscentMultiplier,
ref float  constantAscend 
)
private

◆ DrawArmorColor()

static void Terraria.ModLoader.ItemLoader.DrawArmorColor ( EquipType  type,
int  slot,
Player  drawPlayer,
float  shadow,
ref Color  color,
ref int  glowMask,
ref Color  glowMaskColor 
)
static

Calls the item's equipment texture's DrawArmorColor hook, then all GlobalItem.DrawArmorColor hooks.

Definition at line 1213 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, Terraria.ModLoader.EquipTexture.DrawArmorColor(), and Terraria.ModLoader.EquipLoader.GetEquipTexture().

1214  {
1215  EquipTexture texture = EquipLoader.GetEquipTexture(type, slot);
1216  texture?.DrawArmorColor(drawPlayer, shadow, ref color, ref glowMask, ref glowMaskColor);
1217 
1218  foreach (var g in HookDrawArmorColor.arr)
1219  g.DrawArmorColor(type, slot, drawPlayer, shadow, ref color, ref glowMask, ref glowMaskColor);
1220  }
static HookList HookDrawArmorColor
Definition: ItemLoader.cs:1209
+ Here is the call graph for this function:

◆ DrawBody()

static bool Terraria.ModLoader.ItemLoader.DrawBody ( Player  player)
static

Calls the item's body equipment texture's DrawBody hook, then all GlobalItem.DrawBody hooks, until one of them returns false. Returns true if none of them return false.

Definition at line 1176 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, Terraria.ModLoader.EquipTexture.DrawBody(), and Terraria.ModLoader.EquipLoader.GetEquipTexture().

1176  {
1177  EquipTexture texture = EquipLoader.GetEquipTexture(EquipType.Body, player.body);
1178  if (texture != null && !texture.DrawBody())
1179  return false;
1180 
1181  foreach (var g in HookDrawBody.arr)
1182  if (!g.DrawBody(player.head))
1183  return false;
1184 
1185  return true;
1186  }
EquipType
This is an enum of all the types of equipment that exist. An equipment type is defined as a type or l...
Definition: EquipType.cs:6
static HookList HookDrawBody
Definition: ItemLoader.cs:1172
+ Here is the call graph for this function:

◆ DrawHair()

static void Terraria.ModLoader.ItemLoader.DrawHair ( Player  player,
ref bool  drawHair,
ref bool  drawAltHair 
)
static

Calls the item's head equipment texture's DrawHair hook, then all GlobalItem.DrawHair hooks.

Definition at line 1145 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, Terraria.ModLoader.EquipTexture.DrawHair(), and Terraria.ModLoader.EquipLoader.GetEquipTexture().

1145  {
1146  EquipTexture texture = EquipLoader.GetEquipTexture(EquipType.Head, player.head);
1147  texture?.DrawHair(ref drawHair, ref drawAltHair);
1148 
1149  foreach (var g in HookDrawHair.arr)
1150  g.DrawHair(player.body, ref drawHair, ref drawAltHair);
1151  }
static HookList HookDrawHair
Definition: ItemLoader.cs:1137
EquipType
This is an enum of all the types of equipment that exist. An equipment type is defined as a type or l...
Definition: EquipType.cs:6
+ Here is the call graph for this function:

◆ DrawHands()

static void Terraria.ModLoader.ItemLoader.DrawHands ( Player  player,
ref bool  drawHands,
ref bool  drawArms 
)
static

Calls the item's body equipment texture's DrawHands hook, then all GlobalItem.DrawHands hooks.

Definition at line 1128 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, Terraria.ModLoader.EquipTexture.DrawHands(), and Terraria.ModLoader.EquipLoader.GetEquipTexture().

1128  {
1129  EquipTexture texture = EquipLoader.GetEquipTexture(EquipType.Body, player.body);
1130  texture?.DrawHands(ref drawHands, ref drawArms);
1131 
1132  foreach (var g in HookDrawHands.arr)
1133  g.DrawHands(player.body, ref drawHands, ref drawArms);
1134  }
static HookList HookDrawHands
Definition: ItemLoader.cs:1124
EquipType
This is an enum of all the types of equipment that exist. An equipment type is defined as a type or l...
Definition: EquipType.cs:6
+ Here is the call graph for this function:

◆ DrawHead()

static bool Terraria.ModLoader.ItemLoader.DrawHead ( Player  player)
static

Calls the item's head equipment texture's DrawHead hook, then all GlobalItem.DrawHead hooks, until one of them returns false. Returns true if none of them return false.

Definition at line 1160 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, Terraria.ModLoader.EquipTexture.DrawHead(), and Terraria.ModLoader.EquipLoader.GetEquipTexture().

1160  {
1161  EquipTexture texture = EquipLoader.GetEquipTexture(EquipType.Head, player.head);
1162  if (texture != null && !texture.DrawHead())
1163  return false;
1164 
1165  foreach (var g in HookDrawHead.arr)
1166  if (!g.DrawHead(player.head))
1167  return false;
1168 
1169  return true;
1170  }
static HookList HookDrawHead
Definition: ItemLoader.cs:1153
EquipType
This is an enum of all the types of equipment that exist. An equipment type is defined as a type or l...
Definition: EquipType.cs:6
+ Here is the call graph for this function:

◆ DrawLegs()

static bool Terraria.ModLoader.ItemLoader.DrawLegs ( Player  player)
static

Calls the item's leg equipment texture's DrawLegs hook, then the item's shoe equipment texture's DrawLegs hook, then all GlobalItem.DrawLegs hooks, until one of them returns false. Returns true if none of them return false.

Definition at line 1192 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, Terraria.ModLoader.EquipTexture.DrawLegs(), and Terraria.ModLoader.EquipLoader.GetEquipTexture().

1192  {
1193  EquipTexture texture = EquipLoader.GetEquipTexture(EquipType.Legs, player.legs);
1194  if (texture != null && !texture.DrawLegs())
1195  return false;
1196 
1197  texture = EquipLoader.GetEquipTexture(EquipType.Shoes, player.shoe);
1198  if (texture != null && !texture.DrawLegs())
1199  return false;
1200 
1201  foreach (var g in HookDrawLegs.arr)
1202  if (!g.DrawLegs(player.legs, player.shoe))
1203  return false;
1204 
1205  return true;
1206  }
static HookList HookDrawLegs
Definition: ItemLoader.cs:1188
EquipType
This is an enum of all the types of equipment that exist. An equipment type is defined as a type or l...
Definition: EquipType.cs:6
+ Here is the call graph for this function:

◆ ExtractinatorUse()

static void Terraria.ModLoader.ItemLoader.ExtractinatorUse ( ref int  resultType,
ref int  resultStack,
int  extractType 
)
static

Definition at line 1557 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

1557  {
1558  GetItem(extractType)?.ExtractinatorUse(ref resultType, ref resultStack);
1559 
1560  foreach (var g in HookExtractinatorUse.arr)
1561  g.ExtractinatorUse(extractType, ref resultType, ref resultStack);
1562  }
static ModItem GetItem(int type)
Gets the ModItem instance corresponding to the specified type. Returns null if no modded item has the...
Definition: ItemLoader.cs:76
virtual void ExtractinatorUse(ref int resultType, ref int resultStack)
Allows you to modify what item, and in what quantity, is obtained when this item is fed into the Extr...
Definition: ModItem.cs:919
static HookList HookExtractinatorUse
Definition: ItemLoader.cs:1556

◆ FindVanillaWings()

static void Terraria.ModLoader.ItemLoader.FindVanillaWings ( )
staticprivate

Definition at line 52 of file ItemLoader.cs.

References Terraria.ModLoader.ModNet.AllowVanillaClients, and Terraria.ModLoader.Item.

52  {
53  if (vanillaWings[1] != 0)
54  return;
55 
56  Item item = new Item();
57  for (int k = 0; k < ItemID.Count; k++) {
58  item.SetDefaults(k);
59  if (item.wingSlot > 0) {
60  vanillaWings[item.wingSlot] = k;
61  }
62  }
63  }

◆ GeneralPrefix()

static bool Terraria.ModLoader.ItemLoader.GeneralPrefix ( Item  item)
staticprivate

Definition at line 173 of file ItemLoader.cs.

References Terraria.ModLoader.Item.

173  {
174  return item.maxStack == 1 && item.damage > 0 && item.ammo == 0 && !item.accessory;
175  }

◆ GetAlpha()

static Color Terraria.ModLoader.ItemLoader.GetAlpha ( Item  item,
Color  lightColor 
)
static

Calls all GlobalItem.GetAlpha hooks then ModItem.GetAlpha, until one of them returns a color, and returns that color. Returns null if all of the hooks return null.

Definition at line 1422 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.Item.

1422  {
1423  if (item.IsAir)
1424  return null;
1425 
1426  foreach (var g in HookGetAlpha.arr) {
1427  Color? color = g.Instance(item).GetAlpha(item, lightColor);
1428  if (color.HasValue)
1429  return color;
1430  }
1431 
1432  return item.modItem?.GetAlpha(lightColor);
1433  }
static HookList HookGetAlpha
Definition: ItemLoader.cs:1414

◆ GetHealLife()

static void Terraria.ModLoader.ItemLoader.GetHealLife ( Item  item,
Player  player,
bool  quickHeal,
ref int  healValue 
)
static

Calls ModItem.GetHealLife, then all GlobalItem.GetHealLife hooks.

Definition at line 359 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.Item.

359  {
360  if (item.IsAir)
361  return;
362 
363  item.modItem?.GetHealLife(player, quickHeal, ref healValue);
364 
365  foreach (var g in HookGetHealLife.arr)
366  g.Instance(item).GetHealLife(item, player, quickHeal, ref healValue);
367  }
static HookList HookGetHealLife
Definition: ItemLoader.cs:355

◆ GetHealMana()

static void Terraria.ModLoader.ItemLoader.GetHealMana ( Item  item,
Player  player,
bool  quickHeal,
ref int  healValue 
)
static

Calls ModItem.GetHealMana, then all GlobalItem.GetHealMana hooks.

Definition at line 374 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.Item.

374  {
375  if (item.IsAir)
376  return;
377 
378  item.modItem?.GetHealMana(player, quickHeal, ref healValue);
379 
380  foreach (var g in HookGetHealMana.arr)
381  g.Instance(item).GetHealMana(item, player, quickHeal, ref healValue);
382  }
static HookList HookGetHealMana
Definition: ItemLoader.cs:370

◆ GetItem()

static ModItem Terraria.ModLoader.ItemLoader.GetItem ( int  type)
static

Gets the ModItem instance corresponding to the specified type. Returns null if no modded item has the given type.

Definition at line 76 of file ItemLoader.cs.

Referenced by Terraria.ModLoader.Mod.AddMusicBox(), and Terraria.ModLoader.ModContent.MusicExists().

76  {
77  return type >= ItemID.Count && type < ItemCount ? items[type - ItemID.Count] : null;
78  }
+ Here is the caller graph for this function:

◆ GetWeaponCrit()

static void Terraria.ModLoader.ItemLoader.GetWeaponCrit ( Item  item,
Player  player,
ref int  crit 
)
static

Calls ModItem.GetWeaponCrit, then all GlobalItem.GetWeaponCrit hooks.

Definition at line 483 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

483  {
484  if (item.IsAir)
485  return;
486 
487  item.modItem?.GetWeaponCrit(player, ref crit);
488 
489  foreach (var g in HookGetWeaponCrit.arr)
490  g.Instance(item).GetWeaponCrit(item, player, ref crit);
491  }
static HookList HookGetWeaponCrit
Definition: ItemLoader.cs:479

◆ GetWeaponDamage()

static void Terraria.ModLoader.ItemLoader.GetWeaponDamage ( Item  item,
Player  player,
ref int  damage 
)
static

Calls ModItem.GetWeaponDamage, then all GlobalItem.GetWeaponDamage hooks.

Definition at line 437 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.Item.

Referenced by Terraria.ModLoader.CombinedHooks.GetWeaponDamage().

437  {
438  if (item.IsAir)
439  return;
440 
441  item.modItem?.GetWeaponDamage(player, ref damage);
442 
443  foreach (var g in HookGetWeaponDamage.arr)
444  g.Instance(item).GetWeaponDamage(item, player, ref damage);
445  }
static HookList HookGetWeaponDamage
Definition: ItemLoader.cs:432
+ Here is the caller graph for this function:

◆ GetWeaponKnockback()

static void Terraria.ModLoader.ItemLoader.GetWeaponKnockback ( Item  item,
Player  player,
ref float  knockback 
)
static

Calls ModItem.GetWeaponKnockback, then all GlobalItem.GetWeaponKnockback hooks.

Definition at line 467 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.Item.

467  {
468  if (item.IsAir)
469  return;
470 
471  item.modItem?.GetWeaponKnockback(player, ref knockback);
472 
473  foreach (var g in HookGetWeaponKnockback.arr)
474  g.Instance(item).GetWeaponKnockback(item, player, ref knockback);
475  }
static HookList HookGetWeaponKnockback
Definition: ItemLoader.cs:463

◆ GetWing()

static Item Terraria.ModLoader.ItemLoader.GetWing ( Player  player)
static

s Returns the wing item that the player is functionally using. If player.wingsLogic has been modified, so no equipped wing can be found to match what the player is using, this creates a new Item object to return.

Definition at line 1238 of file ItemLoader.cs.

References Terraria.ModLoader.EquipLoader.GetEquipTexture(), Terraria.ModLoader.Item, Terraria.ModLoader.ModItem.item, and Terraria.ModLoader.EquipTexture.item.

1238  {
1239  Item item = null;
1240  for (int k = 3; k < 8 + player.extraAccessorySlots; k++) {
1241  if (player.armor[k].wingSlot == player.wingsLogic) {
1242  item = player.armor[k];
1243  }
1244  }
1245  if (item != null) {
1246  return item;
1247  }
1248  if (player.wingsLogic > 0 && player.wingsLogic < Main.maxWings) {
1249  item = new Item();
1250  item.SetDefaults(vanillaWings[player.wingsLogic]);
1251  return item;
1252  }
1253  if (player.wingsLogic >= Main.maxWings) {
1254  EquipTexture texture = EquipLoader.GetEquipTexture(EquipType.Wings, player.wingsLogic);
1255  if (texture?.item != null)
1256  return texture.item.item;
1257  }
1258  return null;
1259  }
EquipType
This is an enum of all the types of equipment that exist. An equipment type is defined as a type or l...
Definition: EquipType.cs:6
+ Here is the call graph for this function:

◆ GrabRange()

static void Terraria.ModLoader.ItemLoader.GrabRange ( Item  item,
Player  player,
ref int  grabRange 
)
static

Calls ModItem.GrabRange, then all GlobalItem.GrabRange hooks.

Definition at line 1357 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

1357  {
1358  item.modItem?.GrabRange(player, ref grabRange);
1359 
1360  foreach (var g in HookGrabRange.arr)
1361  g.Instance(item).GrabRange(item, player, ref grabRange);
1362  }
static HookList HookGrabRange
Definition: ItemLoader.cs:1351

◆ GrabStyle()

static bool Terraria.ModLoader.ItemLoader.GrabStyle ( Item  item,
Player  player 
)
static

Calls all GlobalItem.GrabStyle hooks then ModItem.GrabStyle, until one of them returns true. Returns whether any of the hooks returned true.

Definition at line 1370 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

1370  {
1371  foreach (var g in HookGrabStyle.arr)
1372  if (g.Instance(item).GrabStyle(item, player))
1373  return true;
1374 
1375  return item.modItem != null && item.modItem.GrabStyle(player);
1376  }
static HookList HookGrabStyle
Definition: ItemLoader.cs:1364

◆ HasMethod()

static bool Terraria.ModLoader.ItemLoader.HasMethod ( Type  t,
string  method,
params Type []  args 
)
staticprivate

Definition at line 1711 of file ItemLoader.cs.

References Terraria.ModLoader.GlobalItem.CloneNewInstances, Terraria.ModLoader.GlobalItem.InstancePerEntity, and Terraria.ModLoader.Item.

1711  {
1712  return t.GetMethod(method, args).DeclaringType != typeof(GlobalItem);
1713  }

◆ HoldItem()

static void Terraria.ModLoader.ItemLoader.HoldItem ( Item  item,
Player  player 
)
static

Calls ModItem.HoldItem and all GlobalItem.HoldItem hooks.

Definition at line 318 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

318  {
319  if (item.IsAir)
320  return;
321 
322  item.modItem?.HoldItem(player);
323 
324  foreach (var g in HookHoldItem.arr)
325  g.Instance(item).HoldItem(item, player);
326  }
static HookList HookHoldItem
Definition: ItemLoader.cs:313

◆ HoldItemFrame()

static bool Terraria.ModLoader.ItemLoader.HoldItemFrame ( Item  item,
Player  player 
)
static

Calls ModItem.HoldItemFrame, then all GlobalItem.HoldItemFrame hooks, until one of them returns true. Returns whether any of the hooks returned true.

Definition at line 784 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

784  {
785  if (item.IsAir)
786  return false;
787 
788  if (item.modItem != null && item.modItem.HoldItemFrame(player))
789  return true;
790 
791  foreach (var g in HookHoldItemFrame.arr)
792  if (g.Instance(item).HoldItemFrame(item, player))
793  return true;
794 
795  return false;
796  }
static HookList HookHoldItemFrame
Definition: ItemLoader.cs:778

◆ HoldoutOffset()

static void Terraria.ModLoader.ItemLoader.HoldoutOffset ( float  gravDir,
int  type,
ref Vector2  offset 
)
static

Definition at line 1501 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.ModItem.HoldoutOffset().

1501  {
1502  ModItem modItem = GetItem(type);
1503  if (modItem != null) {
1504  Vector2? modOffset = modItem.HoldoutOffset();
1505  if (modOffset.HasValue) {
1506  offset.X = modOffset.Value.X;
1507  offset.Y += gravDir * modOffset.Value.Y;
1508  }
1509  }
1510  foreach (var g in HookHoldoutOffset.arr) {
1511  Vector2? modOffset = g.HoldoutOffset(type);
1512  if (modOffset.HasValue) {
1513  offset.X = modOffset.Value.X;
1514  offset.Y = Main.itemTexture[type].Height / 2f + gravDir * modOffset.Value.Y;
1515  }
1516  }
1517  }
static ModItem GetItem(int type)
Gets the ModItem instance corresponding to the specified type. Returns null if no modded item has the...
Definition: ItemLoader.cs:76
static HookList HookHoldoutOffset
Definition: ItemLoader.cs:1500
+ Here is the call graph for this function:

◆ HoldoutOrigin()

static void Terraria.ModLoader.ItemLoader.HoldoutOrigin ( Player  player,
ref Vector2  origin 
)
static

Definition at line 1520 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.Item.

1520  {
1521  Item item = player.inventory[player.selectedItem];
1522  Vector2 modOrigin = Vector2.Zero;
1523  if (item.modItem != null) {
1524  Vector2? modOrigin2 = item.modItem.HoldoutOrigin();
1525  if (modOrigin2.HasValue) {
1526  modOrigin = modOrigin2.Value;
1527  }
1528  }
1529  foreach (var g in HookHoldoutOrigin.arr) {
1530  Vector2? modOrigin2 = g.Instance(item).HoldoutOrigin(item.type);
1531  if (modOrigin2.HasValue) {
1532  modOrigin = modOrigin2.Value;
1533  }
1534  }
1535  modOrigin.X *= player.direction;
1536  modOrigin.Y *= -player.gravDir;
1537  origin += modOrigin;
1538  }
static HookList HookHoldoutOrigin
Definition: ItemLoader.cs:1519

◆ HoldStyle()

static void Terraria.ModLoader.ItemLoader.HoldStyle ( Item  item,
Player  player 
)
static

If the player is not holding onto a rope and is not in the middle of using an item, calls ModItem.HoldStyle and all GlobalItem.HoldStyle hooks.

Definition at line 303 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

303  {
304  if (item.IsAir || player.pulley || player.itemAnimation > 0)
305  return;
306 
307  item.modItem?.HoldStyle(player);
308 
309  foreach (var g in HookHoldStyle.arr)
310  g.Instance(item).HoldStyle(item, player);
311  }
static HookList HookHoldStyle
Definition: ItemLoader.cs:298

◆ HorizontalWingSpeeds()

static void Terraria.ModLoader.ItemLoader.HorizontalWingSpeeds ( Player  player)
static

If the player is using wings, this uses the result of GetWing, and calls ModItem.HorizontalWingSpeeds then all GlobalItem.HorizontalWingSpeeds hooks.

Definition at line 1294 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, Terraria.ModLoader.EquipLoader.GetEquipTexture(), Terraria.ModLoader.EquipTexture.HorizontalWingSpeeds(), and Terraria.ModLoader.Item.

1294  {
1295  Item item = GetWing(player);
1296  if (item == null) {
1297  EquipTexture texture = EquipLoader.GetEquipTexture(EquipType.Wings, player.wingsLogic);
1298  texture?.HorizontalWingSpeeds(player, ref player.accRunSpeed, ref player.runAcceleration);
1299  return;
1300  }
1301 
1302  item.modItem?.HorizontalWingSpeeds(player, ref player.accRunSpeed, ref player.runAcceleration);
1303 
1304  foreach (var g in HookHorizontalWingSpeeds.arr)
1305  g.Instance(item).HorizontalWingSpeeds(item, player, ref player.accRunSpeed, ref player.runAcceleration);
1306  }
static Item GetWing(Player player)
s Returns the wing item that the player is functionally using. If player.wingsLogic has been modified...
Definition: ItemLoader.cs:1238
static HookList HookHorizontalWingSpeeds
Definition: ItemLoader.cs:1288
EquipType
This is an enum of all the types of equipment that exist. An equipment type is defined as a type or l...
Definition: EquipType.cs:6
+ Here is the call graph for this function:

◆ IsAnglerQuestAvailable()

static void Terraria.ModLoader.ItemLoader.IsAnglerQuestAvailable ( int  itemID,
ref bool  notAvailable 
)
static

Definition at line 1587 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.ModItem.IsAnglerQuestAvailable().

1587  {
1588  ModItem modItem = GetItem(itemID);
1589  if (modItem != null)
1590  notAvailable |= !modItem.IsAnglerQuestAvailable();
1591 
1592  foreach (var g in HookIsAnglerQuestAvailable.arr)
1593  notAvailable |= !g.IsAnglerQuestAvailable(itemID);
1594  }
static ModItem GetItem(int type)
Gets the ModItem instance corresponding to the specified type. Returns null if no modded item has the...
Definition: ItemLoader.cs:76
static HookList HookIsAnglerQuestAvailable
Definition: ItemLoader.cs:1586
+ Here is the call graph for this function:

◆ IsModBossBag()

static bool Terraria.ModLoader.ItemLoader.IsModBossBag ( Item  item)
static

Returns whether ModItem.bossBagNPC is greater than 0. Returns false if item is not a modded item.

Definition at line 1041 of file ItemLoader.cs.

1041  {
1042  return item.modItem != null && item.modItem.BossBagNPC > 0;
1043  }

◆ ItemSpace()

static bool Terraria.ModLoader.ItemLoader.ItemSpace ( Item  item,
Player  player 
)
static

Definition at line 1406 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

1406  {
1407  foreach (var g in HookItemSpace.arr)
1408  if (g.Instance(item).ItemSpace(item, player))
1409  return true;
1410 
1411  return item.modItem?.ItemSpace(player) ?? false;
1412  }
static HookList HookItemSpace
Definition: ItemLoader.cs:1403

◆ MeleeEffects()

static void Terraria.ModLoader.ItemLoader.MeleeEffects ( Item  item,
Player  player,
Rectangle  hitbox 
)
static

Calls ModItem.MeleeEffects and all GlobalItem.MeleeEffects hooks.

Definition at line 604 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

604  {
605  item.modItem?.MeleeEffects(player, hitbox);
606 
607  foreach (var g in HookMeleeEffects.arr)
608  g.Instance(item).MeleeEffects(item, player, hitbox);
609  }
static HookList HookMeleeEffects
Definition: ItemLoader.cs:598

◆ MeleeSpeedMultiplier()

static float Terraria.ModLoader.ItemLoader.MeleeSpeedMultiplier ( Item  item,
Player  player 
)
static

Definition at line 342 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.Item.

Referenced by Terraria.ModLoader.PlayerHooks.TotalMeleeSpeedMultiplier().

342  {
343  if (item.IsAir)
344  return 1f;
345 
346  float multiplier = item.modItem?.MeleeSpeedMultiplier(player) ?? 1f;
347 
348  foreach (var g in HookMeleeSpeedMultiplier.arr)
349  multiplier *= g.Instance(item).MeleeSpeedMultiplier(item, player);
350 
351  return multiplier;
352  }
static HookList HookMeleeSpeedMultiplier
Definition: ItemLoader.cs:341
+ Here is the caller graph for this function:

◆ ModifyHitNPC()

static void Terraria.ModLoader.ItemLoader.ModifyHitNPC ( Item  item,
Player  player,
NPC  target,
ref int  damage,
ref float  knockBack,
ref bool  crit 
)
static

Calls ModItem.ModifyHitNPC, then all GlobalItem.ModifyHitNPC hooks.

Definition at line 648 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

648  {
649  item.modItem?.ModifyHitNPC(player, target, ref damage, ref knockBack, ref crit);
650 
651  foreach (var g in HookModifyHitNPC.arr)
652  g.Instance(item).ModifyHitNPC(item, player, target, ref damage, ref knockBack, ref crit);
653  }
static HookList HookModifyHitNPC
Definition: ItemLoader.cs:642

◆ ModifyHitPvp()

static void Terraria.ModLoader.ItemLoader.ModifyHitPvp ( Item  item,
Player  player,
Player  target,
ref int  damage,
ref bool  crit 
)
static

Calls ModItem.ModifyHitPvp, then all GlobalItem.ModifyHitPvp hooks.

Definition at line 689 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

689  {
690  item.modItem?.ModifyHitPvp(player, target, ref damage, ref crit);
691 
692  foreach (var g in HookModifyHitPvp.arr)
693  g.Instance(item).ModifyHitPvp(item, player, target, ref damage, ref crit);
694  }
static HookList HookModifyHitPvp
Definition: ItemLoader.cs:683

◆ ModifyManaCost()

static void Terraria.ModLoader.ItemLoader.ModifyManaCost ( Item  item,
Player  player,
ref float  reduce,
ref float  mult 
)
static

Calls ModItem.ModifyManaCost, then all GlobalItem.ModifyManaCost hooks.

Definition at line 389 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

Referenced by Terraria.ModLoader.CombinedHooks.ModifyManaCost().

389  {
390  if (item.IsAir)
391  return;
392 
393  item.modItem?.ModifyManaCost(player, ref reduce, ref mult);
394 
395  foreach (var g in HookModifyManaCost.arr) {
396  g.Instance(item).ModifyManaCost(item, player, ref reduce, ref mult);
397  }
398  }
static HookList HookModifyManaCost
Definition: ItemLoader.cs:385
+ Here is the caller graph for this function:

◆ ModifyTooltips()

static List<TooltipLine> Terraria.ModLoader.ItemLoader.ModifyTooltips ( Item  item,
ref int  numTooltips,
string []  names,
ref string []  text,
ref bool []  modifier,
ref bool []  badModifier,
ref int  oneDropLogo,
out Color? []  overrideColor 
)
static

Definition at line 1656 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, Terraria.ModLoader.TooltipLine.isModifier, and Terraria.ModLoader.TooltipLine.isModifierBad.

1657  {
1658  List<TooltipLine> tooltips = new List<TooltipLine>();
1659  for (int k = 0; k < numTooltips; k++) {
1660  TooltipLine tooltip = new TooltipLine(names[k], text[k]);
1661  tooltip.isModifier = modifier[k];
1662  tooltip.isModifierBad = badModifier[k];
1663  if (k == oneDropLogo) {
1664  tooltip.oneDropLogo = true;
1665  }
1666  tooltips.Add(tooltip);
1667  }
1668  item.modItem?.ModifyTooltips(tooltips);
1669  foreach (var g in HookModifyTooltips.arr)
1670  g.Instance(item).ModifyTooltips(item, tooltips);
1671 
1672  numTooltips = tooltips.Count;
1673  text = new string[numTooltips];
1674  modifier = new bool[numTooltips];
1675  badModifier = new bool[numTooltips];
1676  oneDropLogo = -1;
1677  overrideColor = new Color?[numTooltips];
1678  for (int k = 0; k < numTooltips; k++) {
1679  text[k] = tooltips[k].text;
1680  modifier[k] = tooltips[k].isModifier;
1681  badModifier[k] = tooltips[k].isModifierBad;
1682  if (tooltips[k].oneDropLogo) {
1683  oneDropLogo = k;
1684  }
1685  overrideColor[k] = tooltips[k].overrideColor;
1686  }
1687 
1688  return tooltips;
1689  }
static HookList HookModifyTooltips
Definition: ItemLoader.cs:1655

◆ ModifyWeaponDamage()

static void Terraria.ModLoader.ItemLoader.ModifyWeaponDamage ( Item  item,
Player  player,
ref float  add,
ref float  mult 
)
static

Calls ModItem.HookModifyWeaponDamage, then all GlobalItem.HookModifyWeaponDamage hooks.

Definition at line 452 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.Item.

Referenced by Terraria.ModLoader.CombinedHooks.ModifyWeaponDamage().

452  {
453  if (item.IsAir)
454  return;
455 
456  item.modItem?.ModifyWeaponDamage(player, ref add, ref mult);
457 
458  foreach (var g in HookModifyWeaponDamage.arr)
459  g.Instance(item).ModifyWeaponDamage(item, player, ref add, ref mult);
460  }
static HookList HookModifyWeaponDamage
Definition: ItemLoader.cs:448
+ Here is the caller graph for this function:

◆ NeedsModSaving()

static bool Terraria.ModLoader.ItemLoader.NeedsModSaving ( Item  item)
static

Definition at line 1692 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.ModNet.GetMod().

1692  {
1693  return item.type != 0 && (item.modItem != null || item.prefix >= PrefixID.Count || HookNeedsSaving.arr.Count(g => g.Instance(item).NeedsSaving(item)) > 0);
1694  }
static HookList HookNeedsSaving
Definition: ItemLoader.cs:1691
+ Here is the call graph for this function:

◆ OnConsumeAmmo()

static void Terraria.ModLoader.ItemLoader.OnConsumeAmmo ( Item  item,
Item  ammo,
Player  player 
)
static

Calls ModItem.OnConsumeAmmo for the weapon, ModItem.OnConsumeAmmo for the ammo, then each GlobalItem.OnConsumeAmmo hook for the weapon and ammo.

Definition at line 544 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.Item.

544  {
545  if (item.IsAir)
546  return;
547 
548  item.modItem?.OnConsumeAmmo(player);
549  ammo.modItem?.OnConsumeAmmo(player);
550 
551  foreach (var g in HookOnConsumeAmmo.arr) {
552  g.Instance(item).OnConsumeAmmo(item, player);
553  g.Instance(ammo).OnConsumeAmmo(ammo, player);
554  }
555  }
static HookList HookOnConsumeAmmo
Definition: ItemLoader.cs:540

◆ OnConsumeItem()

static void Terraria.ModLoader.ItemLoader.OnConsumeItem ( Item  item,
Player  player 
)
static

Calls ModItem.OnConsumeItem and all GlobalItem.OnConsumeItem hooks.

Definition at line 751 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

751  {
752  if (item.IsAir)
753  return;
754 
755  item.modItem?.OnConsumeItem(player);
756 
757  foreach (var g in HookOnConsumeItem.arr)
758  g.Instance(item).OnConsumeItem(item, player);
759  }
static HookList HookOnConsumeItem
Definition: ItemLoader.cs:747

◆ OnConsumeMana()

static void Terraria.ModLoader.ItemLoader.OnConsumeMana ( Item  item,
Player  player,
int  manaConsumed 
)
static

Calls ModItem.OnConsumeMana, then all GlobalItem.OnConsumeMana hooks.

Definition at line 419 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.Item.

Referenced by Terraria.ModLoader.CombinedHooks.OnConsumeMana().

419  {
420  if (item.IsAir)
421  return;
422 
423  item.modItem?.OnConsumeMana(player, manaConsumed);
424 
425  foreach (var g in HookOnConsumeMana.arr) {
426  g.Instance(item).OnConsumeMana(item, player, manaConsumed);
427  }
428  }
static HookList HookOnConsumeMana
Definition: ItemLoader.cs:415
+ Here is the caller graph for this function:

◆ OnCraft()

static void Terraria.ModLoader.ItemLoader.OnCraft ( Item  item,
Recipe  recipe 
)
static

Definition at line 1613 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.Item.

1613  {
1614  item.modItem?.OnCraft(recipe);
1615  foreach (var g in HookOnCraft.arr)
1616  g.Instance(item).OnCraft(item, recipe);
1617  }

◆ OnHitNPC()

static void Terraria.ModLoader.ItemLoader.OnHitNPC ( Item  item,
Player  player,
NPC  target,
int  damage,
float  knockBack,
bool  crit 
)
static

Calls ModItem.OnHitNPC and all GlobalItem.OnHitNPC hooks.

Definition at line 661 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

661  {
662  item.modItem?.OnHitNPC(player, target, damage, knockBack, crit);
663 
664  foreach (var g in HookOnHitNPC.arr)
665  g.Instance(item).OnHitNPC(item, player, target, damage, knockBack, crit);
666  }
static HookList HookOnHitNPC
Definition: ItemLoader.cs:655

◆ OnHitPvp()

static void Terraria.ModLoader.ItemLoader.OnHitPvp ( Item  item,
Player  player,
Player  target,
int  damage,
bool  crit 
)
static

Calls ModItem.OnHitPvp and all GlobalItem.OnHitPvp hooks.

Definition at line 702 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

702  {
703  item.modItem?.OnHitPvp(player, target, damage, crit);
704 
705  foreach (var g in HookOnHitPvp.arr)
706  g.Instance(item).OnHitPvp(item, player, target, damage, crit);
707  }
static HookList HookOnHitPvp
Definition: ItemLoader.cs:696

◆ OnMissingMana()

static void Terraria.ModLoader.ItemLoader.OnMissingMana ( Item  item,
Player  player,
int  neededMana 
)
static

Calls ModItem.OnMissingMana, then all GlobalItem.OnMissingMana hooks.

Definition at line 404 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

Referenced by Terraria.ModLoader.CombinedHooks.OnMissingMana().

404  {
405  if (item.IsAir)
406  return;
407 
408  item.modItem?.OnMissingMana(player, neededMana);
409 
410  foreach (var g in HookOnMissingMana.arr) {
411  g.Instance(item).OnMissingMana(item, player, neededMana);
412  }
413  }
static HookList HookOnMissingMana
Definition: ItemLoader.cs:400
+ Here is the caller graph for this function:

◆ OnPickup()

static bool Terraria.ModLoader.ItemLoader.OnPickup ( Item  item,
Player  player 
)
static

Calls all GlobalItem.OnPickup hooks then ModItem.OnPickup, until one of the returns false. Returns true if all of the hooks return true.

Definition at line 1395 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

1395  {
1396  foreach (var g in HookOnPickup.arr)
1397  if (!g.Instance(item).OnPickup(item, player))
1398  return false;
1399 
1400  return item.modItem?.OnPickup(player) ?? true;
1401  }
static HookList HookOnPickup
Definition: ItemLoader.cs:1389

◆ OpenBossBag()

static void Terraria.ModLoader.ItemLoader.OpenBossBag ( int  type,
Player  player,
ref int  npc 
)
static

If the item is a modded item and ModItem.bossBagNPC is greater than 0, calls ModItem.OpenBossBag and sets npc to ModItem.bossBagNPC.

Definition at line 1050 of file ItemLoader.cs.

References Terraria.ModLoader.ModItem.BossBagNPC, and Terraria.ModLoader.ModItem.OpenBossBag().

1050  {
1051  ModItem modItem = GetItem(type);
1052  if (modItem != null && modItem.BossBagNPC > 0) {
1053  modItem.OpenBossBag(player);
1054  npc = modItem.BossBagNPC;
1055  }
1056  }
static ModItem GetItem(int type)
Gets the ModItem instance corresponding to the specified type. Returns null if no modded item has the...
Definition: ItemLoader.cs:76
+ Here is the call graph for this function:

◆ OpenVanillaBag()

static void Terraria.ModLoader.ItemLoader.OpenVanillaBag ( string  context,
Player  player,
int  arg 
)
static

Calls all GlobalItem.OpenVanillaBag hooks.

Definition at line 1082 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.Item.

1082  {
1083  foreach (var g in HookOpenVanillaBag.arr)
1084  g.OpenVanillaBag(context, player, arg);
1085  }
static HookList HookOpenVanillaBag
Definition: ItemLoader.cs:1076

◆ PickAmmo()

static void Terraria.ModLoader.ItemLoader.PickAmmo ( Item  weapon,
Item  ammo,
Player  player,
ref int  type,
ref float  speed,
ref int  damage,
ref float  knockback 
)
static

Calls ModItem.PickAmmo, then all GlobalItem.PickAmmo hooks.

Definition at line 508 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

508  {
509  ammo.modItem?.PickAmmo(weapon, player, ref type, ref speed, ref damage, ref knockback);
510  ammo.modItem?.PickAmmo(player, ref type, ref speed, ref damage, ref knockback); // deprecated
511 
512  foreach (var g in HookPickAmmo.arr) {
513  g.Instance(ammo).PickAmmo(weapon, ammo, player, ref type, ref speed, ref damage, ref knockback);
514  }
515  foreach (var g in HookOldPickAmmo.arr) {
516  g.Instance(ammo).PickAmmo(ammo, player, ref type, ref speed, ref damage, ref knockback); // deprecated
517  }
518  }
static HookList HookOldPickAmmo
Definition: ItemLoader.cs:501
static HookList HookPickAmmo
Definition: ItemLoader.cs:504

◆ PostDrawInInventory()

static void Terraria.ModLoader.ItemLoader.PostDrawInInventory ( Item  item,
SpriteBatch  spriteBatch,
Vector2  position,
Rectangle  frame,
Color  drawColor,
Color  itemColor,
Vector2  origin,
float  scale 
)
static

Calls ModItem.PostDrawInInventory, then all GlobalItem.PostDrawInInventory hooks.

Definition at line 1492 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

1493  {
1494  item.modItem?.PostDrawInInventory(spriteBatch, position, frame, drawColor, itemColor, origin, scale);
1495 
1496  foreach (var g in HookPostDrawInInventory.arr)
1497  g.Instance(item).PostDrawInInventory(item, spriteBatch, position, frame, drawColor, itemColor, origin, scale);
1498  }
static HookList HookPostDrawInInventory
Definition: ItemLoader.cs:1485

◆ PostDrawInWorld()

static void Terraria.ModLoader.ItemLoader.PostDrawInWorld ( Item  item,
SpriteBatch  spriteBatch,
Color  lightColor,
Color  alphaColor,
float  rotation,
float  scale,
int  whoAmI 
)
static

Calls ModItem.PostDrawInWorld, then all GlobalItem.PostDrawInWorld hooks.

Definition at line 1459 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

1459  {
1460  item.modItem?.PostDrawInWorld(spriteBatch, lightColor, alphaColor, rotation, scale, whoAmI);
1461 
1462  foreach (var g in HookPostDrawInWorld.arr)
1463  g.Instance(item).PostDrawInWorld(item, spriteBatch, lightColor, alphaColor, rotation, scale, whoAmI);
1464  }
static HookList HookPostDrawInWorld
Definition: ItemLoader.cs:1453

◆ PostDrawTooltip()

static void Terraria.ModLoader.ItemLoader.PostDrawTooltip ( Item  item,
ReadOnlyCollection< DrawableTooltipLine lines 
)
static

Definition at line 1631 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.Item.

1631  {
1632  item.modItem?.PostDrawTooltip(lines);
1633  foreach (var g in HookPostDrawTooltip.arr)
1634  g.Instance(item).PostDrawTooltip(item, lines);
1635  }
static HookList HookPostDrawTooltip
Definition: ItemLoader.cs:1630

◆ PostDrawTooltipLine()

static void Terraria.ModLoader.ItemLoader.PostDrawTooltipLine ( Item  item,
DrawableTooltipLine  line 
)
static

Definition at line 1649 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

1649  {
1650  item.modItem?.PostDrawTooltipLine(line);
1651  foreach (var g in HookPostDrawTooltipLine.arr)
1652  g.Instance(item).PostDrawTooltipLine(item, line);
1653  }
static HookList HookPostDrawTooltipLine
Definition: ItemLoader.cs:1648

◆ PostReforge()

static void Terraria.ModLoader.ItemLoader.PostReforge ( Item  item)
static

Calls ModItem.PostReforge, then all GlobalItem.PostReforge hooks.

Definition at line 1117 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

1117  {
1118  item.modItem?.PostReforge();
1119  foreach (var g in HookPostReforge.arr)
1120  g.Instance(item).PostReforge(item);
1121  }
static HookList HookPostReforge
Definition: ItemLoader.cs:1113

◆ PostUpdate()

static void Terraria.ModLoader.ItemLoader.PostUpdate ( Item  item)
static

Calls ModItem.PostUpdate and all GlobalItem.PostUpdate hooks.

Definition at line 1343 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.Item.

1343  {
1344  item.modItem?.PostUpdate();
1345 
1346  foreach (var g in HookPostUpdate.arr)
1347  g.Instance(item).PostUpdate(item);
1348  }
static HookList HookPostUpdate
Definition: ItemLoader.cs:1339

◆ PreDrawInInventory()

static bool Terraria.ModLoader.ItemLoader.PreDrawInInventory ( Item  item,
SpriteBatch  spriteBatch,
Vector2  position,
Rectangle  frame,
Color  drawColor,
Color  itemColor,
Vector2  origin,
float  scale 
)
static

Returns the "and" operator on the results of all GlobalItem.PreDrawInInventory hooks and ModItem.PreDrawInInventory.

Definition at line 1473 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

1474  {
1475  bool flag = true;
1476  foreach (var g in HookPreDrawInInventory.arr)
1477  flag &= g.Instance(item).PreDrawInInventory(item, spriteBatch, position, frame, drawColor, itemColor, origin, scale);
1478 
1479  if (item.modItem != null)
1480  flag &= item.modItem.PreDrawInInventory(spriteBatch, position, frame, drawColor, itemColor, origin, scale);
1481 
1482  return flag;
1483  }
static HookList HookPreDrawInInventory
Definition: ItemLoader.cs:1466

◆ PreDrawInWorld()

static bool Terraria.ModLoader.ItemLoader.PreDrawInWorld ( Item  item,
SpriteBatch  spriteBatch,
Color  lightColor,
Color  alphaColor,
ref float  rotation,
ref float  scale,
int  whoAmI 
)
static

Returns the "and" operator on the results of ModItem.PreDrawInWorld and all GlobalItem.PreDrawInWorld hooks.

Definition at line 1442 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

1442  {
1443  bool flag = true;
1444  if (item.modItem != null)
1445  flag &= item.modItem.PreDrawInWorld(spriteBatch, lightColor, alphaColor, ref rotation, ref scale, whoAmI);
1446 
1447  foreach (var g in HookPreDrawInWorld.arr)
1448  flag &= g.Instance(item).PreDrawInWorld(item, spriteBatch, lightColor, alphaColor, ref rotation, ref scale, whoAmI);
1449 
1450  return flag;
1451  }
static HookList HookPreDrawInWorld
Definition: ItemLoader.cs:1436

◆ PreDrawTooltip()

static bool Terraria.ModLoader.ItemLoader.PreDrawTooltip ( Item  item,
ReadOnlyCollection< TooltipLine lines,
ref int  x,
ref int  y 
)
static

Definition at line 1621 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.Item.

1621  {
1622  bool modItemPreDraw = item.modItem?.PreDrawTooltip(lines, ref x, ref y) ?? true;
1623  List<bool> globalItemPreDraw = new List<bool>();
1624  foreach (var g in HookPreDrawTooltip.arr)
1625  globalItemPreDraw.Add(g.PreDrawTooltip(item, lines, ref x, ref y));
1626  return modItemPreDraw && globalItemPreDraw.All(z => z);
1627  }
static HookList HookPreDrawTooltip
Definition: ItemLoader.cs:1620

◆ PreDrawTooltipLine()

static bool Terraria.ModLoader.ItemLoader.PreDrawTooltipLine ( Item  item,
DrawableTooltipLine  line,
ref int  yOffset 
)
static

Definition at line 1639 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.Item.

1639  {
1640  bool modItemPreDrawLine = item.modItem?.PreDrawTooltipLine(line, ref yOffset) ?? true;
1641  List<bool> globalItemPreDrawLine = new List<bool>();
1642  foreach (var g in HookPreDrawTooltipLine.arr)
1643  globalItemPreDrawLine.Add(g.PreDrawTooltipLine(item, line, ref yOffset));
1644  return modItemPreDrawLine && globalItemPreDrawLine.All(x => x);
1645  }
static HookList HookPreDrawTooltipLine
Definition: ItemLoader.cs:1638

◆ PreOpenVanillaBag()

static bool Terraria.ModLoader.ItemLoader.PreOpenVanillaBag ( string  context,
Player  player,
int  arg 
)
static

Calls each GlobalItem.PreOpenVanillaBag hook until one of them returns false. Returns true if all of them returned true.

Definition at line 1066 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.NPCLoader.blockLoot.

1066  {
1067  foreach (var g in HookPreOpenVanillaBag.arr)
1068  if (!g.PreOpenVanillaBag(context, player, arg)) {
1069  NPCLoader.blockLoot.Clear(); // clear blockloot
1070  return false;
1071  }
1072 
1073  return true;
1074  }
static HookList HookPreOpenVanillaBag
Definition: ItemLoader.cs:1058

◆ PreReforge()

static bool Terraria.ModLoader.ItemLoader.PreReforge ( Item  item)
static

Calls ModItem.PreReforge, then all GlobalItem.PreReforge hooks.

Definition at line 1106 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

1106  {
1107  bool b = item.modItem?.NewPreReforge() ?? true;
1108  foreach (var g in HookPreReforge.arr)
1109  b &= g.Instance(item).NewPreReforge(item);
1110  return b;
1111  }
static HookList HookPreReforge
Definition: ItemLoader.cs:1102

◆ PreUpdateVanitySet()

static void Terraria.ModLoader.ItemLoader.PreUpdateVanitySet ( Player  player)
static

If the player's head texture's IsVanitySet returns true, calls the equipment texture's PreUpdateVanitySet. This is then repeated for the player's body, then the legs. Then for each GlobalItem, if GlobalItem.IsVanitySet returns a non-empty string, calls GlobalItem.PreUpdateVanitySet, using player.head, player.body, and player.legs.

Definition at line 902 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, Terraria.ModLoader.EquipLoader.GetEquipTexture(), Terraria.ModLoader.EquipTexture.IsVanitySet(), Terraria.ModLoader.GlobalItem.IsVanitySet(), Terraria.ModLoader.EquipTexture.PreUpdateVanitySet(), and Terraria.ModLoader.GlobalItem.PreUpdateVanitySet().

902  {
903  EquipTexture headTexture = EquipLoader.GetEquipTexture(EquipType.Head, player.head);
904  EquipTexture bodyTexture = EquipLoader.GetEquipTexture(EquipType.Body, player.body);
905  EquipTexture legTexture = EquipLoader.GetEquipTexture(EquipType.Legs, player.legs);
906  if (headTexture != null && headTexture.IsVanitySet(player.head, player.body, player.legs))
907  headTexture.PreUpdateVanitySet(player);
908 
909  if (bodyTexture != null && bodyTexture.IsVanitySet(player.head, player.body, player.legs))
910  bodyTexture.PreUpdateVanitySet(player);
911 
912  if (legTexture != null && legTexture.IsVanitySet(player.head, player.body, player.legs))
913  legTexture.PreUpdateVanitySet(player);
914 
915  foreach (GlobalItem globalItem in HookPreUpdateVanitySet.arr) {
916  string set = globalItem.IsVanitySet(player.head, player.body, player.legs);
917  if (!string.IsNullOrEmpty(set))
918  globalItem.PreUpdateVanitySet(player, set);
919  }
920  }
EquipType
This is an enum of all the types of equipment that exist. An equipment type is defined as a type or l...
Definition: EquipType.cs:6
static HookList HookPreUpdateVanitySet
Definition: ItemLoader.cs:897
+ Here is the call graph for this function:

◆ ReforgePrice()

static bool Terraria.ModLoader.ItemLoader.ReforgePrice ( Item  item,
ref int  reforgePrice,
ref bool  canApplyDiscount 
)
static

Call all ModItem.ReforgePrice, then GlobalItem.ReforgePrice hooks.

Parameters
canApplyDiscount
Returns

Definition at line 1094 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

1094  {
1095  bool b = item.modItem?.ReforgePrice(ref reforgePrice, ref canApplyDiscount) ?? true;
1096  foreach (var g in HookReforgePrice.arr)
1097  b &= g.Instance(item).ReforgePrice(item, ref reforgePrice, ref canApplyDiscount);
1098  return b;
1099  }
static HookList HookReforgePrice
Definition: ItemLoader.cs:1088

◆ RightClick()

static void Terraria.ModLoader.ItemLoader.RightClick ( Item  item,
Player  player 
)
static

If Main.mouseRightRelease is true, the following steps are taken:

  1. Call ModItem.RightClick
  2. Calls all GlobalItem.RightClick hooks
  3. Call ItemLoader.ConsumeItem, and if it returns true, decrements the item's stack
  4. Sets the item's type to 0 if the item's stack is 0
  5. Plays the item-grabbing sound
  6. Sets Main.stackSplit to 30
  7. Sets Main.mouseRightRelease to false
  8. Calls Recipe.FindRecipes.

Definition at line 1019 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

1019  {
1020  if (!Main.mouseRightRelease)
1021  return;
1022 
1023  item.modItem?.RightClick(player);
1024 
1025  foreach (var g in HookRightClick.arr)
1026  g.Instance(item).RightClick(item, player);
1027 
1028  if (ConsumeItem(item, player) && --item.stack == 0)
1029  item.SetDefaults();
1030 
1031  Main.PlaySound(7);
1032  Main.stackSplit = 30;
1033  Main.mouseRightRelease = false;
1034  Recipe.FindRecipes();
1035  }
static HookList HookRightClick
Definition: ItemLoader.cs:1006
static bool ConsumeItem(Item item, Player player)
If ModItem.ConsumeItem or any of the GlobalItem.ConsumeItem hooks returns false, sets consume to fals...
Definition: ItemLoader.cs:734

◆ SetMatch()

static void Terraria.ModLoader.ItemLoader.SetMatch ( int  armorSlot,
int  type,
bool  male,
ref int  equipSlot,
ref bool  robes 
)
static

Calls EquipTexture.SetMatch, then all GlobalItem.SetMatch hooks.

Definition at line 978 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, Terraria.ModLoader.EquipLoader.GetEquipTexture(), and Terraria.ModLoader.EquipTexture.SetMatch().

978  {
979  EquipTexture texture = EquipLoader.GetEquipTexture((EquipType)armorSlot, type);
980  texture?.SetMatch(male, ref equipSlot, ref robes);
981 
982  foreach (var g in HookSetMatch.arr)
983  g.SetMatch(armorSlot, type, male, ref equipSlot, ref robes);
984  }
EquipType
This is an enum of all the types of equipment that exist. An equipment type is defined as a type or l...
Definition: EquipType.cs:6
static HookList HookSetMatch
Definition: ItemLoader.cs:974
+ Here is the call graph for this function:

◆ Shoot()

static bool Terraria.ModLoader.ItemLoader.Shoot ( Item  item,
Player  player,
ref Vector2  position,
ref float  speedX,
ref float  speedY,
ref int  type,
ref int  damage,
ref float  knockBack 
)
static

Calls each GlobalItem.Shoot hook, then ModItem.Shoot, until one of them returns false. If all of them return true, returns true.

Parameters
itemThe weapon item.
playerThe player.
positionThe shoot spawn position.
speedXThe speed x calculated from shootSpeed and mouse position.
speedYThe speed y calculated from shootSpeed and mouse position.
typeThe projectile type choosen by ammo and weapon.
damageThe projectile damage.
knockBackThe projectile knock back.
Returns

Definition at line 573 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, and Terraria.ModLoader.Item.

573  {
574  foreach (var g in HookShoot.arr)
575  if (!g.Instance(item).Shoot(item, player, ref position, ref speedX, ref speedY, ref type, ref damage, ref knockBack))
576  return false;
577 
578  if (item.modItem != null && !item.modItem.Shoot(player, ref position, ref speedX, ref speedY, ref type, ref damage, ref knockBack))
579  return false;
580 
581  return true;
582  }

◆ Update()

static void Terraria.ModLoader.ItemLoader.Update ( Item  item,
ref float  gravity,
ref float  maxFallSpeed 
)
static

Calls ModItem.Update, then all GlobalItem.Update hooks.

Definition at line 1332 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

1332  {
1333  item.modItem?.Update(ref gravity, ref maxFallSpeed);
1334 
1335  foreach (var g in HookUpdate.arr)
1336  g.Instance(item).Update(item, ref gravity, ref maxFallSpeed);
1337  }

◆ UpdateAccessory()

static void Terraria.ModLoader.ItemLoader.UpdateAccessory ( Item  item,
Player  player,
bool  hideVisual 
)
static

Calls ModItem.UpdateAccessory and all GlobalItem.UpdateAccessory hooks.

Definition at line 854 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

854  {
855  if (item.IsAir)
856  return;
857 
858  item.modItem?.UpdateAccessory(player, hideVisual);
859 
860  foreach (var g in HookUpdateAccessory.arr)
861  g.Instance(item).UpdateAccessory(item, player, hideVisual);
862  }
static HookList HookUpdateAccessory
Definition: ItemLoader.cs:848

◆ UpdateArmorSet()

static void Terraria.ModLoader.ItemLoader.UpdateArmorSet ( Player  player,
Item  head,
Item  body,
Item  legs 
)
static

If the head's ModItem.IsArmorSet returns true, calls the head's ModItem.UpdateArmorSet. This is then repeated for the body, then the legs. Then for each GlobalItem, if GlobalItem.IsArmorSet returns a non-empty string, calls GlobalItem.UpdateArmorSet with that string.

Definition at line 880 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, Terraria.ModLoader.GlobalItem.IsArmorSet(), and Terraria.ModLoader.GlobalItem.UpdateArmorSet().

880  {
881  if (head.modItem != null && head.modItem.IsArmorSet(head, body, legs))
882  head.modItem.UpdateArmorSet(player);
883 
884  if (body.modItem != null && body.modItem.IsArmorSet(head, body, legs))
885  body.modItem.UpdateArmorSet(player);
886 
887  if (legs.modItem != null && legs.modItem.IsArmorSet(head, body, legs))
888  legs.modItem.UpdateArmorSet(player);
889 
890  foreach (GlobalItem globalItem in HookUpdateArmorSet.arr) {
891  string set = globalItem.IsArmorSet(head, body, legs);
892  if (!string.IsNullOrEmpty(set))
893  globalItem.UpdateArmorSet(player, set);
894  }
895  }
static HookList HookUpdateArmorSet
Definition: ItemLoader.cs:875
+ Here is the call graph for this function:

◆ UpdateEquip()

static void Terraria.ModLoader.ItemLoader.UpdateEquip ( Item  item,
Player  player 
)
static

Calls ModItem.UpdateEquip and all GlobalItem.UpdateEquip hooks.

Definition at line 838 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

838  {
839  if (item.IsAir)
840  return;
841 
842  item.modItem?.UpdateEquip(player);
843 
844  foreach (var g in HookUpdateEquip.arr)
845  g.Instance(item).UpdateEquip(item, player);
846  }
static HookList HookUpdateEquip
Definition: ItemLoader.cs:832

◆ UpdateInventory()

static void Terraria.ModLoader.ItemLoader.UpdateInventory ( Item  item,
Player  player 
)
static

Calls ModItem.UpdateInventory and all GlobalItem.UpdateInventory hooks.

Definition at line 822 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

822  {
823  if (item.IsAir)
824  return;
825 
826  item.modItem?.UpdateInventory(player);
827 
828  foreach (var g in HookUpdateInventory.arr)
829  g.Instance(item).UpdateInventory(item, player);
830  }
static HookList HookUpdateInventory
Definition: ItemLoader.cs:816

◆ UpdateVanity()

static void Terraria.ModLoader.ItemLoader.UpdateVanity ( Player  player)
static

Calls each of the item's equipment texture's UpdateVanity hook.

Definition at line 867 of file ItemLoader.cs.

References Terraria.ModLoader.EquipLoader.EquipTypes, Terraria.ModLoader.EquipLoader.GetEquipTexture(), and Terraria.ModLoader.EquipTexture.UpdateVanity().

867  {
868  foreach (EquipType type in EquipLoader.EquipTypes) {
869  int slot = EquipLoader.GetPlayerEquip(player, type);
870  EquipTexture texture = EquipLoader.GetEquipTexture(type, slot);
871  texture?.UpdateVanity(player, type);
872  }
873  }
EquipType
This is an enum of all the types of equipment that exist. An equipment type is defined as a type or l...
Definition: EquipType.cs:6
+ Here is the call graph for this function:

◆ UpdateVanitySet()

static void Terraria.ModLoader.ItemLoader.UpdateVanitySet ( Player  player)
static

If the player's head texture's IsVanitySet returns true, calls the equipment texture's UpdateVanitySet. This is then repeated for the player's body, then the legs. Then for each GlobalItem, if GlobalItem.IsVanitySet returns a non-empty string, calls GlobalItem.UpdateVanitySet, using player.head, player.body, and player.legs.

Definition at line 927 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, Terraria.ModLoader.EquipLoader.GetEquipTexture(), Terraria.ModLoader.EquipTexture.IsVanitySet(), Terraria.ModLoader.GlobalItem.IsVanitySet(), Terraria.ModLoader.EquipTexture.UpdateVanitySet(), and Terraria.ModLoader.GlobalItem.UpdateVanitySet().

927  {
928  EquipTexture headTexture = EquipLoader.GetEquipTexture(EquipType.Head, player.head);
929  EquipTexture bodyTexture = EquipLoader.GetEquipTexture(EquipType.Body, player.body);
930  EquipTexture legTexture = EquipLoader.GetEquipTexture(EquipType.Legs, player.legs);
931  if (headTexture != null && headTexture.IsVanitySet(player.head, player.body, player.legs))
932  headTexture.UpdateVanitySet(player);
933 
934  if (bodyTexture != null && bodyTexture.IsVanitySet(player.head, player.body, player.legs))
935  bodyTexture.UpdateVanitySet(player);
936 
937  if (legTexture != null && legTexture.IsVanitySet(player.head, player.body, player.legs))
938  legTexture.UpdateVanitySet(player);
939 
940  foreach (GlobalItem globalItem in HookUpdateVanitySet.arr) {
941  string set = globalItem.IsVanitySet(player.head, player.body, player.legs);
942  if (!string.IsNullOrEmpty(set))
943  globalItem.UpdateVanitySet(player, set);
944  }
945  }
EquipType
This is an enum of all the types of equipment that exist. An equipment type is defined as a type or l...
Definition: EquipType.cs:6
static HookList HookUpdateVanitySet
Definition: ItemLoader.cs:922
+ Here is the call graph for this function:

◆ UseItem()

static bool Terraria.ModLoader.ItemLoader.UseItem ( Item  item,
Player  player 
)
static

Returns true if any of ModItem.UseItem or GlobalItem.UseItem return true Does not fail fast (calls every hook)

Definition at line 714 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

714  {
715  if (item.IsAir)
716  return false;
717 
718  bool flag = false;
719  if (item.modItem != null)
720  flag |= item.modItem.UseItem(player);
721 
722  foreach (var g in HookUseItem.arr)
723  flag |= g.Instance(item).UseItem(item, player);
724 
725  return flag;
726  }
static HookList HookUseItem
Definition: ItemLoader.cs:709

◆ UseItemFrame()

static bool Terraria.ModLoader.ItemLoader.UseItemFrame ( Item  item,
Player  player 
)
static

Calls ModItem.UseItemFrame, then all GlobalItem.UseItemFrame hooks, until one of them returns true. Returns whether any of the hooks returned true.

Definition at line 767 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

767  {
768  if (item.modItem != null && item.modItem.UseItemFrame(player))
769  return true;
770 
771  foreach (var g in HookUseItemFrame.arr)
772  if (g.Instance(item).UseItemFrame(item, player))
773  return true;
774 
775  return false;
776  }
static HookList HookUseItemFrame
Definition: ItemLoader.cs:761

◆ UseItemHitbox()

static void Terraria.ModLoader.ItemLoader.UseItemHitbox ( Item  item,
Player  player,
ref Rectangle  hitbox,
ref bool  noHitbox 
)
static

Calls ModItem.UseItemHitbox, then all GlobalItem.UseItemHitbox hooks.

Definition at line 591 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

591  {
592  item.modItem?.UseItemHitbox(player, ref hitbox, ref noHitbox);
593 
594  foreach (var g in HookUseItemHitbox.arr)
595  g.Instance(item).UseItemHitbox(item, player, ref hitbox, ref noHitbox);
596  }
static HookList HookUseItemHitbox
Definition: ItemLoader.cs:585

◆ UseStyle()

static void Terraria.ModLoader.ItemLoader.UseStyle ( Item  item,
Player  player 
)
static

Calls ModItem.UseStyle and all GlobalItem.UseStyle hooks.

Definition at line 288 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

288  {
289  if (item.IsAir)
290  return;
291 
292  item.modItem?.UseStyle(player);
293 
294  foreach (var g in HookUseStyle.arr)
295  g.Instance(item).UseStyle(item, player);
296  }
static HookList HookUseStyle
Definition: ItemLoader.cs:283

◆ UseTimeMultiplier()

static float Terraria.ModLoader.ItemLoader.UseTimeMultiplier ( Item  item,
Player  player 
)
static

Definition at line 329 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr.

Referenced by Terraria.ModLoader.PlayerHooks.TotalUseTimeMultiplier().

329  {
330  if (item.IsAir)
331  return 1f;
332 
333  float multiplier = item.modItem?.UseTimeMultiplier(player) ?? 1f;
334 
335  foreach (var g in HookUseTimeMultiplier.arr)
336  multiplier *= g.Instance(item).UseTimeMultiplier(item, player);
337 
338  return multiplier;
339  }
static HookList HookUseTimeMultiplier
Definition: ItemLoader.cs:328
+ Here is the caller graph for this function:

◆ VerticalWingSpeeds()

static void Terraria.ModLoader.ItemLoader.VerticalWingSpeeds ( Player  player,
ref float  ascentWhenFalling,
ref float  ascentWhenRising,
ref float  maxCanAscendMultiplier,
ref float  maxAscentMultiplier,
ref float  constantAscend 
)
static

If the player is using wings, this uses the result of GetWing, and calls ModItem.VerticalWingSpeeds then all GlobalItem.VerticalWingSpeeds hooks.

Definition at line 1268 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, Terraria.ModLoader.EquipLoader.GetEquipTexture(), Terraria.ModLoader.Item, and Terraria.ModLoader.EquipTexture.VerticalWingSpeeds().

1269  {
1270  Item item = GetWing(player);
1271  if (item == null) {
1272  EquipTexture texture = EquipLoader.GetEquipTexture(EquipType.Wings, player.wingsLogic);
1273  texture?.VerticalWingSpeeds(
1274  player, ref ascentWhenFalling, ref ascentWhenRising, ref maxCanAscendMultiplier,
1275  ref maxAscentMultiplier, ref constantAscend);
1276  return;
1277  }
1278 
1279  item.modItem?.VerticalWingSpeeds(player, ref ascentWhenFalling, ref ascentWhenRising, ref maxCanAscendMultiplier,
1280  ref maxAscentMultiplier, ref constantAscend);
1281 
1282  foreach (var g in HookVerticalWingSpeeds.arr)
1283  g.Instance(item).VerticalWingSpeeds(item, player, ref ascentWhenFalling, ref ascentWhenRising,
1284  ref maxCanAscendMultiplier, ref maxAscentMultiplier, ref constantAscend);
1285  }
static Item GetWing(Player player)
s Returns the wing item that the player is functionally using. If player.wingsLogic has been modified...
Definition: ItemLoader.cs:1238
static HookList HookVerticalWingSpeeds
Definition: ItemLoader.cs:1262
EquipType
This is an enum of all the types of equipment that exist. An equipment type is defined as a type or l...
Definition: EquipType.cs:6
+ Here is the call graph for this function:

◆ WingUpdate()

static bool Terraria.ModLoader.ItemLoader.WingUpdate ( Player  player,
bool  inUse 
)
static

If wings can be seen on the player, calls the player's wing's equipment texture's WingUpdate and all GlobalItem.WingUpdate hooks.

Definition at line 1312 of file ItemLoader.cs.

References Terraria.ModLoader.ItemLoader.HookList.arr, Terraria.ModLoader.EquipLoader.GetEquipTexture(), Terraria.ModLoader.Item, and Terraria.ModLoader.EquipTexture.WingUpdate().

1312  {
1313  if (player.wings <= 0)
1314  return false;
1315 
1316  EquipTexture texture = EquipLoader.GetEquipTexture(EquipType.Wings, player.wings);
1317  bool? retVal = texture?.WingUpdate(player, inUse);
1318 
1319  foreach (var g in HookWingUpdate.arr)
1320  retVal |= g.WingUpdate(player.wings, player, inUse);
1321 
1322  return retVal ?? false;
1323  }
static HookList HookWingUpdate
Definition: ItemLoader.cs:1308
EquipType
This is an enum of all the types of equipment that exist. An equipment type is defined as a type or l...
Definition: EquipType.cs:6
+ Here is the call graph for this function:

Member Data Documentation

◆ HookAltFunctionUse

HookList Terraria.ModLoader.ItemLoader.HookAltFunctionUse = AddHook<Func<Item, Player, bool>>(g => g.AltFunctionUse)
staticprivate

Definition at line 798 of file ItemLoader.cs.

◆ HookAnglerChat

HookList Terraria.ModLoader.ItemLoader.HookAnglerChat = AddHook<DelegateAnglerChat>(g => g.AnglerChat)
staticprivate

Definition at line 1597 of file ItemLoader.cs.

◆ HookArmorArmGlowMask

HookList Terraria.ModLoader.ItemLoader.HookArmorArmGlowMask = AddHook<DelegateArmorArmGlowMask>(g => g.ArmorArmGlowMask)
staticprivate

Definition at line 1223 of file ItemLoader.cs.

◆ HookArmorSetShadows

HookList Terraria.ModLoader.ItemLoader.HookArmorSetShadows = AddHook<Action<Player, string>>(g => g.ArmorSetShadows)
staticprivate

Definition at line 947 of file ItemLoader.cs.

◆ HookCanEquipAccessory

HookList Terraria.ModLoader.ItemLoader.HookCanEquipAccessory = AddHook<Func<Item, Player, int, bool>>(g => g.CanEquipAccessory)
staticprivate

Definition at line 1540 of file ItemLoader.cs.

◆ HookCanHitNPC

HookList Terraria.ModLoader.ItemLoader.HookCanHitNPC = AddHook<Func<Item, Player, NPC, bool?>>(g => g.CanHitNPC)
staticprivate

Definition at line 611 of file ItemLoader.cs.

◆ HookCanHitPvp

HookList Terraria.ModLoader.ItemLoader.HookCanHitPvp = AddHook<Func<Item, Player, Player, bool>>(g => g.CanHitPvp)
staticprivate

Definition at line 668 of file ItemLoader.cs.

◆ HookCanPickup

HookList Terraria.ModLoader.ItemLoader.HookCanPickup = AddHook<Func<Item, Player, bool>>(g => g.CanPickup)
staticprivate

Definition at line 1378 of file ItemLoader.cs.

◆ HookCanRightClick

HookList Terraria.ModLoader.ItemLoader.HookCanRightClick = AddHook<Func<Item, bool>>(g => g.CanRightClick)
staticprivate

Definition at line 986 of file ItemLoader.cs.

◆ HookCanUseItem

HookList Terraria.ModLoader.ItemLoader.HookCanUseItem = AddHook<Func<Item, Player, bool>>(g => g.CanUseItem)
staticprivate

Definition at line 262 of file ItemLoader.cs.

◆ HookCaughtFishStack

HookList Terraria.ModLoader.ItemLoader.HookCaughtFishStack = AddHook<DelegateCaughtFishStack>(g => g.CaughtFishStack)
staticprivate

Definition at line 1578 of file ItemLoader.cs.

◆ HookChoosePrefix

HookList Terraria.ModLoader.ItemLoader.HookChoosePrefix = AddHook<Func<Item, UnifiedRandom, int>>(g => g.ChoosePrefix)
staticprivate

Definition at line 247 of file ItemLoader.cs.

◆ HookConsumeAmmo

HookList Terraria.ModLoader.ItemLoader.HookConsumeAmmo = AddHook<Func<Item, Player, bool>>(g => g.ConsumeAmmo)
staticprivate

Definition at line 520 of file ItemLoader.cs.

◆ HookConsumeItem

HookList Terraria.ModLoader.ItemLoader.HookConsumeItem = AddHook<Func<Item, Player, bool>>(g => g.ConsumeItem)
staticprivate

Definition at line 728 of file ItemLoader.cs.

◆ HookDrawArmorColor

HookList Terraria.ModLoader.ItemLoader.HookDrawArmorColor = AddHook<DelegateDrawArmorColor>(g => g.DrawArmorColor)
staticprivate

Definition at line 1209 of file ItemLoader.cs.

◆ HookDrawBody

HookList Terraria.ModLoader.ItemLoader.HookDrawBody = AddHook<Func<int, bool>>(g => g.DrawBody)
staticprivate

Definition at line 1172 of file ItemLoader.cs.

◆ HookDrawHair

HookList Terraria.ModLoader.ItemLoader.HookDrawHair = AddHook<DelegateDrawHair>(g => g.DrawHair)
staticprivate

Definition at line 1137 of file ItemLoader.cs.

◆ HookDrawHands

HookList Terraria.ModLoader.ItemLoader.HookDrawHands = AddHook<DelegateDrawHands>(g => g.DrawHands)
staticprivate

Definition at line 1124 of file ItemLoader.cs.

◆ HookDrawHead

HookList Terraria.ModLoader.ItemLoader.HookDrawHead = AddHook<Func<int, bool>>(g => g.DrawHead)
staticprivate

Definition at line 1153 of file ItemLoader.cs.

◆ HookDrawLegs

HookList Terraria.ModLoader.ItemLoader.HookDrawLegs = AddHook<Func<int, int, bool>>(g => g.DrawLegs)
staticprivate

Definition at line 1188 of file ItemLoader.cs.

◆ HookExtractinatorUse

HookList Terraria.ModLoader.ItemLoader.HookExtractinatorUse = AddHook<DelegateExtractinatorUse>(g => g.ExtractinatorUse)
staticprivate

Definition at line 1556 of file ItemLoader.cs.

◆ HookGetAlpha

HookList Terraria.ModLoader.ItemLoader.HookGetAlpha = AddHook<Func<Item, Color, Color?>>(g => g.GetAlpha)
staticprivate

Definition at line 1414 of file ItemLoader.cs.

◆ HookGetHealLife

HookList Terraria.ModLoader.ItemLoader.HookGetHealLife = AddHook<DelegateGetHealLife>(g => g.GetHealLife)
staticprivate

Definition at line 355 of file ItemLoader.cs.

◆ HookGetHealMana

HookList Terraria.ModLoader.ItemLoader.HookGetHealMana = AddHook<DelegateGetHealMana>(g => g.GetHealMana)
staticprivate

Definition at line 370 of file ItemLoader.cs.

◆ HookGetWeaponCrit

HookList Terraria.ModLoader.ItemLoader.HookGetWeaponCrit = AddHook<DelegateGetWeaponCrit>(g => g.GetWeaponCrit)
staticprivate

Definition at line 479 of file ItemLoader.cs.

◆ HookGetWeaponDamage

HookList Terraria.ModLoader.ItemLoader.HookGetWeaponDamage = AddHook<DelegateGetWeaponDamage>(g => g.GetWeaponDamage)
staticprivate

Definition at line 432 of file ItemLoader.cs.

◆ HookGetWeaponKnockback

HookList Terraria.ModLoader.ItemLoader.HookGetWeaponKnockback = AddHook<DelegateGetWeaponKnockback>(g => g.GetWeaponKnockback)
staticprivate

Definition at line 463 of file ItemLoader.cs.

◆ HookGrabRange

HookList Terraria.ModLoader.ItemLoader.HookGrabRange = AddHook<DelegateGrabRange>(g => g.GrabRange)
staticprivate

Definition at line 1351 of file ItemLoader.cs.

◆ HookGrabStyle

HookList Terraria.ModLoader.ItemLoader.HookGrabStyle = AddHook<Func<Item, Player, bool>>(g => g.GrabStyle)
staticprivate

Definition at line 1364 of file ItemLoader.cs.

◆ HookHoldItem

HookList Terraria.ModLoader.ItemLoader.HookHoldItem = AddHook<Action<Item, Player>>(g => g.HoldItem)
staticprivate

Definition at line 313 of file ItemLoader.cs.

◆ HookHoldItemFrame

HookList Terraria.ModLoader.ItemLoader.HookHoldItemFrame = AddHook<Func<Item, Player, bool>>(g => g.HoldItemFrame)
staticprivate

Definition at line 778 of file ItemLoader.cs.

◆ HookHoldoutOffset

HookList Terraria.ModLoader.ItemLoader.HookHoldoutOffset = AddHook<Func<int, Vector2?>>(g => g.HoldoutOffset)
staticprivate

Definition at line 1500 of file ItemLoader.cs.

◆ HookHoldoutOrigin

HookList Terraria.ModLoader.ItemLoader.HookHoldoutOrigin = AddHook<Func<int, Vector2?>>(g => g.HoldoutOrigin)
staticprivate

Definition at line 1519 of file ItemLoader.cs.

◆ HookHoldStyle

HookList Terraria.ModLoader.ItemLoader.HookHoldStyle = AddHook<Action<Item, Player>>(g => g.HoldStyle)
staticprivate

Definition at line 298 of file ItemLoader.cs.

◆ HookHorizontalWingSpeeds

HookList Terraria.ModLoader.ItemLoader.HookHorizontalWingSpeeds = AddHook<DelegateHorizontalWingSpeeds>(g => g.HorizontalWingSpeeds)
staticprivate

Definition at line 1288 of file ItemLoader.cs.

◆ HookIsAnglerQuestAvailable

HookList Terraria.ModLoader.ItemLoader.HookIsAnglerQuestAvailable = AddHook<Func<int, bool>>(g => g.IsAnglerQuestAvailable)
staticprivate

Definition at line 1586 of file ItemLoader.cs.

◆ HookItemSpace

HookList Terraria.ModLoader.ItemLoader.HookItemSpace = AddHook<Func<Item, Player, bool>>(g => g.ItemSpace)
staticprivate

Definition at line 1403 of file ItemLoader.cs.

◆ HookMeleeEffects

HookList Terraria.ModLoader.ItemLoader.HookMeleeEffects = AddHook<Action<Item, Player, Rectangle>>(g => g.MeleeEffects)
staticprivate

Definition at line 598 of file ItemLoader.cs.

◆ HookMeleeSpeedMultiplier

HookList Terraria.ModLoader.ItemLoader.HookMeleeSpeedMultiplier = AddHook<Func<Item, Player, float>>(g => g.MeleeSpeedMultiplier)
staticprivate

Definition at line 341 of file ItemLoader.cs.

◆ HookModifyHitNPC

HookList Terraria.ModLoader.ItemLoader.HookModifyHitNPC = AddHook<DelegateModifyHitNPC>(g => g.ModifyHitNPC)
staticprivate

Definition at line 642 of file ItemLoader.cs.

◆ HookModifyHitPvp

HookList Terraria.ModLoader.ItemLoader.HookModifyHitPvp = AddHook<DelegateModifyHitPvp>(g => g.ModifyHitPvp)
staticprivate

Definition at line 683 of file ItemLoader.cs.

◆ HookModifyManaCost

HookList Terraria.ModLoader.ItemLoader.HookModifyManaCost = AddHook<DelegateModifyManaCost>(g => g.ModifyManaCost)
staticprivate

Definition at line 385 of file ItemLoader.cs.

◆ HookModifyTooltips

HookList Terraria.ModLoader.ItemLoader.HookModifyTooltips = AddHook<Action<Item, List<TooltipLine>>>(g => g.ModifyTooltips)
staticprivate

Definition at line 1655 of file ItemLoader.cs.

◆ HookModifyWeaponDamage

HookList Terraria.ModLoader.ItemLoader.HookModifyWeaponDamage = AddHook<DelegateModifyWeaponDamage>(g => g.ModifyWeaponDamage)
staticprivate

Definition at line 448 of file ItemLoader.cs.

◆ HookNeedsSaving

HookList Terraria.ModLoader.ItemLoader.HookNeedsSaving = AddHook<Func<Item, bool>>(g => g.NeedsSaving)
staticprivate

Definition at line 1691 of file ItemLoader.cs.

◆ HookOldPickAmmo

HookList Terraria.ModLoader.ItemLoader.HookOldPickAmmo = AddHook<DelegateOldPickAmmo>(g => g.PickAmmo)
staticprivate

Definition at line 501 of file ItemLoader.cs.

◆ HookOnConsumeAmmo

HookList Terraria.ModLoader.ItemLoader.HookOnConsumeAmmo = AddHook<Action<Item, Player>>(g => g.OnConsumeAmmo)
staticprivate

Definition at line 540 of file ItemLoader.cs.

◆ HookOnConsumeItem

HookList Terraria.ModLoader.ItemLoader.HookOnConsumeItem = AddHook<Action<Item, Player>>(g => g.OnConsumeItem)
staticprivate

Definition at line 747 of file ItemLoader.cs.

◆ HookOnConsumeMana

HookList Terraria.ModLoader.ItemLoader.HookOnConsumeMana = AddHook<Action<Item, Player, int>>(g => g.OnConsumeMana)
staticprivate

Definition at line 415 of file ItemLoader.cs.

◆ HookOnCraft

HookList Terraria.ModLoader.ItemLoader.HookOnCraft = AddHook<Action<Item, Recipe>>(g => g.OnCraft)
staticprivate

Definition at line 1612 of file ItemLoader.cs.

◆ HookOnHitNPC

HookList Terraria.ModLoader.ItemLoader.HookOnHitNPC = AddHook<Action<Item, Player, NPC, int, float, bool>>(g => g.OnHitNPC)
staticprivate

Definition at line 655 of file ItemLoader.cs.

◆ HookOnHitPvp

HookList Terraria.ModLoader.ItemLoader.HookOnHitPvp = AddHook<Action<Item, Player, Player, int, bool>>(g => g.OnHitPvp)
staticprivate

Definition at line 696 of file ItemLoader.cs.

◆ HookOnMissingMana

HookList Terraria.ModLoader.ItemLoader.HookOnMissingMana = AddHook<Action<Item, Player, int>>(g => g.OnMissingMana)
staticprivate

Definition at line 400 of file ItemLoader.cs.

◆ HookOnPickup

HookList Terraria.ModLoader.ItemLoader.HookOnPickup = AddHook<Func<Item, Player, bool>>(g => g.OnPickup)
staticprivate

Definition at line 1389 of file ItemLoader.cs.

◆ HookOpenVanillaBag

HookList Terraria.ModLoader.ItemLoader.HookOpenVanillaBag = AddHook<Action<string, Player, int>>(g => g.OpenVanillaBag)
staticprivate

Definition at line 1076 of file ItemLoader.cs.

◆ HookPickAmmo

HookList Terraria.ModLoader.ItemLoader.HookPickAmmo = AddHook<DelegatePickAmmo>(g => g.PickAmmo)
staticprivate

Definition at line 504 of file ItemLoader.cs.

◆ HookPostDrawInInventory

HookList Terraria.ModLoader.ItemLoader.HookPostDrawInInventory = AddHook<Action<Item, SpriteBatch, Vector2, Rectangle, Color, Color, Vector2, float>>(g => g.PostDrawInInventory)
staticprivate

Definition at line 1485 of file ItemLoader.cs.

◆ HookPostDrawInWorld

HookList Terraria.ModLoader.ItemLoader.HookPostDrawInWorld = AddHook<Action<Item, SpriteBatch, Color, Color, float, float, int>>(g => g.PostDrawInWorld)
staticprivate

Definition at line 1453 of file ItemLoader.cs.

◆ HookPostDrawTooltip

HookList Terraria.ModLoader.ItemLoader.HookPostDrawTooltip = AddHook<DelegatePostDrawTooltip>(g => g.PostDrawTooltip)
staticprivate

Definition at line 1630 of file ItemLoader.cs.

◆ HookPostDrawTooltipLine

HookList Terraria.ModLoader.ItemLoader.HookPostDrawTooltipLine = AddHook<DelegatePostDrawTooltipLine>(g => g.PostDrawTooltipLine)
staticprivate

Definition at line 1648 of file ItemLoader.cs.

◆ HookPostReforge

HookList Terraria.ModLoader.ItemLoader.HookPostReforge = AddHook<Action<Item>>(g => g.PostReforge)
staticprivate

Definition at line 1113 of file ItemLoader.cs.

◆ HookPostUpdate

HookList Terraria.ModLoader.ItemLoader.HookPostUpdate = AddHook<Action<Item>>(g => g.PostUpdate)
staticprivate

Definition at line 1339 of file ItemLoader.cs.

◆ HookPreDrawInInventory

HookList Terraria.ModLoader.ItemLoader.HookPreDrawInInventory = AddHook<Func<Item, SpriteBatch, Vector2, Rectangle, Color, Color, Vector2, float, bool>>(g => g.PreDrawInInventory)
staticprivate

Definition at line 1466 of file ItemLoader.cs.

◆ HookPreDrawInWorld

HookList Terraria.ModLoader.ItemLoader.HookPreDrawInWorld = AddHook<DelegatePreDrawInWorld>(g => g.PreDrawInWorld)
staticprivate

Definition at line 1436 of file ItemLoader.cs.

◆ HookPreDrawTooltip

HookList Terraria.ModLoader.ItemLoader.HookPreDrawTooltip = AddHook<DelegatePreDrawTooltip>(g => g.PreDrawTooltip)
staticprivate

Definition at line 1620 of file ItemLoader.cs.

◆ HookPreDrawTooltipLine

HookList Terraria.ModLoader.ItemLoader.HookPreDrawTooltipLine = AddHook<DelegatePreDrawTooltipLine>(g => g.PreDrawTooltipLine)
staticprivate

Definition at line 1638 of file ItemLoader.cs.

◆ HookPreOpenVanillaBag

HookList Terraria.ModLoader.ItemLoader.HookPreOpenVanillaBag = AddHook<Func<string, Player, int, bool>>(g => g.PreOpenVanillaBag)
staticprivate

Definition at line 1058 of file ItemLoader.cs.

◆ HookPreReforge

HookList Terraria.ModLoader.ItemLoader.HookPreReforge = AddHook<Func<Item, bool>>(g => g.NewPreReforge)
staticprivate

Definition at line 1102 of file ItemLoader.cs.

◆ HookPreUpdateVanitySet

HookList Terraria.ModLoader.ItemLoader.HookPreUpdateVanitySet = AddHook<Action<Player, string>>(g => g.PreUpdateVanitySet)
staticprivate

Definition at line 897 of file ItemLoader.cs.

◆ HookReforgePrice

HookList Terraria.ModLoader.ItemLoader.HookReforgePrice = AddHook<DelegateReforgePrice>(g => g.ReforgePrice)
staticprivate

Definition at line 1088 of file ItemLoader.cs.

◆ HookRightClick

HookList Terraria.ModLoader.ItemLoader.HookRightClick = AddHook<Action<Item, Player>>(g => g.RightClick)
staticprivate

Definition at line 1006 of file ItemLoader.cs.

◆ hooks

List<HookList> Terraria.ModLoader.ItemLoader.hooks = new List<HookList>()
staticprivate

Definition at line 44 of file ItemLoader.cs.

◆ HookSetDefaults

HookList Terraria.ModLoader.ItemLoader.HookSetDefaults = AddHook<Action<Item>>(g => g.SetDefaults)
staticprivate

Definition at line 193 of file ItemLoader.cs.

◆ HookSetMatch

HookList Terraria.ModLoader.ItemLoader.HookSetMatch = AddHook<DelegateSetMatch>(g => g.SetMatch)
staticprivate

Definition at line 974 of file ItemLoader.cs.

◆ HookShoot

HookList Terraria.ModLoader.ItemLoader.HookShoot = AddHook<DelegateShoot>(g => g.Shoot)
staticprivate

Definition at line 558 of file ItemLoader.cs.

◆ HookUpdate

HookList Terraria.ModLoader.ItemLoader.HookUpdate = AddHook<DelegateUpdate>(g => g.Update)
staticprivate

Definition at line 1326 of file ItemLoader.cs.

◆ HookUpdateAccessory

HookList Terraria.ModLoader.ItemLoader.HookUpdateAccessory = AddHook<Action<Item, Player, bool>>(g => g.UpdateAccessory)
staticprivate

Definition at line 848 of file ItemLoader.cs.

◆ HookUpdateArmorSet

HookList Terraria.ModLoader.ItemLoader.HookUpdateArmorSet = AddHook<Action<Player, string>>(g => g.UpdateArmorSet)
staticprivate

Definition at line 875 of file ItemLoader.cs.

◆ HookUpdateEquip

HookList Terraria.ModLoader.ItemLoader.HookUpdateEquip = AddHook<Action<Item, Player>>(g => g.UpdateEquip)
staticprivate

Definition at line 832 of file ItemLoader.cs.

◆ HookUpdateInventory

HookList Terraria.ModLoader.ItemLoader.HookUpdateInventory = AddHook<Action<Item, Player>>(g => g.UpdateInventory)
staticprivate

Definition at line 816 of file ItemLoader.cs.

◆ HookUpdateVanitySet

HookList Terraria.ModLoader.ItemLoader.HookUpdateVanitySet = AddHook<Action<Player, string>>(g => g.UpdateVanitySet)
staticprivate

Definition at line 922 of file ItemLoader.cs.

◆ HookUseItem

HookList Terraria.ModLoader.ItemLoader.HookUseItem = AddHook<Func<Item, Player, bool>>(g => g.UseItem)
staticprivate

Definition at line 709 of file ItemLoader.cs.

◆ HookUseItemFrame

HookList Terraria.ModLoader.ItemLoader.HookUseItemFrame = AddHook<Func<Item, Player, bool>>(g => g.UseItemFrame)
staticprivate

Definition at line 761 of file ItemLoader.cs.

◆ HookUseItemHitbox

HookList Terraria.ModLoader.ItemLoader.HookUseItemHitbox = AddHook<DelegateUseItemHitbox>(g => g.UseItemHitbox)
staticprivate

Definition at line 585 of file ItemLoader.cs.

◆ HookUseStyle

HookList Terraria.ModLoader.ItemLoader.HookUseStyle = AddHook<Action<Item, Player>>(g => g.UseStyle)
staticprivate

Definition at line 283 of file ItemLoader.cs.

◆ HookUseTimeMultiplier

HookList Terraria.ModLoader.ItemLoader.HookUseTimeMultiplier = AddHook<Func<Item, Player, float>>(g => g.UseTimeMultiplier)
staticprivate

Definition at line 328 of file ItemLoader.cs.

◆ HookVerticalWingSpeeds

HookList Terraria.ModLoader.ItemLoader.HookVerticalWingSpeeds = AddHook<DelegateVerticalWingSpeeds>(g => g.VerticalWingSpeeds)
staticprivate

Definition at line 1262 of file ItemLoader.cs.

◆ HookWingUpdate

HookList Terraria.ModLoader.ItemLoader.HookWingUpdate = AddHook<Func<int, Player, bool, bool>>(g => g.WingUpdate)
staticprivate

Definition at line 1308 of file ItemLoader.cs.

◆ ItemCount

◆ nextItem

int Terraria.ModLoader.ItemLoader.nextItem = ItemID.Count
staticprivate

Definition at line 23 of file ItemLoader.cs.