tModLoader v2022.09
A mod to make and play Terraria mods
|
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...
Static Public Member Functions | |
static T | AddModHook< T > (T hook) |
static bool | AllowPrefix (Item item, int pre) |
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. | |
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. | |
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. | |
static bool | CanAccessoryBeEquippedWith (Item equippedItem, Item incomingItem) |
static ? bool | CanAutoReuseItem (Item item, Player player) |
static ? bool | CanBurnInLava (Item item) |
Calls ModItem.CanBurnInLava. | |
static ? bool | CanCatchNPC (Item item, NPC target, Player player) |
Gathers the results of all GlobalItem.CanCatchNPC hooks, then the ModItem.CanCatchNPC hook if applicable. 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. | |
static bool | CanChooseAmmo (Item weapon, Item ammo, Player player) |
Calls each GlobalItem.CanChooseAmmo hook for the weapon, and each GlobalItem.CanBeChosenAsAmmo hook for the ammo, then each corresponding hook in ModItem if applicable for the weapon and/or ammo, until one of them returns a concrete false value. If all of them fail to do this, returns either true (if one returned true prior) or ammo.ammo == weapon.useAmmo . | |
static bool | CanConsumeAmmo (Item weapon, Item ammo, Player player) |
Calls each GlobalItem.CanConsumeAmmo hook for the weapon, and each GlobalItem.CanBeConsumedAsAmmo hook for the ammo, then each corresponding hook in ModItem if applicable for the weapon and/or ammo, until one of them returns a concrete false value. If all of them fail to do this, returns true. | |
static ? bool | CanConsumeBait (Player player, Item bait) |
static bool | CanEquipAccessory (Item item, int slot, bool modded) |
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. | |
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. | |
static bool | CanPickup (Item item, Player player) |
static bool | CanResearch (Item item) |
Hook that determines if an item will be prevented from being consumed by the research function. More... | |
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. | |
static bool | CanShoot (Item item, Player player) |
Calls each GlobalItem.CanShoot hook, then ModItem.CanShoot, until one of them returns false. If all of them return true, returns true. | |
static bool | CanStack (Item item1, Item item2) |
Returns false if item prefixes don't match. Then calls all GlobalItem.CanStack hooks until one returns false then ModItem.CanStack. Returns whether any of the hooks returned false. | |
static bool | CanStackInWorld (Item item1, Item item2) |
Calls all GlobalItem.CanStackInWorld hooks until one returns false then ModItem.CanStackInWorld. Returns whether any of the hooks returned false. | |
static bool | CanUseItem (Item item, Player player) |
static void | CaughtFishStack (Item item) |
static int | ChoosePrefix (Item item, UnifiedRandom rand) |
static bool | ConsumeItem (Item item, Player player) |
If ModItem.ConsumeItem or any of the GlobalItem.ConsumeItem hooks returns false, sets consume to false. | |
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. | |
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. | |
static void | GetHealLife (Item item, Player player, bool quickHeal, ref int healValue) |
Calls ModItem.GetHealLife, then all GlobalItem.GetHealLife hooks. | |
static void | GetHealMana (Item item, Player player, bool quickHeal, ref int healValue) |
Calls ModItem.GetHealMana, then all GlobalItem.GetHealMana hooks. | |
static ModItem | GetItem (int type) |
Gets the ModItem instance corresponding to the specified type. Returns null if no modded item has the given type. | |
static void | GrabRange (Item item, Player player, ref int grabRange) |
Calls ModItem.GrabRange, then all GlobalItem.GrabRange hooks. | |
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. | |
static void | HoldItem (Item item, Player player) |
Calls ModItem.HoldItem and all GlobalItem.HoldItem hooks. | |
static void | 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. | |
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, Rectangle heldItemFrame) |
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. Returns whether or not the vanilla logic should be skipped. | |
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. | |
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. | |
static bool | ItemSpace (Item item, Player player) |
static void | MeleeEffects (Item item, Player player, Rectangle hitbox) |
Calls ModItem.MeleeEffects and all GlobalItem.MeleeEffects hooks. | |
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. | |
static void | ModifyHitPvp (Item item, Player player, Player target, ref int damage, ref bool crit) |
Calls ModItem.ModifyHitPvp, then all GlobalItem.ModifyHitPvp hooks. | |
static void | ModifyItemLoot (Item item, ItemLoot itemLoot) |
Calls each GlobalItem.ModifyItemLoot hooks. | |
static void | ModifyItemScale (Item item, Player player, ref float scale) |
Calls ModItem.ModifyItemScale if applicable, then all applicable GlobalItem.ModifyItemScale instances. | |
static void | ModifyManaCost (Item item, Player player, ref float reduce, ref float mult) |
Calls ModItem.ModifyManaCost, then all GlobalItem.ModifyManaCost hooks. | |
static void | ModifyResearchSorting (Item item, ref ContentSamples.CreativeHelper.ItemGroup itemGroup) |
static void | ModifyShootStats (Item item, Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) |
Calls ModItem.ModifyShootStats, then each GlobalItem.ModifyShootStats hook. | |
static List< TooltipLine > | ModifyTooltips (Item item, ref int numTooltips, string[] names, ref string[] text, ref bool[] modifier, ref bool[] badModifier, ref int oneDropLogo, out Color?[] overrideColor) |
static void | ModifyWeaponCrit (Item item, Player player, ref float crit) |
Calls ModItem.ModifyWeaponCrit, then all GlobalItem.ModifyWeaponCrit hooks. | |
static void | ModifyWeaponDamage (Item item, Player player, ref StatModifier damage) |
Calls ModItem.HookModifyWeaponDamage, then all GlobalItem.HookModifyWeaponDamage hooks. | |
static void | ModifyWeaponKnockback (Item item, Player player, ref StatModifier knockback) |
Calls ModItem.ModifyWeaponKnockback, then all GlobalItem.ModifyWeaponKnockback hooks. | |
static bool | NeedsAmmo (Item weapon, Player player) |
Calls ModItem.NeedsAmmo, then all GlobalItem.NeedsAmmo hooks, until any of them returns false. | |
static void | OnCatchNPC (Item item, NPC npc, Player player, bool failed) |
static void | OnConsumeAmmo (Item weapon, Item ammo, Player player) |
Calls ModItem.OnConsumeAmmo for the weapon, ModItem.OnConsumedAsAmmo for the ammo, then each corresponding hook for the weapon and ammo. | |
static void | OnConsumeItem (Item item, Player player) |
Calls ModItem.OnConsumeItem and all GlobalItem.OnConsumeItem hooks. | |
static void | OnConsumeMana (Item item, Player player, int manaConsumed) |
Calls ModItem.OnConsumeMana, then all GlobalItem.OnConsumeMana hooks. | |
static void | OnCreate (Item item, ItemCreationContext context) |
static void | OnHitNPC (Item item, Player player, NPC target, int damage, float knockBack, bool crit) |
Calls ModItem.OnHitNPC and all GlobalItem.OnHitNPC hooks. | |
static void | OnHitPvp (Item item, Player player, Player target, int damage, bool crit) |
Calls ModItem.OnHitPvp and all GlobalItem.OnHitPvp hooks. | |
static void | OnMissingMana (Item item, Player player, int neededMana) |
Calls ModItem.OnMissingMana, then all GlobalItem.OnMissingMana hooks. | |
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. | |
static void | OnResearched (Item item, bool fullyResearched) |
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. | |
static void | OpenVanillaBag (string context, Player player, int arg) |
Calls all GlobalItem.OpenVanillaBag hooks. | |
static void | PickAmmo (Item weapon, Item ammo, Player player, ref int type, ref float speed, ref StatModifier damage, ref float knockback) |
Calls ModItem.PickAmmo, then all GlobalItem.PickAmmo hooks. | |
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. | |
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. | |
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. | |
static void | PostUpdate (Item item) |
Calls ModItem.PostUpdate and all GlobalItem.PostUpdate hooks. | |
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. | |
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. | |
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 | PrefixChance (Item item, int pre, UnifiedRandom rand) |
Allows for blocking, forcing and altering chance of prefix rolling. False (block) takes precedence over True (force). Null gives vanilla behaviour | |
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. | |
static bool | PreReforge (Item item) |
Calls ModItem.PreReforge, then all GlobalItem.PreReforge hooks. | |
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. | |
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. | |
static bool | Shoot (Item item, Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback, bool defaultResult=true) |
Calls each GlobalItem.Shoot hook then, if none of them returns false, calls the ModItem.Shoot hook and returns its value. | |
static void | Update (Item item, ref float gravity, ref float maxFallSpeed) |
Calls ModItem.Update, then all GlobalItem.Update hooks. | |
static void | UpdateAccessory (Item item, Player player, bool hideVisual) |
Hook at the end of Player.ApplyEquipFunctional can be called to apply additional code related to accessory slots for a particular item. | |
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. | |
static void | UpdateEquip (Item item, Player player) |
Hook at the end of Player.VanillaUpdateEquip can be called to apply additional code related to accessory slots for a particular item | |
static void | UpdateInventory (Item item, Player player) |
Calls ModItem.UpdateInventory and all GlobalItem.UpdateInventory hooks. | |
static void | UpdateVanity (Item item, Player player) |
Hook at the end of Player.ApplyEquipVanity can be called to apply additional code related to accessory slots for a particular item | |
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. | |
static void | UseAnimation (Item item, Player player) |
static float | UseAnimationMultiplier (Item item, Player player) |
static ? bool | UseItem (Item item, Player player) |
Returns false if any of ModItem.UseItem or GlobalItem.UseItem return false. Returns true if anything returns true without returning false. Returns null by default. Does not fail fast (calls every hook) | |
static void | 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. | |
static void | UseItemHitbox (Item item, Player player, ref Rectangle hitbox, ref bool noHitbox) |
Calls ModItem.UseItemHitbox, then all GlobalItem.UseItemHitbox hooks. | |
static float | UseSpeedMultiplier (Item item, Player player) |
static void | UseStyle (Item item, Player player, Rectangle heldItemFrame) |
Calls ModItem.UseStyle and all GlobalItem.UseStyle hooks. | |
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. | |
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. | |
Properties | |
static int | ItemCount [get] |
This serves as the central class from which item-related functions are carried out. It also stores a list of mod items by ID.
|
static |
T | : | HookList |
|
static |
Hook that determines if an item will be prevented from being consumed by the research function.
item | The item to be consumed or not |
|
static |
Call all ModItem.ReforgePrice, then GlobalItem.ReforgePrice hooks.
item | |
reforgePrice | |
canApplyDiscount |
If Main.mouseRightRelease is true, the following steps are taken: