Skip to content

API Items

JonataOliveiraa edited this page Nov 14, 2026 · 1 revision
Reference

API reference · generated by tools/docs/ApiReference, do not edit by hand

Items, their global hooks, prefixes, recipes, ammo, armor and the sets that describe them.

AmmoID

static class Terraria.ID.AmmoID

Ammo types: the value of Item.ammo and Item.useAmmo.

Member Kind tModLoader What it does

AmmoID.Sets

struct Terraria.ID.AmmoID.Sets

Tables indexed by ammo.

Member Kind tModLoader What it does
int[] SpecificLauncherAmmoProjectileFallback static property same Which launcher's table a launcher falls back to when it has no entry of its own.
LauncherAmmoMatches SpecificLauncherAmmoProjectileMatches static property differs The projectile each launcher fires for each rocket ammo. tML: Dictionary<int, Dictionary<int, int>> SpecificLauncherAmmoProjectileMatches

AmmoID.Sets.LauncherAmmoMatches

class Terraria.ID.AmmoID.Sets.LauncherAmmoMatches · only in Bunny Loader

Which rocket each launcher fires for a given ammo.

Member Kind tModLoader What it does
int Count property only here How many items it holds.
Dictionary<int, int> this[int launcher] indexer only here Reads or writes one entry.
void Add(int launcher, Dictionary<int, int> matches) method only here Adds the ammo-to-projectile table of a launcher.
bool ContainsKey(int launcher) method only here Whether there is an entry for this key.
bool TryGetValue(int launcher, out Dictionary<int, int> matches) method only here Reads an entry if there is one.
bool Remove(int launcher) method only here Removes an entry.

ArmorIDs

struct Terraria.ID.ArmorIDs

Equipment texture slots: the numbers in Item.headSlot, bodySlot and legSlot.

Member Kind tModLoader What it does

ArmorIDs.Body

struct Terraria.ID.ArmorIDs.Body

Body slots.

Member Kind tModLoader What it does

ArmorIDs.Body.Sets

struct Terraria.ID.ArmorIDs.Body.Sets

Tables indexed by body slot.

Member Kind tModLoader What it does
bool[] HidesTopSkin static property only here The body piece hides the skin of the torso.
bool[] HidesBottomSkin static property only here The body piece hides the skin of the lower torso.
bool[] HidesHands static property only here The body piece hides the hands.
bool[] HidesArms static property only here The body piece hides the arms.

ArmorIDs.Head

struct Terraria.ID.ArmorIDs.Head

Head slots.

Member Kind tModLoader What it does

ArmorIDs.Head.Sets

struct Terraria.ID.ArmorIDs.Head.Sets

Tables indexed by head slot.

Member Kind tModLoader What it does
bool[] DrawFullHair static property only here The helmet shows all of the hair.
bool[] DrawHatHair static property only here The helmet shows the hair that fits under a hat.
bool[] DrawsBackHairWithoutHeadgear static property only here The helmet also draws the back of the hair.
DrawHeadSet DrawHead static property only here Whether the head shows under the helmet.

ArmorIDs.Head.Sets.DrawHeadSet

class Terraria.ID.ArmorIDs.Head.Sets.DrawHeadSet · only in Bunny Loader

Whether the player's head shows under a given helmet.

Member Kind tModLoader What it does
bool this[int head] indexer only here Reads or writes one entry.

ArmorIDs.Legs

struct Terraria.ID.ArmorIDs.Legs

Leg slots.

Member Kind tModLoader What it does

ArmorIDs.Legs.Sets

struct Terraria.ID.ArmorIDs.Legs.Sets

Tables indexed by leg slot.

Member Kind tModLoader What it does
bool[] HidesTopSkin static property only here The leg piece hides the skin of the hips.
bool[] HidesBottomSkin static property only here The leg piece hides the skin of the legs.

Condition

record Terraria.Condition

A named check with text, used by recipes and shops. The static fields are the game's conditions, such as Condition.InBeach; new Condition(text, check) makes your own.

Members: new, NpcIsPresent, GolfScoreOver, BestiaryFilledPercent, CurrentPriceAdjustmentUnder, CurrentPriceAdjustmentOver, IsMet, HappyWindyDay, MoonPhasesQuarter0, MoonPhasesQuarter1, MoonPhasesQuarter2, MoonPhasesQuarter3, IsNpcShimmered, NearWater, NearLava, NearHoney, TimeDay, TimeNight, InDungeon, InCorrupt, InHallow, InMeteor, InJungle, InSnow, InCrimson, InWaterCandle, InPeaceCandle, InTowerSolar, InTowerVortex, InTowerNebula, InTowerStardust, InDesert, InGlowshroom, InUndergroundDesert, InSkyHeight, InSpace, InOverworldHeight, InDirtLayerHeight, InRockLayerHeight, InUnderworldHeight, InUnderworld, InBeach, InRain, InSandstorm, InOldOneArmy, InGranite, InMarble, InHive, InGemCave, InLihzhardTemple, InGraveyard, InAether, InShoppingZoneForest, InEvilBiome, AnotherTownNPCNearby, NotInEvilBiome, NotInHallow, NotInGraveyard, NotInUnderworld, InClassicMode, InExpertMode, InMasterMode, InJourneyMode, Hardmode, PreHardmode, SmashedShadowOrb, CrimsonWorld, CorruptWorld, DrunkWorld, RemixWorld, NotTheBeesWorld, ForTheWorthyWorld, TenthAnniversaryWorld, DontStarveWorld, NoTrapsWorld, ZenithWorld, InBelowSurface, SkyblockWorld, VampireSeed, InfectedSeed, TeamBasedSpawnsSeed, DualDungeonsSeed, NotDrunkWorld, NotRemixWorld, NotNotTheBeesWorld, NotForTheWorthy, NotTenthAnniversaryWorld, NotDontStarveWorld, NotNoTrapsWorld, NotZenithWorld, NotSkyblockWorld, NotVampireSeed, NotInfectedSeed, NotTeamBasedSpawnsSeed, NotDualDungeonsSeed, Christmas, Halloween, BloodMoon, NotBloodMoon, Eclipse, NotEclipse, EclipseOrBloodMoon, NotEclipseAndNotBloodMoon, Thunderstorm, BirthdayParty, LanternNight, DownedKingSlime, DownedEyeOfCthulhu, DownedEowOrBoc, DownedEaterOfWorlds, DownedBrainOfCthulhu, DownedQueenBee, DownedSkeletron, DownedDeerclops, DownedQueenSlime, DownedEarlygameBoss, DownedMechBossAny, DownedTwins, DownedDestroyer, DownedSkeletronPrime, DownedMechBossAll, DownedPlantera, DownedEmpressOfLight, DownedDukeFishron, DownedGolem, DownedMourningWood, DownedPumpking, DownedEverscream, DownedSantaNK1, DownedIceQueen, DownedCultist, DownedMoonLord, DownedClown, DownedGoblinArmy, DownedPirates, DownedMartians, DownedFrostLegion, DownedSolarPillar, DownedVortexPillar, DownedNebulaPillar, DownedStardustPillar, DownedOldOnesArmyAny, DownedOldOnesArmyT1, DownedOldOnesArmyT2, DownedOldOnesArmyT3, NotDownedKingSlime, NotDownedEyeOfCthulhu, NotDownedEowOrBoc, NotDownedEaterOfWorlds, NotDownedBrainOfCthulhu, NotDownedQueenBee, NotDownedSkeletron, NotDownedDeerclops, NotDownedQueenSlime, NotDownedMechBossAny, NotDownedTwins, NotDownedDestroyer, NotDownedSkeletronPrime, NotDownedPlantera, NotDownedEmpressOfLight, NotDownedDukeFishron, NotDownedGolem, NotDownedMourningWood, NotDownedPumpking, NotDownedEverscream, NotDownedSantaNK1, NotDownedIceQueen, NotDownedCultist, NotDownedMoonLord, NotDownedClown, NotDownedGoblinArmy, NotDownedPirates, NotDownedMartians, NotDownedFrostLegin, NotDownedSolarPillar, NotDownedVortexPillar, NotDownedNebulaPillar, NotDownedStardustPillar, NotDownedOldOnesArmyAny, NotDownedOldOnesArmyT1, NotDownedOldOnesArmyT2, NotDownedOldOnesArmyT3, BloodMoonOrHardmode, NightOrEclipse, Multiplayer, NotIsNpcShimmered, IsNpcHomeless, NotIsNpcHomeless, BiomeSpreadingItems, NeedTorchGodsFavor, MoonPhaseFull, MoonPhaseWaningGibbous, MoonPhaseThirdQuarter, MoonPhaseWaningCrescent, MoonPhaseNew, MoonPhaseWaxingCrescent, MoonPhaseFirstQuarter, MoonPhaseWaxingGibbous, MoonPhasesHalf0, MoonPhasesHalf1, MoonPhasesEven, MoonPhasesOdd, MoonPhasesNearFull, MoonPhasesNearNew, MoonPhasesEvenQuarters, MoonPhasesOddQuarters, MoonPhases04, MoonPhases15, MoonPhases26, MoonPhases37, MoonPhases12, MoonPhases35, MoonPhases67

Conditions

static class Terraria.GameContent.ItemDropRules.Conditions

The game's drop conditions, each as a nested class.

Member Kind tModLoader What it does

Conditions.BeatAnyMechBoss

class Terraria.GameContent.ItemDropRules.Conditions.BeatAnyMechBoss : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new BeatAnyMechBoss() constructor same Creates an instance.

Conditions.CorruptKeyCondition

class Terraria.GameContent.ItemDropRules.Conditions.CorruptKeyCondition : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new CorruptKeyCondition() constructor same Creates an instance.

Conditions.CrimsonKeyCondition

class Terraria.GameContent.ItemDropRules.Conditions.CrimsonKeyCondition : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new CrimsonKeyCondition() constructor same Creates an instance.

Conditions.DesertKeyCondition

class Terraria.GameContent.ItemDropRules.Conditions.DesertKeyCondition : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new DesertKeyCondition() constructor same Creates an instance.

Conditions.DontStarveIsNotUp

class Terraria.GameContent.ItemDropRules.Conditions.DontStarveIsNotUp : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new DontStarveIsNotUp() constructor same Creates an instance.

Conditions.DontStarveIsUp

class Terraria.GameContent.ItemDropRules.Conditions.DontStarveIsUp : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new DontStarveIsUp() constructor same Creates an instance.

Conditions.DownedAllMechBosses

class Terraria.GameContent.ItemDropRules.Conditions.DownedAllMechBosses : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new DownedAllMechBosses() constructor same Creates an instance.

Conditions.DownedPlantera

class Terraria.GameContent.ItemDropRules.Conditions.DownedPlantera : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new DownedPlantera() constructor same Creates an instance.

Conditions.DropExtraGel

class Terraria.GameContent.ItemDropRules.Conditions.DropExtraGel : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new DropExtraGel() constructor same Creates an instance.

Conditions.Easymode

class Terraria.GameContent.ItemDropRules.Conditions.Easymode : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new Easymode() constructor same Creates an instance.

Conditions.EmpressOfLightIsGenuinelyEnraged

class Terraria.GameContent.ItemDropRules.Conditions.EmpressOfLightIsGenuinelyEnraged : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new EmpressOfLightIsGenuinelyEnraged() constructor same Creates an instance.

Conditions.EyeOfCthulhuDefeatedAndNoAltarsInWorld

class Terraria.GameContent.ItemDropRules.Conditions.EyeOfCthulhuDefeatedAndNoAltarsInWorld : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new EyeOfCthulhuDefeatedAndNoAltarsInWorld() constructor same Creates an instance.

Conditions.FirstTimeKillingPlantera

class Terraria.GameContent.ItemDropRules.Conditions.FirstTimeKillingPlantera : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new FirstTimeKillingPlantera() constructor same Creates an instance.

Conditions.FromCertainWaveAndAbove

class Terraria.GameContent.ItemDropRules.Conditions.FromCertainWaveAndAbove : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new FromCertainWaveAndAbove(int neededWave) constructor same Creates an instance.
ref int neededWave property differs The first wave that allows the drop. tML: int neededWave

Conditions.FrostMoonDropGateForTrophies

class Terraria.GameContent.ItemDropRules.Conditions.FrostMoonDropGateForTrophies : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new FrostMoonDropGateForTrophies() constructor same Creates an instance.

Conditions.FrostMoonDropGatingChance

class Terraria.GameContent.ItemDropRules.Conditions.FrostMoonDropGatingChance : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new FrostMoonDropGatingChance() constructor same Creates an instance.

Conditions.FrozenKeyCondition

class Terraria.GameContent.ItemDropRules.Conditions.FrozenKeyCondition : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new FrozenKeyCondition() constructor same Creates an instance.

Conditions.HallowKeyCondition

class Terraria.GameContent.ItemDropRules.Conditions.HallowKeyCondition : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new HallowKeyCondition() constructor same Creates an instance.

Conditions.HalloweenGoodieBagDrop

class Terraria.GameContent.ItemDropRules.Conditions.HalloweenGoodieBagDrop : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new HalloweenGoodieBagDrop() constructor same Creates an instance.

Conditions.HalloweenWeapons

class Terraria.GameContent.ItemDropRules.Conditions.HalloweenWeapons : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new HalloweenWeapons() constructor same Creates an instance.

Conditions.IsBloodMoonAndNotFromStatue

class Terraria.GameContent.ItemDropRules.Conditions.IsBloodMoonAndNotFromStatue : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new IsBloodMoonAndNotFromStatue() constructor same Creates an instance.

Conditions.IsChristmas

class Terraria.GameContent.ItemDropRules.Conditions.IsChristmas : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new IsChristmas() constructor same Creates an instance.

Conditions.IsCorruption

class Terraria.GameContent.ItemDropRules.Conditions.IsCorruption : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new IsCorruption() constructor same Creates an instance.

Conditions.IsCorruptionAndNotExpert

class Terraria.GameContent.ItemDropRules.Conditions.IsCorruptionAndNotExpert : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new IsCorruptionAndNotExpert() constructor same Creates an instance.

Conditions.IsCrimson

class Terraria.GameContent.ItemDropRules.Conditions.IsCrimson : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new IsCrimson() constructor same Creates an instance.

Conditions.IsCrimsonAndNotExpert

class Terraria.GameContent.ItemDropRules.Conditions.IsCrimsonAndNotExpert : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new IsCrimsonAndNotExpert() constructor same Creates an instance.

Conditions.IsExpert

class Terraria.GameContent.ItemDropRules.Conditions.IsExpert : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new IsExpert() constructor same Creates an instance.

Conditions.IsHardmode

class Terraria.GameContent.ItemDropRules.Conditions.IsHardmode : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new IsHardmode() constructor same Creates an instance.

Conditions.IsMasterMode

class Terraria.GameContent.ItemDropRules.Conditions.IsMasterMode : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new IsMasterMode() constructor same Creates an instance.

Conditions.IsPumpkinMoon

class Terraria.GameContent.ItemDropRules.Conditions.IsPumpkinMoon : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new IsPumpkinMoon() constructor same Creates an instance.

Conditions.IsUsingSpecificAIValues

class Terraria.GameContent.ItemDropRules.Conditions.IsUsingSpecificAIValues : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new IsUsingSpecificAIValues(int aislot, float valueToMatch) constructor same Creates an instance.
ref int aiSlotToCheck property differs Which NPC.ai slot to read. tML: int aiSlotToCheck
ref float valueToMatch property differs The value that slot must have. tML: float valueToMatch

Conditions.JungleKeyCondition

class Terraria.GameContent.ItemDropRules.Conditions.JungleKeyCondition : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new JungleKeyCondition() constructor same Creates an instance.

Conditions.LegacyHack_IsABoss

class Terraria.GameContent.ItemDropRules.Conditions.LegacyHack_IsABoss : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new LegacyHack_IsABoss() constructor same Creates an instance.

Conditions.LegacyHack_IsBossAndExpert

class Terraria.GameContent.ItemDropRules.Conditions.LegacyHack_IsBossAndExpert : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new LegacyHack_IsBossAndExpert() constructor same Creates an instance.

Conditions.LegacyHack_IsBossAndNotExpert

class Terraria.GameContent.ItemDropRules.Conditions.LegacyHack_IsBossAndNotExpert : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new LegacyHack_IsBossAndNotExpert() constructor same Creates an instance.

Conditions.LivingFlames

class Terraria.GameContent.ItemDropRules.Conditions.LivingFlames : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new LivingFlames() constructor same Creates an instance.

Conditions.MechanicalBossesDummyCondition

class Terraria.GameContent.ItemDropRules.Conditions.MechanicalBossesDummyCondition : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new MechanicalBossesDummyCondition() constructor same Creates an instance.

Conditions.MechdusaKill

class Terraria.GameContent.ItemDropRules.Conditions.MechdusaKill : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new MechdusaKill() constructor same Creates an instance.

Conditions.MissingTwin

class Terraria.GameContent.ItemDropRules.Conditions.MissingTwin : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new MissingTwin() constructor same Creates an instance.

Conditions.NamedNPC

class Terraria.GameContent.ItemDropRules.Conditions.NamedNPC : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
string neededName property same The name the NPC must have.
new NamedNPC(string neededName) constructor same Creates an instance.

Conditions.NeverTrue

class Terraria.GameContent.ItemDropRules.Conditions.NeverTrue : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new NeverTrue() constructor same Creates an instance.

Conditions.NotDropExtraGel

class Terraria.GameContent.ItemDropRules.Conditions.NotDropExtraGel : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new NotDropExtraGel() constructor same Creates an instance.

Conditions.NotExpert

class Terraria.GameContent.ItemDropRules.Conditions.NotExpert : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new NotExpert() constructor same Creates an instance.

Conditions.NotFromStatue

class Terraria.GameContent.ItemDropRules.Conditions.NotFromStatue : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new NotFromStatue() constructor same Creates an instance.

Conditions.NotMasterMode

class Terraria.GameContent.ItemDropRules.Conditions.NotMasterMode : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new NotMasterMode() constructor same Creates an instance.

Conditions.NotRemixSeed

class Terraria.GameContent.ItemDropRules.Conditions.NotRemixSeed : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new NotRemixSeed() constructor same Creates an instance.

Conditions.NotRemixSeedEasymode

class Terraria.GameContent.ItemDropRules.Conditions.NotRemixSeedEasymode : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new NotRemixSeedEasymode() constructor same Creates an instance.

Conditions.NotRemixSeedHardmode

class Terraria.GameContent.ItemDropRules.Conditions.NotRemixSeedHardmode : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new NotRemixSeedHardmode() constructor same Creates an instance.

Conditions.PirateMap

class Terraria.GameContent.ItemDropRules.Conditions.PirateMap : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new PirateMap() constructor same Creates an instance.

Conditions.PlayerNeedsHealing

class Terraria.GameContent.ItemDropRules.Conditions.PlayerNeedsHealing : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new PlayerNeedsHealing() constructor same Creates an instance.

Conditions.PumpkinMoonDropGateForTrophies

class Terraria.GameContent.ItemDropRules.Conditions.PumpkinMoonDropGateForTrophies : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new PumpkinMoonDropGateForTrophies() constructor same Creates an instance.

Conditions.PumpkinMoonDropGatingChance

class Terraria.GameContent.ItemDropRules.Conditions.PumpkinMoonDropGatingChance : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new PumpkinMoonDropGatingChance() constructor same Creates an instance.

Conditions.RedHatSkeletron

class Terraria.GameContent.ItemDropRules.Conditions.RedHatSkeletron : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new RedHatSkeletron() constructor same Creates an instance.

Conditions.RemixSeed

class Terraria.GameContent.ItemDropRules.Conditions.RemixSeed : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new RemixSeed() constructor same Creates an instance.

Conditions.RemixSeedEasymode

class Terraria.GameContent.ItemDropRules.Conditions.RemixSeedEasymode : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new RemixSeedEasymode() constructor same Creates an instance.

Conditions.RemixSeedHardmode

class Terraria.GameContent.ItemDropRules.Conditions.RemixSeedHardmode : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new RemixSeedHardmode() constructor same Creates an instance.

Conditions.SkyblockIsNotUp

class Terraria.GameContent.ItemDropRules.Conditions.SkyblockIsNotUp : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new SkyblockIsNotUp() constructor same Creates an instance.

Conditions.SkyblockIsUp

class Terraria.GameContent.ItemDropRules.Conditions.SkyblockIsUp : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new SkyblockIsUp() constructor same Creates an instance.

Conditions.SkyblockIsUpNoSickle

class Terraria.GameContent.ItemDropRules.Conditions.SkyblockIsUpNoSickle : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new SkyblockIsUpNoSickle() constructor same Creates an instance.

Conditions.SoulOfLight

class Terraria.GameContent.ItemDropRules.Conditions.SoulOfLight : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new SoulOfLight() constructor same Creates an instance.

Conditions.SoulOfNight

class Terraria.GameContent.ItemDropRules.Conditions.SoulOfNight : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new SoulOfNight() constructor same Creates an instance.

Conditions.TenthAnniversaryIsNotUp

class Terraria.GameContent.ItemDropRules.Conditions.TenthAnniversaryIsNotUp : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new TenthAnniversaryIsNotUp() constructor same Creates an instance.

Conditions.TenthAnniversaryIsUp

class Terraria.GameContent.ItemDropRules.Conditions.TenthAnniversaryIsUp : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new TenthAnniversaryIsUp() constructor same Creates an instance.

Conditions.WindyEnoughForKiteDrops

class Terraria.GameContent.ItemDropRules.Conditions.WindyEnoughForKiteDrops : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new WindyEnoughForKiteDrops() constructor same Creates an instance.

Conditions.XmasPresentDrop

class Terraria.GameContent.ItemDropRules.Conditions.XmasPresentDrop : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new XmasPresentDrop() constructor same Creates an instance.

Conditions.YoyoCascade

class Terraria.GameContent.ItemDropRules.Conditions.YoyoCascade : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new YoyoCascade() constructor same Creates an instance.

Conditions.YoyosAmarok

class Terraria.GameContent.ItemDropRules.Conditions.YoyosAmarok : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new YoyosAmarok() constructor same Creates an instance.

Conditions.YoyosHelFire

class Terraria.GameContent.ItemDropRules.Conditions.YoyosHelFire : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new YoyosHelFire() constructor same Creates an instance.

Conditions.YoyosKraken

class Terraria.GameContent.ItemDropRules.Conditions.YoyosKraken : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new YoyosKraken() constructor same Creates an instance.

Conditions.YoyosYelets

class Terraria.GameContent.ItemDropRules.Conditions.YoyosYelets : NativeDropCondition

A condition from the game for ItemDropRule.ByCondition. The name says when the drop is allowed.

Member Kind tModLoader What it does
new YoyosYelets() constructor same Creates an instance.

DamageClass

abstract class Terraria.ModLoader.DamageClass : ModType

DamageClass is used to determine the application of item effects, damage/stat scaling, and class bonuses.

Member Kind tModLoader What it does
DamageClass Default static property same Default damage class for non-classed weapons and items, does not benefit from Generic bonuses
DamageClass Generic static property same Base damage class for all weapons. All vanilla damage classes inherit bonuses applied to this class. Accessories which benefit all classes provide bonuses via the Generic class
DamageClass Melee static property same The melee damage class.
DamageClass MeleeNoSpeed static property same This is a damage class used by various projectile-only vanilla melee weapons. Attack speed has no effect on items with this damage class.
DamageClass Ranged static property same The ranged damage class.
DamageClass Magic static property same The magic damage class.
DamageClass Summon static property same The summon damage class.
DamageClass SummonMeleeSpeed static property same This is a damage class used solely by vanilla whips. It benefits from melee attackSpeed bonuses.
DamageClass MagicSummonHybrid static property same This is a damage class used solely by vanilla forbidden storm. It scales with both magic and summon damage modifiers.
DamageClass Throwing static property same Class provided for modders who want to coordinate throwing accessories and items. Not used by any vanilla items.
int Type property same The internal ID of this DamageClass.
string LocalizationCategory hook same The folder of this content in the localization files.
LocalizedText DisplayName hook same This is the name that will show up when an item tooltip displays 'X [ClassName]'.
StatInheritanceData GetModifierInheritance(DamageClass damageClass) hook same This lets you define the classes that this DamageClass will benefit from (other than itself) for the purposes of stat bonuses, such as damage and crit chance. This is used to allow extensive specifications for what your damage class can and can't benefit from in terms of other classes' stat bonuses.
bool GetEffectInheritance(DamageClass damageClass) hook same This lets you define the classes that this DamageClass will count as (other than itself) for the purpose of armor and accessory effects, such as Spectre armor's bolts on magic attacks, or Magma Stone's Hellfire debuff on melee attacks. For a more in-depth explanation and demonstration, see ExampleMod's ExampleDamageClass.cs This method is only meant to be overridden. Modders should call CountsAsClass to query effect inheritance.
bool GetPrefixInheritance(DamageClass damageClass) hook same This lets you define the classes that this DamageClass will count as (other than itself) for the purpose of prefixes. This method is only meant to be overridden. Modders should call GetsPrefixesFor to query prefix inheritance.
void SetDefaultStats(Player player) hook same This lets you define default stat modifiers for all items of this class (e.g. base crit chance).
bool UseStandardCritCalcs hook same This lets you decide whether or not your damage class will use standard crit chance calculations. Setting this to false will also hide the critical strike chance line in the tooltip of any item that uses this DamageClass.
bool ShowStatTooltipLine(Player player, string lineName) hook same Overriding this lets you disable standard statistical tooltip lines displayed on items associated with this DamageClass. All tooltip lines are enabled by default.
bool CountsAsClass<T>() method same Whether this class counts as the class T.
bool CountsAsClass(DamageClass damageClass) method same Whether this class counts as the class T.
bool GetsPrefixesFor<T>() method same Whether this class takes the prefixes of the class T.
bool GetsPrefixesFor(DamageClass damageClass) method same Whether this class takes the prefixes of the class T.
IdDictionary Search static field not here Not implemented.

DamageClassData

class Terraria.ModLoader.DamageClassData

The stats a player keeps per damage class: damage, crit, knockback, attack speed, armor penetration.

Member Kind tModLoader What it does
StatModifier damage field same Damage bonus for the class.
float critChance field same Critical chance bonus for the class.
float attackSpeed field same Attack speed bonus for the class.
float armorPen field same Armor penetration bonus for the class.
StatModifier knockback field same Knockback bonus for the class.

DamageClassLoader

static class Terraria.ModLoader.DamageClassLoader

Registers damage classes and reads their stats.

Member Kind tModLoader What it does
int DamageClassCount static property same How many exist, with the game's and every mod's.
DamageClass GetDamageClass(int type) static method same Gets the DamageClass instance corresponding to the specified type

DrawableTooltipLine

class Terraria.ModLoader.DrawableTooltipLine : TooltipLine

This class serves as a way to store information about a line that will be drawn of tooltip for an item. You will create and manipulate objects of this class if you use the draw hooks for tooltips in ModItem and GlobalItem. For examples, see ExampleSword

Member Kind tModLoader What it does
int Index field same The index of the tooltip in the array
int OriginalX field same The X position where the tooltip would be drawn that is not adjusted by mods.
int OriginalY field same The Y position where the tooltip would be drawn that is not adjusted by mods.
int X field same The X position where the tooltip would be drawn.
int Y field same The Y position where the tooltip would be drawn.
Color Color field same The color the tooltip is drawn in. Defaults to White. The actual final color will be affected slightly by the mouse pulse effect (mouseTextColor).
GameObject Font field differs The font this tooltip would be drawn with tML: DynamicSpriteFont Font
float Rotation field same The rotation this tooltip would be drawn in
Vector2 Origin field same The origin of this tooltip
Vector2 BaseScale field same The baseScale of this tooltip. When drawing the One Drop logo the scale is calculated by (baseScale.X + baseScale.Y) / 2
float MaxWidth field same The width at which the line wraps.
float Spread field same How far the text's outline goes.
new DrawableTooltipLine(TooltipLine parent, int index, int x, int y, Color color) constructor same Creates a new DrawableTooltipLine object

EquipLoader

static class Terraria.ModLoader.EquipLoader

This serves as a central place to store equipment slots and their corresponding textures. You will use this to obtain the IDs for your equipment textures.

Member Kind tModLoader What it does
EquipType[] EquipTypes static field same Every equipment kind, in the order the game uses.
int AddEquipTexture(Mod mod, string texture, EquipType type, ModItem item, string name, EquipTexture equipTexture) static method same Adds an equipment texture of the specified type, internal name, and/or associated item to your mod. If no internal name is provided, the associated item's name will be used instead. You can then get the ID for your texture by calling EquipLoader.GetEquipTexture, and using the EquipTexture's Slot property. If you need to override EquipmentTexture's hooks, you can specify the class of the equipment texture class.
EquipTexture GetEquipTexture(EquipType type, int slot) static method same Gets the equipment texture for the specified equipment type and ID.
EquipTexture GetEquipTexture(Mod mod, string name, EquipType type) static method same Gets the EquipTexture instance corresponding to the name and EquipType. Returns null if no EquipTexture with the given name and EquipType is found.
int GetEquipSlot(Mod mod, string name, EquipType type) static method same Gets the slot/ID of the equipment texture corresponding to the given name. Returns -1 if no EquipTexture with the given name is found.
void EquipFrameEffects(Player player) static method not here Hook Player.PlayerFrame Calls each of the item's equipment texture's FrameEffects hook.

GlobalItem

abstract class Terraria.ModLoader.GlobalItem : GlobalType<Item, GlobalItem>

This class allows you to modify and use hooks for all items, both vanilla and modded. To use it, simply create a new class deriving from this one. Implementations will be registered automatically.

Member Kind tModLoader What it does
void SetDefaults(Item entity) hook only here This is where you set all your item's properties, such as width, damage, shootSpeed, defense, etc. There are many properties that must be set for an item to do anything at all so it is best to consult examples, such as those in ExampleMod, to get an idea of what is required for the type of item you are making. There are many useful methods such as DefaultToPlaceableTile and DefaultToRangedWeapon to easily set the variables needed for that type of item all at once. The CloneDefaults method can be used to clone the item defaults of an item.
void AddRecipes() hook same Override this method to add Recipes to the game. The Basic Recipes Guide teaches how to add new recipes to the game and how to manipulate existing recipes.
bool CanStack(Item destination, Item source) hook same Allows you to prevent items from stacking. This is only called when two items of the same type attempt to stack. This is called on the item that would be stacked onto (this/destination). This is usually not called for coins and ammo in the inventory/UI. This covers all scenarios, if you just need to change in-world stacking behavior, use CanStackInWorld. Called on local, server, and remote clients.
bool CanStackInWorld(WorldItem destination, WorldItem source) hook same Allows you to prevent items from stacking in the world. This is only called when two items of the same type attempt to stack. This is called on the item that would be stacked onto (this/destination). Called on the server and the owning client.
void OnStack(Item destination, Item source, int numToTransfer) hook same Allows you to make things happen when items stack together. This hook is called on the item being stacked onto (this/destination) before the items are transferred from source to destination. This will be called both for in-world and in-inventory stacking. Called on local, server, and remote clients.
void SplitStack(Item destination, Item source, int numToTransfer) hook same Allows you to make things happen when an item stack is split. This hook is called on the new item (this/destination) before the stack values are modified. Called on the local client only.
void SaveData(Item item, TagCompound tag) hook same Allows you to save custom data for this item. NOTE: The provided tag is always empty by default, and is provided as an argument only for the sake of convenience and optimization. NOTE: Try to only save data that isn't default values.
void LoadData(Item item, TagCompound tag) hook same Allows you to load custom data that you have saved for this item. Try to write defensive loading code that won't crash if something's missing.
void OnSpawn(WorldItem item, IEntitySource source) hook same Gets called when any item spawns in world Called on the local client or the server where Item.NewItem is called.
void OnCreated(Item item, ItemCreationContext context) hook same Called when the item is created. The context parameter indicates the context of the item creation and can be used in logic for the desired effect. Called on the local client only. Known ItemCreationContext include: InitializationItemCreationContext, BuyItemCreationContext, JourneyDuplicationItemCreationContext, and RecipeItemCreationContext. Some of these provide additional context such as how RecipeItemCreationContext includes the items consumed to craft the item.
bool ReforgePrice(Item item, ref long reforgePrice, ref bool canApplyDiscount) hook same Returns if the normal reforge pricing is applied. If true or false is returned and the price is altered, the price will equal the altered price. The passed reforge price equals the item.value. Vanilla pricing will apply 20% discount if applicable and then price the reforge at a third of that value. Called on the local client only.
bool CanReforge(Item item) hook same This hook gets called when the player clicks on the reforge button and can afford the reforge. Returns whether the reforge will take place. If false is returned by the ModItem or any GlobalItem, the item will not be reforged, the cost to reforge will not be paid, and PreReforge and PostReforge hooks will not be called. Reforging preserves modded data on the item. Called on the local client only.
void PreReforge(Item item) hook same This hook gets called immediately before an item gets reforged by the Goblin Tinkerer. Called on the local client only.
void PostReforge(Item item) hook same This hook gets called immediately after an item gets reforged by the Goblin Tinkerer. Useful for modifying modded data based on the reforge result. Called on the local client only.
void ApplyPrefix(Item item, int pre) hook same Called immediately after prefix stat changes are applied (as well as Apply), facilitating item-specific tweaks to prefix effects.
Vector2 HoldoutOrigin(int type) hook same Allows you to determine the point on an item's sprite that the player holds onto when using the item. The origin is from the bottom left corner of the sprite. This is only used for staves with a useStyle of 5. Return null to use the item's default holdout origin; returns null by default. This method is not instanced. Called on local and remote clients.
void CaughtFishStack(int type, ref int stack) hook same Allows you to modify how many of an item a player obtains when the player fishes that item. Called on the local client only.
void PreModifyItemDraw(Item item, ref PlayerDrawSet drawInfo, ref DrawData drawData, ref DrawData coloredDrawData, ref DrawData glowMaskDrawData) hook same Allows customization of the DrawData responsible for drawing the held item. Held items are drawn as part of the player drawing process. Additional DrawData can be added to drawInfo for more advanced drawing if needed. (Add DrawData objects to DrawDataCache) drawData is the DrawData for the normal drawing. coloredDrawData is an additional drawing if color was set, overlaid over the normal drawing to tint it. glowMaskDrawData is a separate glow mask texture, if glowMask was set.
void PostModifyItemDraw(Item item, ref PlayerDrawSet drawInfo, DrawData drawData, DrawData coloredDrawData, DrawData glowmaskDrawData) hook same Allows drawing additional DrawData after the normal drawing by adding to drawInfo. (Add DrawData objects to DrawDataCache)
bool CanCatchNPC(Item item, NPC target, Player player) hook same Allows you to determine whether the given item can catch the given NPC. Return true or false to say the given NPC can or cannot be caught, respectively, regardless of vanilla rules. Returns null by default, which allows vanilla's NPC catching rules to decide the target's fate. If this returns false, OnCatchNPC is never called. NOTE: this does not classify the given item as an NPC-catching tool, which is necessary for catching NPCs in the first place. To do that, you will need to use CatchingTool. Called on the local client only.
bool CanUseItem(Item item, Player player) hook same Returns whether or not any item can be used. Returns true by default. The inability to use a specific item overrides this, so use this to stop an item from being used. Called on local, server, and remote clients. The item may or not be used after this method is called, so logic in this method should have no side effects such as consuming items or resources.
bool UseItem(Item item, Player player) hook same Allows you to make things happen when an item is used. The return value controls whether or not ApplyItemTime will be called for the player. Return true if the item actually did something, to force itemTime. Return false to keep itemTime at 0. Return null for vanilla behavior. Called on local, server, and remote clients. Note the for right-click actions, this is currently only called on the local client.
void UseAnimation(Item item, Player player) hook same Allows you to make things happen when an item's use animation starts. Called on local, server, and remote clients.
bool CanAutoReuseItem(Item item, Player player) hook same Allows you to modify the autoswing (auto-reuse) behavior of any item without having to mess with Item.autoReuse. Useful to create effects like the Feral Claws which makes melee weapons and whips auto-reusable. Return true to enable autoswing (if not already enabled through autoReuse), return false to prevent autoswing. Returns null by default, which applies vanilla behavior. Called on local, server, and remote clients.
float UseTimeMultiplier(Item item, Player player) hook same Allows you to change the effective useTime of an item. Note that this hook may cause items' actions to run less or more times than they should per a single use. Called on local, server, and remote clients.
float UseAnimationMultiplier(Item item, Player player) hook same Allows you to change the effective useAnimation of an item. Note that this hook may cause items' actions to run less or more times than they should per a single use. Called on local, server, and remote clients.
float UseSpeedMultiplier(Item item, Player player) hook same Allows you to safely change both useTime and useAnimation while keeping the values relative to each other. Useful for status effects. Called on local, server, and remote clients.
void ModifyManaCost(Item item, Player player, ref float reduce, ref float mult) hook same Allows you to temporarily modify the amount of mana an item will consume on use, based on player buffs, accessories, etc. This is only called for items with a mana value. Do not modify mana, modify the reduce and mult parameters. Called on local, server, and remote clients.
void OnMissingMana(Item item, Player player, int neededMana) hook same Allows you to make stuff happen when a player doesn't have enough mana for an item they are trying to use. If the player has high enough mana after this hook runs, mana consumption will happen normally. Only runs once per item use. Called on local, server, and remote clients.
void OnConsumeMana(Item item, Player player, int manaConsumed) hook same Allows you to make stuff happen when a player consumes mana on use of an item. Called on local, server, and remote clients.
void UseItemFrame(Item item, Player player) hook same Allows you to modify the player's animation when an item is being used. Called on local, server, and remote clients.
void HoldItemFrame(Item item, Player player) hook same Allows you to modify the player's animation when the player is holding an item. Called on local, server, and remote clients.
bool AltFunctionUse(Item item, Player player) hook same Allows you to make this item usable by right-clicking. When this item is used by right-clicking, altFunctionUse will be set to 2. Check the value of altFunctionUse in UseItem to apply right-click specific logic. For auto-reusing through right clicking, see also ItemsThatAllowRepeatedRightClick. Returns false by default. Called on the local client only. Phone: In a touch profile with an aim stick, Interact switches the alternative mode and the aim stick fires it, as with the Portal Gun.
Asset<Texture2D> AltFunctionIcon(Item item, Player player, bool alternative) hook only here Icon of the Interact touch button while this item is held and its alternative use can be switched there, also shown in the touch glyph of its tooltip. alternative says which mode is on. Return null to keep the item's icon or the one of the ModItem or an earlier global.
void HoldItem(Item item, Player player) hook same Allows you to make things happen when the player is holding an item (for example, torches make light and water candles increase spawn rate). Called on local, server, and remote clients.
void UseStyle(Item item, Player player, Rectangle heldItemFrame) hook same Allows you to modify the location and rotation of any item in its use animation. Called on local, server, and remote clients.
void HoldStyle(Item item, Player player, Rectangle heldItemFrame) hook same Allows you to modify the location and rotation of the item the player is currently holding. Called on local, server, and remote clients.
Vector2 HoldoutOffset(int type) hook same Allows you to determine the offset of an item's sprite when used by the player. This is only used for items with a useStyle of 5 that aren't staves. Return null to use the item's default holdout offset; returns null by default. This method is not instanced. Called on local and remote clients. return new Vector2(10, 0);
void ModifyResearchSorting(Item item, ref ItemGroup itemGroup) hook same Allows you to set an item's sorting group in Journey Mode's duplication menu. This is useful for setting custom item types that group well together, or whenever the default vanilla sorting doesn't sort the way you want it. Note that this affects the order of the item in the listing, not which filters the item satisfies.
void UpdateInventory(Item item, Player player) hook same Allows you to make things happen when an item is in the player's inventory. This should NOT be used for information accessories; use for those instead. Called on local, server, and remote clients.
void ModifyWeaponDamage(Item item, Player player, ref StatModifier damage) hook same Allows you to dynamically modify a weapon's damage based on player and item conditions. Can be utilized to modify damage beyond the tools that DamageClass has to offer. Do not modify damage, modify the damage parameter. Called on local, server, and remote clients.
void ModifyWeaponKnockback(Item item, Player player, ref StatModifier knockback) hook same Allows you to dynamically modify a weapon's knockback based on player and item conditions. Can be utilized to modify damage beyond the tools that DamageClass has to offer. Do not modify knockBack, modify the knockback parameter. Called on the local client only.
void ModifyWeaponCrit(Item item, Player player, ref float crit) hook same Allows you to dynamically modify a weapon's crit chance based on player and item conditions. Can be utilized to modify damage beyond the tools that DamageClass has to offer. Do not modify crit, modify the crit parameter. Called on the local client only.
bool NeedsAmmo(Item item, Player player) hook same Whether or not having no ammo prevents an item that uses ammo from shooting. Return false to allow shooting with no ammo in the inventory, in which case the item will act as if the default ammo for it is being used. Returns true by default. Called on local, server, and remote clients.
void PickAmmo(Item weapon, Item ammo, Player player, ref int type, ref float speed, ref StatModifier damage, ref float knockback) hook same Allows you to modify various properties of the projectile created by a weapon based on the ammo it is using. Called on local and remote clients when a player picking ammo but only on the local client when held projectiles are picking ammo.
bool CanChooseAmmo(Item weapon, Item ammo, Player player) hook same Whether or not the given ammo item is valid for the given weapon; called on the weapon. If this, or CanBeChosenAsAmmo on the ammo, returns false, then the ammo will not be valid for this weapon. By default, returns null and allows useAmmo and ammo to decide. Return true to make the ammo valid regardless of these fields, and return false to make it invalid. If false is returned, the CanConsumeAmmo, CanBeConsumedAsAmmo, OnConsumeAmmo, and OnConsumedAsAmmo hooks are never called. Called on local and remote clients.
bool CanBeChosenAsAmmo(Item ammo, Item weapon, Player player) hook same Whether or not the given ammo item is valid for the given weapon; called on the ammo. If this, or CanChooseAmmo on the weapon, returns false, then the ammo will not be valid for this weapon. By default, returns null and allows useAmmo and ammo to decide. Return true to make the ammo valid regardless of these fields, and return false to make it invalid. If false is returned, the CanConsumeAmmo, CanBeConsumedAsAmmo, OnConsumeAmmo, and OnConsumedAsAmmo hooks are never called. Called on local and remote clients.
bool CanConsumeAmmo(Item weapon, Item ammo, Player player) hook same Whether or not the given ammo item will be consumed; called on the weapon. By default, returns true; return false to prevent ammo consumption. If false is returned, the OnConsumeAmmo and OnConsumedAsAmmo hooks are never called. Called on local, server, and remote clients.
bool CanBeConsumedAsAmmo(Item ammo, Item weapon, Player player) hook same Whether or not the given ammo item will be consumed; called on the ammo. By default, returns true; return false to prevent ammo consumption. If false is returned, the OnConsumeAmmo and OnConsumedAsAmmo hooks are never called. Called on local, server, and remote clients.
void OnConsumeAmmo(Item weapon, Item ammo, Player player) hook same Allows you to make things happen when the given ammo is consumed by the given weapon. Called by the weapon. Called before the ammo stack is reduced, and is never called if the ammo isn't consumed in the first place. Called on local, server, and remote clients.
void OnConsumedAsAmmo(Item ammo, Item weapon, Player player) hook same Allows you to make things happen when the given ammo is consumed by the given weapon. Called by the ammo. Called before the ammo stack is reduced, and is never called if the ammo isn't consumed in the first place. Called on local, server, and remote clients.
bool CanShoot(Item item, Player player) hook same Allows you to prevent an item from shooting a projectile on use. Returns true by default. Called on local, server, and remote clients.
void ModifyShootStats(Item item, Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) hook same Allows you to modify the position, velocity, type, damage and/or knockback of a projectile being shot by an item. These parameters will be provided to Shoot where the projectile will actually be spawned. Called on the local client only.
bool Shoot(Item item, Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) hook same Allows you to modify an item's shooting mechanism. Return false to prevent vanilla's shooting code from running. Returns true by default. This method is called after the ModifyShootStats hook has had a chance to adjust the spawn parameters. Called on the local client only.
void UseItemHitbox(Item item, Player player, ref Rectangle hitbox, ref bool noHitbox) hook same Changes the hitbox of a melee weapon when it is used. Called on the local client only.
void MeleeEffects(Item item, Player player, Rectangle hitbox) hook same Allows you to give melee weapons special effects, such as creating light or dust. Called on the local client only.
void ModifyItemScale(Item item, Player player, ref float scale) hook same Allows you to dynamically modify the given item's size for the given player, similarly to the effect of the Titan Glove. Do not modify scale, modify the scale parameter. Called on local and remote clients
bool CanHitNPC(Item item, Player player, NPC target) hook same Allows you to determine whether a melee weapon can hit the given NPC when swung. Return true to allow hitting the target, return false to block the weapon from hitting the target, and return null to use the vanilla code for whether the target can be hit. Returns null by default. Called on the client hitting the target.
bool CanMeleeAttackCollideWithNPC(Item item, Rectangle meleeAttackHitbox, Player player, NPC target) hook same Allows you to determine whether a melee weapon can collide with the given NPC when swung. Use CanHitNPC instead for Flymeal-type effects. Called on the client hitting the target.
void ModifyHitNPC(Item item, Player player, NPC target, ref HitModifiers modifiers) hook same Allows you to modify the damage, knockback, etc., that a melee weapon does to an NPC. Called on the client hitting the target.
void OnHitNPC(Item item, Player player, NPC target, HitInfo hit, int damageDone) hook same Allows you to create special effects when a melee weapon hits an NPC (for example how the Pumpkin Sword creates pumpkin heads). Called on the client hitting the target.
bool CanHitPvp(Item item, Player player, Player target) hook same Allows you to determine whether a melee weapon can hit the given opponent player when swung. Return false to block the weapon from hitting the target. Returns true by default. Called on the client hitting the target.
void ModifyHitPvp(Item item, Player player, Player target, ref HurtModifiers modifiers) hook same Allows you to modify the damage, etc., that a melee weapon does to a player. Called on the client taking damage.
void OnHitPvp(Item item, Player player, Player target, HurtInfo hurtInfo) hook same Allows you to create special effects when a melee weapon hits a player. Called on the client taking damage.
void UpdateEquip(Item item, Player player) hook same Allows you to give effects to armors and accessories, such as increased damage. Called on local, server, and remote clients.
void UpdateAccessory(Item item, Player player, bool hideVisual) hook same Allows you to give effects to accessories. The hideVisual parameter is whether the player has marked the accessory slot to be hidden from being drawn on the player. Called on local, server, and remote clients.
void UpdateVisibleAccessory(Item item, Player player, bool hideVisual) hook same Allows you to set custom draw flags for this accessory that can be checked in a PlayerDrawLayer or other drawcode. Not required if using pre-existing layers (e.g. face, back). hideVisual indicates if the accessory is hidden (in a non-vanity accessory slot that is set to hidden). It sounds counterintuitive for this method to be called on hidden accessories, but this can be used for effects where the visuals of an accessory should be forced despite the player hiding the accessory. For example, wings will always show while in the air and the Shield of Cthulhu will always show while its dash is active even while hidden.
void UpdateItemDye(Item item, Player player, int dye, bool hideVisual) hook same Allows tracking custom shader values corresponding to specific items or custom player layers for equipped accessories. dye is the dye of the item in the dye slot. hideVisual indicates if this item is in a non-vanity accessory slot that is set to hidden. Most implementations will not assign shaders if the accessory is hidden, but there are rare cases where it is desired to assign the shader regardless of accessory visibility. One example is Hand Of Creation, the player can disable visibility of the accessory to prevent the backpack visuals from showing, but the stool will still be properly dyed by the corresponding dye item when visible.
void UpdateInfoAccessory(Item item, Player player) hook same Allows you to set information accessory fields with the passed in player argument. This hook should only be used for information accessory fields such as the Radar, Lifeform Analyzer, and others. Using it for other fields will likely cause weird side-effects. Called on local, server, and remote clients.
void UpdateVanity(Item item, Player player) hook same Allows you to give effects to this accessory when equipped in a vanity slot. Vanilla uses this for boot effects, wings and merman/werewolf visual flags Called on local, server, and remote clients.
string IsArmorSet(Item head, Item body, Item legs) hook same Allows you to determine whether the player is wearing an armor set, and return a name for this set. If there is no armor set, return the empty string. Returns the empty string by default. This return value should then be checked for in UpdateArmorSet to provide the actual effects of the armor set. This method is not instanced. Called on local, server, and remote clients.
void UpdateArmorSet(Player player, string set) hook same Allows you to give set bonuses to your armor set with the given name. The set name will be the same as returned by IsArmorSet. This method is not instanced. Called on local, server, and remote clients.
string IsVanitySet(int head, int body, int legs) hook same Returns whether or not the head armor, body armor, and leg armor textures make up a set. This hook is used for the PreUpdateVanitySet, UpdateVanitySet, and ArmorSetShadows hooks, and will use items in the social slots if they exist. By default this will return the same value as the IsArmorSet hook, so you will not have to use this hook unless you want vanity effects to be entirely separate from armor sets. This method is not instanced. Called on local, server, and remote clients.
void PreUpdateVanitySet(Player player, string set) hook same Allows you to create special effects (such as the necro armor's hurt noise) when the player wears the vanity set with the given name returned by IsVanitySet. This hook is called regardless of whether the player is frozen in any way. This method is not instanced. Called on local, server, and remote clients.
void UpdateVanitySet(Player player, string set) hook same Allows you to create special effects (such as dust) when the player wears the vanity set with the given name returned by IsVanitySet. This hook will only be called if the player is not frozen in any way. This method is not instanced. Called on local, server, and remote clients.
void ArmorSetShadows(Player player, string set) hook same Allows you to determine special visual effects a vanity has on the player without having to code them yourself. This method is not instanced. Called on local, server, and remote clients. player.armorEffectDrawShadow = true;
void SetMatch(int armorSlot, int type, bool male, ref int equipSlot, ref bool robes) hook same Allows you to modify the equipment that the player appears to be wearing. Note that type and equipSlot are not the same as the item type of the armor the player will appear to be wearing. Worn equipment has a separate set of IDs. You can find the vanilla equipment IDs by looking at the headSlot, bodySlot, and legSlot fields for items, and modded equipment IDs by looking at EquipLoader. This method is not instanced. Called on local, server, and remote clients.
void DrawArmorColor(EquipType type, int slot, Player drawPlayer, float shadow, ref Color color, ref int glowMask, ref Color glowMaskColor) hook same Allows you to modify the colors in which the player's armor and their surrounding accessories are drawn, in addition to which glow mask and in what color is drawn. This method is not instanced. Called on local and remote clients.
void ArmorArmGlowMask(int slot, Player drawPlayer, float shadow, ref int glowMask, ref Color color) hook same Allows you to modify which glow mask and in what color is drawn on the player's arms. Note that this is only called for body armor. This method is not instanced. Called on local and remote clients.
void VerticalWingSpeeds(Item item, Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) hook same Allows you to modify the speeds at which you rise and fall when wings are equipped. Called on local, server, and remote clients.
void HorizontalWingSpeeds(Item item, Player player, ref float speed, ref float acceleration) hook same Allows you to modify the horizontal flight speed and acceleration of wings. Called on local, server, and remote clients.
bool WingUpdate(int wings, Player player, bool inUse) hook same Allows for Wings to do various things while in use. "inUse" is whether or not the jump button is currently pressed. Called when wings visually appear on the player. Use to animate wings, create dusts, invoke sounds, and create lights. False will keep everything the same. True, you need to handle all animations in your own code. This method is not instanced. Called on local, server, and remote clients.
bool CanEquipAccessory(Item item, Player player, int slot, bool modded) hook same Allows you to disallow the player from equipping an accessory. Return false to disallow equipping the accessory. Returns true by default.
bool CanAccessoryBeEquippedWith(Item equippedItem, Item incomingItem, Player player) hook same Allows you to prevent similar accessories from being equipped multiple times. For example, vanilla Wings. Return false to have the currently equipped item swapped with the incoming item - ie both can't be equipped at same time.
void GetHealLife(Item item, Player player, bool quickHeal, ref int healValue) hook same Allows you to temporarily modify the amount of life a life healing item will heal for, based on player buffs, accessories, etc. This is only called for items with a healLife value. Called on local, server, and remote clients.
void GetHealMana(Item item, Player player, bool quickHeal, ref int healValue) hook same Allows you to temporarily modify the amount of mana a mana healing item will heal for, based on player buffs, accessories, etc. This is only called for items with a healMana value. Called on local, server, and remote clients.
void ModifyPotionDelay(Item item, Player player, ref int baseDelay) hook same Allows you to dynamically modify the potion delay applied by a specific healing potion. baseDelay and PotionDelayModifier will be used to calculate a final potion delay, provided in ApplyPotionDelay. Modders can modify PotionDelayModifier directly in hooks like UpdateAccessory rather than use this hook to adjust potion delay times for all items.
bool ApplyPotionDelay(Item item, Player player, int potionDelay) hook same Called before the potion delay is applied to the player after consuming a healing potion. Return false to prevent application of the PotionSickness buff and setting potionDelay.
void Update(WorldItem item, ref float gravity, ref float maxFallSpeed) hook same Allows you to customize an item's movement when lying in the world. Note that this will not be called if the item is currently being grabbed by a player. Called on all clients and the server.
void PostUpdate(WorldItem item) hook same Allows you to make things happen when an item is lying in the world. This will always be called, even when the item is being grabbed by a player. This hook should be used for adding light, or for increasing the age of less valuable items. Called on all clients and the server.
void ExtractinatorUse(int extractType, int extractinatorBlockType, ref int resultType, ref int resultStack) hook same Allows you to modify what item, and in what quantity, is obtained when an item of the given type is fed into the Extractinator. Use ExtractinatorMode to allow an item to be fed into the Extractinator. An extractType of 0 represents the default extraction (Silt and Slush). 0, DesertFossil, OldShoe, LavaMoss, PoopBlock, Hive, and ShellPileBlock are vanilla extraction types. Modded types by convention will correspond to the iconic item of the extraction type. The Extractinator wiki page has more info. By default the parameters will be set to the output of feeding Silt/Slush into the Extractinator. Use extractinatorBlockType to provide different behavior for ChlorophyteExtractinator if desired. ExampleBlock.cs showcases using this to implement unique drops. The TorchExtractinatorGlobalItem.cs example showcases even more advanced behavior. If the Chlorophyte Extractinator item swapping behavior is desired, that is handled by ChlorophyteExtractinator instead. See the example in ExampleBar.cs. This method is not instanced. Called on the local client only.
void GrabRange(WorldItem item, Player player, ref int grabRange) hook same Allows you to modify how close an item must be to the player in order to move towards the player. Called on local, server, and remote clients.
bool GrabStyle(WorldItem item, Player player) hook same Allows you to modify the way an item moves towards the player. Return false to allow the vanilla grab style to take place. Returns false by default. Called on local, server, and remote clients.
bool CanPickup(WorldItem item, Player player) hook same Allows you to determine whether or not the item can be picked up Called on local, server, and remote clients.
bool OnPickup(WorldItem item, Player player) hook same Allows you to make special things happen when the player picks up an item. Return false to stop the item from being added to the player's inventory; returns true by default. Called on the local client only.
bool ItemSpace(Item item, Player player) hook same Return true to specify that the item can be picked up despite not having enough room in inventory. Useful for something like hearts or experience items. Use in conjunction with OnPickup to actually consume the item and handle it. Called on local, server, and remote clients.
void NetSend(Item item, BinaryWriter writer) hook same Allows you to send custom data for this item between client and server, which will be handled in NetReceive. Called whenever an item container syncs its contents (various MessageIDs and sources), or SyncItem and SpawnInstancedItem are successfully sent, for example when the item is dropped into the world. Can be called on both server and client.
void NetReceive(Item item, BinaryReader reader) hook same Receives the custom data sent in NetSend. Called whenever an item container syncs its contents (various MessageIDs and sources), or SyncItem and SpawnInstancedItem are successfully received. Can be called on both server and client.
bool AllowPrefix(Item item, int pre) hook same Force a re-roll of a prefix by returning false.
int ChoosePrefix(Item item, UnifiedRandom rand) hook same Allows you to manually choose what prefix an item will get.
bool PrefixChance(Item item, int pre, UnifiedRandom rand) hook same To prevent putting the item in the tinkerer slot, return false when pre is -3. To prevent rolling of a prefix on spawn, return false when pre is -1. To force rolling of a prefix on spawn, return true when pre is -1. To reduce the probability of a prefix on spawn (pre == -1) to X%, return false 100-4X % of the time. To increase the probability of a prefix on spawn (pre == -1) to X%, return true (4X-100)/3 % of the time. To delete a prefix from an item when the item is loaded, return false when pre is the prefix you want to delete. Use AllowPrefix to prevent rolling of a certain prefix.
bool IsAnglerQuestAvailable(int type) hook same Whether or not specific conditions have been satisfied for the Angler to be able to request the given item. (For example, Hardmode.) Returns true by default. This method is not instanced. Called on the server only.
void AnglerChat(int type, ref string chat, ref string catchLocation) hook same Allows you to set what the Angler says when the Quest button is clicked in his chat. The chat parameter is his dialogue, and catchLocation should be set to "Caught at [location]" for the given type. This method is not instanced. Called on the local client only.
bool CanRightClick(Item item) hook same Returns whether or not an item does something when right-clicked in the inventory. Returns false by default. Called on the local client only.
void RightClick(Item item, Player player) hook same Allows you to make things happen when this item is right-clicked in the inventory. By default this will consume the item by 1 stack, so return false in ConsumeItem if that behavior is undesired. This is only called if the item can be right-clicked, meaning OpenableBag is true for the item type or CanRightClick returns true. Called on the local client only.
bool ConsumeItem(Item item, Player player) hook same If the item is consumable and this returns true, then the item will be consumed upon usage. Returns true by default. If false is returned, the OnConsumeItem hook is never called. Called on the local client only.
void OnConsumeItem(Item item, Player player) hook same Allows you to make things happen when this item is consumed. Called before the item stack is reduced. Called on the local client only.
void ModifyTooltips(Item item, List<TooltipLine> tooltips) hook same Allows you to modify all the tooltips that display for the given item. See here for information about TooltipLine. To hide tooltips, please use Hide and defensive coding. Called on a clone of the item, not the original. Modifying instanced fields will have no effect. Called on the local client only.
bool PreDrawTooltip(Item item, ReadOnlyCollection<TooltipLine> lines, ref int x, ref int y) hook same Allows you to do things before this item's tooltip is drawn. Called on the local client only.
void PostDrawTooltip(Item item, ReadOnlyCollection<DrawableTooltipLine> lines) hook same Allows you to do things after this item's tooltip is drawn. The lines contain draw information as this is ran after drawing the tooltip. Called on the local client only.
bool PreDrawTooltipLine(Item item, DrawableTooltipLine line, ref int yOffset) hook same Allows you to do things before a tooltip line of this item is drawn. The line contains draw info. Called on the local client only.
void PostDrawTooltipLine(Item item, DrawableTooltipLine line) hook same Allows you to do things after a tooltip line of this item is drawn. The line contains draw info. Called on the local client only.
Color GetAlpha(Item item, Color lightColor) hook same Allows you to determine the color and transparency in which an item is drawn. Return null to use the default color (normally light color). Returns null by default. Called on all clients.
bool PreDrawInWorld(WorldItem item, SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) hook same Allows you to draw things behind this item, or to modify the way this item is drawn in the world. Return false to stop the game from drawing the item (useful if you're manually drawing the item). Note that items in the world are drawn centered horizontally sitting at the bottom of the item hitbox, not in the center of the hitbox. To replicate the normal drawing calculations, use the following and then use the spriteBatch: Called on all clients. Main.GetItemDrawFrame(Item.type, out var itemTexture, out var itemFrame); Vector2 drawOrigin = itemFrame.Size() / 2f; Vector2 drawPosition = Item.Bottom - Main.screenPosition - new Vector2(0, drawOrigin.Y); See PreDrawInInventory and PostDrawInInventory for modifying the inventory visuals and ModifyItemDraw for modifying the held item visuals. Returns true by default.
void PostDrawInWorld(WorldItem item, SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) hook same Allows you to draw things in front of this item. This method is called even if PreDrawInWorld returns false. Note that items in the world are drawn centered horizontally sitting at the bottom of the item hitbox, not in the center of the hitbox. To replicate the normal drawing calculations, use the following and then use the spriteBatch: See PreDrawInInventory and PostDrawInInventory for modifying the inventory visuals and ModifyItemDraw for modifying the held item visuals. Called on all clients. Main.GetItemDrawFrame(Item.type, out var itemTexture, out var itemFrame); Vector2 drawOrigin = itemFrame.Size() / 2f; Vector2 drawPosition = Item.Bottom - Main.screenPosition - new Vector2(0, drawOrigin.Y);
bool PreDrawInInventory(Item item, SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) hook same Allows you to draw things behind this item in the inventory. Return false to stop the game from drawing the item (useful if you're manually drawing the item). Note that position is the center of the inventory slot and origin is the center of the texture frame to be drawn, so the provided parameters can be passed into the spriteBatch to draw a texture in the typical manner. See PreDrawInWorld and PostDrawInWorld for modifying the in-world visuals and ModifyItemDraw for modifying the held item visuals. Called on the local client only. Returns true by default.
void PostDrawInInventory(Item item, SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) hook same Allows you to draw things in front of this item in the inventory. This method is called even if PreDrawInInventory returns false. Note that position is the center of the inventory slot and origin is the center of the texture frame to be drawn, so the provided parameters can be passed into the spriteBatch to draw a texture in the typical manner. See PreDrawInWorld and PostDrawInWorld for modifying the in-world visuals and ModifyItemDraw for modifying the held item visuals. Called on the local client only.
void ModifyItemLoot(Item item, ItemLoot itemLoot) hook same Allows you to add and modify the loot items that spawn from bag items when opened. The Basic NPC Drops and Loot 1.4 Guide explains how to use the ModifyNPCLoot hook to modify NPC loot as well as this hook. A common usage is to use this hook and ModifyNPCLoot to edit non-expert exclusive drops for bosses. This hook only runs once per item type during mod loading, any dynamic behavior must be contained in the rules themselves. This hook is not instanced.
bool CanConsumeBait(Player player, Item bait) hook not here Allows you to choose if a given bait will be consumed by a given player Not consuming will always take priority over forced consumption Called on the local client only.
bool CanResearch(Item item) hook not here Allows you to prevent an item from being researched by returning false. True is the default behavior. Called on the local client only.
void OnResearched(Item item, bool fullyResearched) hook not here Allows you to create custom behavior when an item is accepted by the Research function Called on the local client only.
void OnCatchNPC(Item item, NPC npc, Player player, bool failed) hook not here Allows you to make things happen when the given item attempts to catch the given NPC. Called on the local client only.
bool WingGlidingSpeeds(Item item, Player player, ref float gravityMultiplier, ref float maxSpeedMultiplier, bool prevented) hook not here Allows you to modify the speeds at which you fall when gliding with wings. Called on local, server, and remote clients. Return false to prevent vanilla gliding behavior

Item

struct Terraria.Item : IEntityWithGlobals<GlobalItem>

What Bunny Loader adds to the game's item. The game's own members, such as damage, come from the mobile game.

Member Kind tModLoader What it does
void RequestNewItem(IEntitySource source, Vector2 center, int type, int stack, int prefix, NewItemOwnership ownership) static method differs This particular overload uses an Item instead of just the item type. All modded data will be preserved. tML: void RequestNewItem(IEntitySource source, Vector2 center, Item item, NewItemOwnership ownership, Vector2 velocity, NewItemModifier modifier)
bool StopAnimationOnHurt property same When enabled and the player is hurt, channel will be set to false, and the item animation will stop immediately
void NetStateChanged() method same Call this to trigger a re-sync of this item in a player's inventory or equipment in multiplayer. The item will be sent to the server and other players at the end of the frame (not immediately). Has no effect on server-side items or items in remote player's inventories
ModItem ModItem property same The ModItem instance attached to this Item. All modded items will have an appropriate instance of the ModItem-inheriting class assigned to this field. Will be null for vanilla items. Can be used to check if an Item is a modded item or not. If you need to access members of a specific ModItem class from code outside of the ModItem, you can cast to your class: if (item.ModItem is MyItem myItem) { myItem.myField = 5; }
IReadOnlyList<GlobalItem> EntityGlobals property differs The GlobalItem instances of this item. tML: RefReadOnlyArray<GlobalItem> EntityGlobals
T GetGlobalItem<T>() method same Gets the instance of the specified GlobalItem type. This will throw exceptions on failure.
T GetGlobalItem<T>(T baseInstance) method same Gets the local instance of the type of the specified GlobalItem instance. This will throw exceptions on failure.
bool TryGetGlobalItem<T>(out T result) method same Gets the instance of the specified GlobalItem type.
WorldItem GetWorldItem() method only here This item as a WorldItem, when it lies in the world.
DamageClass DamageType property same The damage type of this Item. Assign to DamageClass.Melee/Ranged/Magic/Summon/Throwing for vanilla classes, or GetInstance for custom damage types.
bool attackSpeedOnlyAffectsWeaponAnimation property same Dictates whether or not attack speed modifiers on this weapon will actually affect its use time. Defaults to false, which allows attack speed modifiers to affect use time. Set this to true to prevent this from happening. Used in vanilla by all melee weapons which shoot a projectile and have noMelee set to false. Tools should typically set this to true to prevent the tool from mining quicker when the player has attack speed modifiers. By convention tool speed should not be affected by attack speed. They will still attack quicker, but their use time (mine/hammer/axe speed) should not be affected.
int NewItem(IEntitySource source, Rectangle rectangle, int type, int stack, int prefix, NewItemOwnership ownership) static method differs This particular overload uses a position and size to calculate the centered spawn position instead of a center parameter. tML: int NewItem(IEntitySource source, Vector2 position, Vector2 size, int type, int stack, int prefix, NewItemOwnership ownership, Vector2 velocity, NewItemModifier modifier, bool noBroadcast)
int NewItem(IEntitySource source, Vector2 position, Vector2 size, int type, int stack, int prefix, NewItemOwnership ownership) static method differs This particular overload uses a position and size to calculate the centered spawn position instead of a center parameter. tML: int NewItem(IEntitySource source, Vector2 position, Vector2 size, int type, int stack, int prefix, NewItemOwnership ownership, Vector2 velocity, NewItemModifier modifier, bool noBroadcast)
void DefaultToPlaceableWall(int wallToPlace) method differs Sets the fields of an item that places a wall. tML: void DefaultToPlaceableWall(ushort wallToPlace)
bool CountsAsClass<T>() method same Whether this item's damage counts as the class T.
bool CountsAsClass(DamageClass damageClass) method same Whether this item's damage counts as the class T.
void DefaultToTorch(int tileIDToPlace, int tileStyleToPlace, bool allowWaterPlacement) method same Sets the fields of a torch.
new Item(int setDefaultsToType, int stack, int prefix) constructor differs Creates an instance. tML: new Item()
void CloneDefaults(int TypeToClone) method same Copies the defaults of another item, keeping this item's type.
void DefaultToMusicBox(int tileIDToPlace, int style) method differs Sets the fields of an item that places a music box. tML: void DefaultToMusicBox(int style)
int ResearchUnlockCount property same A utility property for easily getting or setting the amount of items required for this item's current type to be researched. By default, all modded items will have this set to 1. Set to 0 for un-researchable items, such as items that disappear on pickup. The Journey Mode Research wiki page lists values for various types of items, use it as a guide for consistency. NOTE: The accessed values are stored per item type, not per item instance. You're recommended to only use the setter in load-time hooks, like SetStaticDefaults.

Item.NewItemModifier

struct Terraria.Item.NewItemModifier · only in Bunny Loader

Options for how a new item is created in the world, as the phone's Item.NewItem expects them.

Member Kind tModLoader What it does
void Invoke(WorldItem item) method only here Changes the item before it enters the world.

ItemCreationContext

abstract class Terraria.DataStructures.ItemCreationContext

Why an item was created. RecipeItemCreationContext is the crafting case, passed to OnCreated.

Member Kind tModLoader What it does

ItemDefinition

class Terraria.ModLoader.Config.ItemDefinition : EntityDefinition

ItemDefinition represents an Item identity. A typical use for this class is usage in ModConfig, perhaps to facilitate an Item tweaking mod.

Member Kind tModLoader What it does
Func<TagCompound, ItemDefinition> DESERIALIZER static field same Rebuilds this value from a TagCompound.
int Type override same The content ID of the content this EntityDefinition represents. Will be -1 for IsUnloaded EntityDefinition.
new ItemDefinition() constructor same Creates an instance.
new ItemDefinition(int type) constructor same Note: As ModConfig loads before other content, make sure to only use ItemDefinition for modded content in ModConfig classes.
new ItemDefinition(string key) constructor same Creates an instance.
new ItemDefinition(string mod, string name) constructor same Creates an instance.
ItemDefinition FromString(string s) static method same Builds this value from its text form.
ItemDefinition Load(TagCompound tag) static method same Rebuilds the definition from a tag.
string DisplayName override same The name shown to the player, as localized text.

ItemDropAttemptResult

struct Terraria.GameContent.ItemDropRules.ItemDropAttemptResult

The outcome of one attempt to run a drop rule.

Member Kind tModLoader What it does
ItemDropAttemptResultState State field same How the attempt ended.

ItemDropAttemptResultState

enum Terraria.GameContent.ItemDropRules.ItemDropAttemptResultState

How a drop attempt ended.

Values: DoesntFillConditions, FailedRandomRoll, Success, DidNotRunCode

ItemDropDatabase

struct Terraria.GameContent.ItemDropRules.ItemDropDatabase

The game's table of rules for each NPC and bag.

Member Kind tModLoader What it does
List<IItemDropRule> GetRulesForNPCID(int npcNetId, bool includeGlobalDrops) method same The rules of an NPC.
IItemDropRule RegisterToGlobal(IItemDropRule entry) method same Adds a rule for every NPC.
IItemDropRule RegisterToNPC(int type, IItemDropRule entry) method same Adds a rule for an NPC.
IItemDropRule RemoveFromNPC(int type, IItemDropRule entry) method same Removes a rule from an NPC.
List<IItemDropRule> GetRulesForItemID(int itemID) method only here The rules of a bag or crate.
IItemDropRule RegisterToItem(int type, IItemDropRule entry) method only here Adds a rule for a bag or crate.
IItemDropRule RemoveFromItem(int type, IItemDropRule entry) method only here Removes a rule from a bag or crate.

ItemDropResolver

struct Terraria.GameContent.ItemDropRules.ItemDropResolver

Runs the rules when something dies or a bag opens.

Member Kind tModLoader What it does
void TryDropping(DropAttemptInfo info) method same Runs every rule for this attempt.
ItemDropAttemptResult ResolveRule(IItemDropRule rule, DropAttemptInfo info) method only here Runs one rule and its chain.

ItemDropRule

static class Terraria.GameContent.ItemDropRules.ItemDropRule

Shortcuts that build the common rules, such as ItemDropRule.Common(type, 3).

Member Kind tModLoader What it does
IItemDropRule Coins(long value, bool withRandomBonus) static method only here Drops this value in coins.
IItemDropRule CoinsBasedOnNPCValue(int npcId) static method only here Drops the coins of the NPC's value.
IItemDropRule Common(int itemId, int chanceDenominator, int minimumDropped, int maximumDropped) static method same Drops an item with a 1 in chanceDenominator chance.
IItemDropRule BossBag(int itemId) static method same Drops a treasure bag for each player, in Expert and Master.
IItemDropRule BossBagByCondition(IItemDropRuleCondition condition, int itemId) static method same A BossBag that also needs a condition.
IItemDropRule ExpertGetsRerolls(int itemId, int chanceDenominator, int expertRerolls) static method same More tries in Expert.
IItemDropRule MasterModeCommonDrop(int itemId) static method same Drops only in Master.
IItemDropRule MasterModeDropOnAllPlayers(int itemId, int chanceDenominator) static method same Drops for each player, only in Master.
IItemDropRule WithRerolls(int itemId, int rerolls, int chanceDenominator, int minimumDropped, int maximumDropped) static method same Drops with extra tries.
IItemDropRule ByCondition(IItemDropRuleCondition condition, int itemId, int chanceDenominator, int minimumDropped, int maximumDropped, int chanceNumerator) static method same Drops when a condition holds.
IItemDropRule ScalingWithOnlyBadLuck(int itemId, int chanceDenominator, int minimumDropped, int maximumDropped) static method same A drop that only bad luck changes.
IItemDropRule NotScalingWithLuck(int itemId, int chanceDenominator, int minimumDropped, int maximumDropped) static method same A drop that ignores luck.
IItemDropRule OneFromOptionsNotScalingWithLuck(int chanceDenominator, params int[] options) static method same One item from a list, ignoring luck.
IItemDropRule OneFromOptionsNotScalingWithLuckWithX(int chanceDenominator, int chanceNumerator, params int[] options) static method same One item from a list, ignoring luck, with a chance of X in Y.
IItemDropRule OneFromOptions(int chanceDenominator, params int[] options) static method same One item from a list.
IItemDropRule OneFromOptionsWithNumerator(int chanceDenominator, int chanceNumerator, params int[] options) static method same One item from a list, with a chance of X in Y.
IItemDropRule DropNothing() static method same Drops nothing. Useful in a chain.
IItemDropRule Gel(int chanceDenominator, int minimumDropped, int maximumDropped) static method same Gel, with the slime's colour.
IItemDropRule NormalvsExpert(int itemId, int chanceDenominatorInNormal, int chanceDenominatorInExpert) static method same One chance in Normal, another in Expert.
IItemDropRule NormalvsExpertNotScalingWithLuck(int itemId, int chanceDenominatorInNormal, int chanceDenominatorInExpert) static method same The same, ignoring luck.
IItemDropRule NormalvsExpertOneFromOptionsNotScalingWithLuck(int chanceDenominatorInNormal, int chanceDenominatorInExpert, params int[] options) static method same One item from a list, a chance per mode, ignoring luck.
IItemDropRule NormalvsExpertOneFromOptions(int chanceDenominatorInNormal, int chanceDenominatorInExpert, params int[] options) static method same One item from a list, a chance per mode.
IItemDropRule Food(int itemId, int chanceDenominator, int minimumDropped, int maximumDropped) static method same Food, with the chance the game gives food.
IItemDropRule StatusImmunityItem(int itemId, int dropsOutOfX) static method same An immunity accessory, with the chance the game gives those.

ItemDropRuleResolveAction

delegate Terraria.GameContent.ItemDropRules.ItemDropRuleResolveAction

The method a rule chain uses to run the next rule.

Member Kind tModLoader What it does

ItemDropWithConditionRule

class Terraria.GameContent.ItemDropRules.ItemDropWithConditionRule : CommonDrop

A CommonDrop that also needs a condition.

Member Kind tModLoader What it does
new ItemDropWithConditionRule(int itemId, int chanceDenominator, int amountDroppedMinimum, int amountDroppedMaximum, IItemDropRuleCondition condition, int chanceNumerator) constructor same Creates an instance.
IItemDropRuleCondition condition property same The condition of this rule.

ItemHoldStyleID

struct Terraria.ID.ItemHoldStyleID

Values of Item.holdStyle.

Member Kind tModLoader What it does
IdDictionary Search static field only here Finds an ID by name and a name by ID.

ItemID

struct Terraria.ID.ItemID

Item types. The numbers are the game's; a mod item's type comes from ModContent.ItemType<T>().

Member Kind tModLoader What it does

ItemID.Sets

struct Terraria.ID.ItemID.Sets

Tables indexed by item type.

Member Kind tModLoader What it does
ContentTable<SandgunAmmoInfo> SandgunAmmoProjectileData static field only here The projectile and bonus damage a Sandgun gets from each ammo.
bool[] CatchingTool static property only here Catches critters.
bool[] IsAGolfClub static property only here Is a golf club.
bool[] DisableAutomaticPlaceableDrop static property only here The tile it places does not drop this item by itself.
bool[] Spears static property only here Is a spear.
bool[] PreHardmodeLikeBossBag static property same A boss bag that counts as pre-Hardmode.

ItemID.Sets.SandgunAmmoInfo

class Terraria.ID.ItemID.Sets.SandgunAmmoInfo

Used in SandgunAmmoProjectileData.

Member Kind tModLoader What it does
new SandgunAmmoInfo(int ProjectileType, int BonusDamage) constructor same Creates an instance.
int ProjectileType property same The projectile fired.
int BonusDamage property same Damage added to the shot.

ItemIO

static class Terraria.ModLoader.IO.ItemIO

Writes and reads items: Save and Load for a TagCompound, Send and Receive for packets.

Member Kind tModLoader What it does
TagCompound Save(Item item) static method same Writes an item to a tag: its mod, name, prefix, stack and data.
Item Load(TagCompound tag) static method same Rebuilds an item from a tag. An item whose mod is off comes back empty.
void Load(Item item, TagCompound tag) static method same Rebuilds an item from a tag. An item whose mod is off comes back empty.
void Send(Item item, BinaryWriter writer, bool writeStack, bool writeFavorite) static method same Writes an item to a packet.
void Receive(Item item, BinaryReader reader, bool readStack, bool readFavorite) static method same Reads an item from a packet.
Item Receive(BinaryReader reader, bool readStack, bool readFavorite) static method same Reads an item from a packet.
void SendModData(Item item, BinaryWriter writer) static method not here Not implemented. ItemIO.Send writes the mod data too.
void ReceiveModData(Item item, BinaryReader reader) static method not here Not implemented. ItemIO.Receive reads the mod data too.
string ToBase64(Item item) static method not here Not implemented.
Item FromBase64(string base64) static method not here Not implemented.

ItemLoader

static class Terraria.ModLoader.ItemLoader

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

Member Kind tModLoader What it does
int ItemCount static property same How many exist, with the game's and every mod's.
bool ReforgePrice(Item item, ref long reforgePrice, ref bool canApplyDiscount) static method same Call all ModItem.ReforgePrice, then GlobalItem.ReforgePrice hooks.
bool CanReforge(Item item) static method same Calls ModItem.CanReforge, then all GlobalItem.CanReforge hooks. If any return false then false is returned.
void PreReforge(Item item) static method same Calls ModItem.PreReforge, then all GlobalItem.PreReforge hooks.
void PostReforge(Item item) static method same Calls ModItem.PostReforge, then all GlobalItem.PostReforge hooks.
void ApplyPrefix(Item item, int pre) static method same Called immediately after prefix stat changes are applied (as well as Apply), facilitating item-specific tweaks to prefix effects.
void HoldoutOrigin(Player player, ref Vector2 origin) static method same Allows you to determine the point on this item's sprite that the player holds onto when using this item. The origin is from the bottom left corner of the sprite. This is only used for staves with a useStyle of 5. Return null to use the vanilla holdout origin (zero); returns null by default. Called on local and remote clients.
void CaughtFishStack(Item item) static method same Allows you to determine how many of this item a player obtains when the player fishes this item. Called on the local client only.
void ModifyItemDraw(Item item, PlayerDrawSet drawInfo, DrawData drawData, DrawData coloredDrawData, DrawData glowmaskDrawData) static method differs Calls GlobalItem.PreModifyItemDraw, then ModItem.ModifyItemDraw, then GlobalItem.PostModifyItemDraw. tML: void ModifyItemDraw(Item item, ref PlayerDrawSet drawInfo, DrawData drawData, DrawData coloredDrawData, DrawData glowmaskDrawData)
ModItem GetItem(int type) static method same Gets the ModItem template instance corresponding to the specified type (not the clone/new instance which gets added to Items as the game is played). Returns null if no modded item has the given type.
void IsAnglerQuestAvailable(int itemID, ref bool notAvailable) static method same Whether or not specific conditions have been satisfied for the Angler to be able to request this item. (For example, Hardmode.) Returns true by default. Called in single player or on the server only.
string AnglerChat(int type) static method same Allows you to set what the Angler says when the Quest button is clicked in his chat. The chat parameter is his dialogue, and catchLocation should be set to "Caught at [location]" for the given type. This method is not instanced. Called on the local client only.
bool CanStack(Item destination, Item source) static method same 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.
bool CanStackInWorld(WorldItem destination, WorldItem source) static method same Calls all GlobalItem.CanStackInWorld hooks until one returns false then ModItem.CanStackInWorld. Returns whether any of the hooks returned false.
void OnStack(Item destination, Item source, int numToTransfer) static method same Calls the GlobalItem.OnStack hooks in destination, then the ModItem.OnStack hook in destination OnStack is called before the items are transferred from source to destination
bool TryStackItems(Item destination, Item source, out int numTransferred, bool infiniteSource) static method same Stacks source onto destination if CanStack permits the transfer
void StackItems(Item destination, Item source, out int numTransferred, bool infiniteSource, int numToTransfer) static method same Stacks destination onto source This method should not be called unless CanStack returns true. See: TryStackItems
void SplitStack(Item destination, Item source, int numToTransfer) static method same Called when splitting a stack of items.
Item TransferWithLimit(Item source, int limit) static method same Extract up to limit items from source. If some items remain, SplitStack will be used.
int UseStyleCount static property same How many exist, with the game's and every mod's.
int RegisterUseStyle(Mod mod, string useStyleName) static method same Registers a new item use style (ItemUseStyleID). The return value is its unique ID suitable for useStyle.
bool CanConsumeBait(Player player, Item bait) static method not here Choose if this item will be consumed or not when used as bait. return null for vanilla behavior. Called on the local client only.
bool CanResearch(Item item) static method not here Hook that determines if an item will be prevented from being consumed by the research function.
void OnResearched(Item item, bool fullyResearched) static method not here Allows you to create custom behavior when an item is accepted by the Research function Called on the local client only.
void OnCatchNPC(Item item, NPC npc, Player player, bool failed) static method not here Allows you to make things happen when this item attempts to catch the given NPC. Called on the local client only.
bool WingGlidingSpeeds(Player player, ref float gravityMultiplier, ref float maxSpeedMultiplier) static method not here If the player is gliding using wings, this uses the result of GetWing, and calls ModItem.WingGlidingSpeeds then all GlobalItem.WingGlidingSpeeds hooks. Return false to prevent vanilla gliding behavior.

tModLoader's ItemLoader also has 93 public methods that only run the hooks of the same name. Here those runners are internal. Override the hook in your class instead.

ItemLoot

struct Terraria.ModLoader.ItemLoot : ILoot

Provides access to ItemDropDatabase's methods specific to this item type.

Member Kind tModLoader What it does
new ItemLoot(int itemType, ItemDropDatabase database) constructor same Creates an instance.
List<IItemDropRule> Get(bool includeGlobalDrops) method same The rules of this item.
IItemDropRule Add(IItemDropRule entry) method same Adds a rule.
IItemDropRule Remove(IItemDropRule entry) method same Removes a specific IItemDropRule from this item type. Note that entry must be an existing IItemDropRule instance retrieved from Get, not a newly created instance.
void RemoveWhere(Predicate<IItemDropRule> predicate, bool includeGlobalDrops) method same Removes the rules that match.

ItemRarityID

static class Terraria.ID.ItemRarityID

Enumerates the values used with Item.rare

Members: Master, Expert, Quest, Gray, White, Blue, Green, Orange, LightRed, Pink, LightPurple, Lime, Yellow, Cyan, Red, Purple, Count

ItemSlot

struct Terraria.UI.ItemSlot

Member Kind tModLoader What it does

ItemSlot.Context

struct Terraria.UI.ItemSlot.Context

Member Kind tModLoader What it does
int ModdedAccessorySlot const same
int ModdedVanityAccessorySlot const same
int ModdedDyeSlot const same

ItemUseStyleID

struct Terraria.ID.ItemUseStyleID

Values of Item.useStyle.

Member Kind tModLoader What it does
IdDictionary Search static field same Finds an ID by name and a name by ID.
int Count const same How many items it holds.

ModItem

abstract class Terraria.ModLoader.ModItem : ModType<Item, ModItem>

This class serves as a place for you to place all your properties and hooks for each item. To use it, simply create a new class deriving from this one. Implementations will be registered automatically. The Basic Item Guide teaches the basics of making a modded item.

Member Kind tModLoader What it does
ref Item Item property differs The item object that this ModItem controls. tML: Item Item
int Type property same Shorthand for Item.type.
string Texture hook same The file name of this type's texture file in the mod loader's file space. The resulting Asset can be retrieved using Item indexed by Type if needed. You can use a vanilla texture by returning $"Terraria/Images/Item_{ItemID.ItemNameHere}"
string LocalizationCategory hook same The folder of this content in the localization files.
LocalizedText DisplayName hook same The translations for the display name of this item.
LocalizedText Tooltip hook same The translations for the tooltip of this item.
void SetDefaults() hook same This is where you set all your item's properties, such as width, damage, shootSpeed, defense, etc. There are many properties that must be set for an item to do anything at all so it is best to consult examples, such as those in ExampleMod, to get an idea of what is required for the type of item you are making. There are many useful methods such as DefaultToPlaceableTile and DefaultToRangedWeapon to easily set the variables needed for that type of item all at once. The CloneDefaults method can be used to clone the item defaults of an item.
void AddRecipes() hook same Override this method to add Recipes to the game. Do note that this will be called for every instance of the overriding ModItem class that is added to the game. The Basic Recipes Guide teaches how to add new recipes to the game and how to manipulate existing recipes. To create a recipe resulting in this item, use CreateRecipe. To create a recipe using this item as an ingredient, use Create and then pass in this or Type into AddIngredient or AddIngredient
bool CanStack(Item source) hook same Allows you to decide if this item is allowed to stack with another of its type. This is only called when attempting to stack with an item of the same type. This is not called for coins in inventory/UI. This covers all scenarios, if you just need to change in-world stacking behavior, use CanStackInWorld. Called on local, server, and remote clients.
bool CanStackInWorld(WorldItem destination, WorldItem source) hook same Allows you to decide if this item is allowed to stack with another of its type in the world. This is only called when attempting to stack with an item of the same type. Called on the server and the owning client.
void OnStack(Item source, int numToTransfer) hook same Allows you to make things happen when items stack together. This hook is called on the item being stacked onto before the items are transferred from source. This will be called both for in-world and in-inventory stacking. Called on local, server, and remote clients.
void SplitStack(Item source, int numToTransfer) hook same Allows you to make things happen when an item stack is split. This hook is called before the stack values are modified. This item is the item clone being stacked onto from source and always has a stack of zero. Called on the local client only.
void OnSpawn(WorldItem item, IEntitySource source) hook same Gets called when your item spawns in world. Called on the local client or the server where Item.NewItem is called.
Recipe CreateRecipe(int amount) method same Creates a recipe resulting this ModItem. The amount dictates the resulting stack. This method only creates the recipe, it does not register it into the game. Call this at the very beginning when creating a new recipe.
void OnCreated(ItemCreationContext context) hook same Called when this item is created. The context parameter indicates the context of the item creation and can be used in logic for the desired effect. Called on the local client only, except during mod loading on clients and the server where it is called once for every ModItem. Known ItemCreationContext include: InitializationItemCreationContext, BuyItemCreationContext, JourneyDuplicationItemCreationContext, and RecipeItemCreationContext. Some of these provide additional context such as how RecipeItemCreationContext includes the items consumed to craft this created item.
void OnCraft(Recipe recipe) hook same Allows you to make anything happen when the player crafts this item using the given recipe.
bool ReforgePrice(ref long reforgePrice, ref bool canApplyDiscount) hook same Returns if the normal reforge pricing is applied. If true or false is returned and the price is altered, the price will equal the altered price. The passed reforge price equals the Item.value. Vanilla pricing will apply 20% discount if applicable and then price the reforge at a third of that value. Called on the local client only.
bool CanReforge() hook same This hook gets called when the player clicks on the reforge button and can afford the reforge. Returns whether the reforge will take place. If false is returned by this or any GlobalItem, the item will not be reforged, the cost to reforge will not be paid, and PreReforge and PostReforge hooks will not be called. Reforging preserves modded data on the item. Called on the local client only.
void PreReforge() hook same This hook gets called immediately before an item gets reforged by the Goblin Tinkerer. Called on the local client only.
void PostReforge() hook same This hook gets called immediately after an item gets reforged by the Goblin Tinkerer. Useful for modifying modded data based on the reforge result. Called on the local client only.
void ApplyPrefix(int pre) hook same Called immediately after prefix stat changes are applied (as well as Apply), facilitating item-specific tweaks to prefix effects.
void AutoDefaults() hook same Automatically sets certain defaults. Override this if you do not want the properties to be set for you.
Vector2 HoldoutOrigin() hook same Allows you to determine the point on this item's sprite that the player holds onto when using this item. The origin is from the bottom left corner of the sprite. This is only used for staves with a useStyle of 5. Return null to use the vanilla holdout origin (zero); returns null by default. Called on local and remote clients.
void CaughtFishStack(ref int stack) hook same Allows you to determine how many of this item a player obtains when the player fishes this item. Called on the local client only.
bool ModifyItemDraw(ref PlayerDrawSet drawInfo, ref DrawData drawData, ref DrawData coloredDrawData, ref DrawData glowMaskDrawData) hook same Allows customization of the DrawData responsible for drawing the held item. Held items are drawn as part of the player drawing process. Additional DrawData can be added to drawInfo for more advanced drawing if needed. (Add DrawData objects to DrawDataCache) drawData is the DrawData for the normal drawing. coloredDrawData is an additional drawing if color was set, overlaid over the normal drawing to tint it. glowMaskDrawData is a separate glow mask texture, if glowMask was set. Return false to stop the game from adding the drawData (and coloredDrawData and glowMaskDrawData if they are not null) to the player drawing. This is useful if manually adding drawInfo and an additional custom DrawData to properly order the custom DrawData after the normal DrawData. See PreDrawInInventory and PostDrawInInventory for modifying the inventory visuals and PreDrawInWorld and PostDrawInWorld for modifying the in-world visuals. Returns true by default.
bool CanCatchNPC(NPC target, Player player) hook same Allows you to determine whether this item can catch the given NPC. Return true or false to say the given NPC can or cannot be caught, respectively, regardless of vanilla rules. Returns null by default, which allows vanilla's NPC catching rules to decide the target's fate. If this returns false, OnCatchNPC is never called. NOTE: this does not classify the given item as an NPC-catching tool, which is necessary for catching NPCs in the first place. To do that, you will need to use CatchingTool. Called on the local client only.
ClubProperties GetGolfClubProperties() hook same Allows you to specify the ClubProperties for a custom golf club item. This hook is only called if IsAGolfClub is set to true for this item's type. Return null by default, which will result in a club that can't launch a ball. This method is not instanced. ClubProperties documentation:
bool CanUseItem(Player player) hook same Returns whether or not this item can be used. By default returns true. Called on local, server, and remote clients. The item may or not be used after this method is called, so logic in this method should have no side effects such as consuming items or resources.
bool UseItem(Player player) hook same Allows you to make things happen when this item is used. The return value controls whether or not ApplyItemTime will be called for the player. Return true if the item actually did something, to force itemTime. Return false to keep itemTime at 0. Return null for vanilla behavior. Called on local, server, and remote clients. Note the for right-click actions, this is currently only called on the local client.
void UseAnimation(Player player) hook same Allows you to make things happen when this item's use animation starts. Called on local, server, and remote clients.
bool CanAutoReuseItem(Player player) hook same Allows you to modify the autoswing (auto-reuse) behavior of this item without having to mess with Item.autoReuse. Useful to create effects like the Feral Claws which makes melee weapons and whips auto-reusable. Return true to enable autoswing (if not already enabled through autoReuse), return false to prevent autoswing. Returns null by default, which applies vanilla behavior. Called on local, server, and remote clients.
float UseTimeMultiplier(Player player) hook same Allows you to change the effective useTime of an item. Note that this hook may cause items' actions to run less or more times than they should per a single use. Called on local, server, and remote clients.
float UseAnimationMultiplier(Player player) hook same Allows you to change the effective useAnimation of an item. Note that this hook may cause items' actions to run less or more times than they should per a single use. Called on local, server, and remote clients.
float UseSpeedMultiplier(Player player) hook same Allows you to safely change both useTime and useAnimation while keeping the values relative to each other. Useful for status effects. Called on local, server, and remote clients.
void ModifyManaCost(Player player, ref float reduce, ref float mult) hook same Allows you to temporarily modify the amount of mana this item will consume on use, based on player buffs, accessories, etc. This is only called for items with a mana value. Do not modify mana, modify the reduce and mult parameters. Called on local, server, and remote clients.
void OnMissingMana(Player player, int neededMana) hook same Allows you to make stuff happen when a player doesn't have enough mana for the item they are trying to use. If the player has high enough mana after this hook runs, mana consumption will happen normally. Only runs once per item use. Called on local, server, and remote clients.
void OnConsumeMana(Player player, int manaConsumed) hook same Allows you to make stuff happen when a player consumes mana on use of this item. Called on local, server, and remote clients.
void UseItemFrame(Player player) hook same Allows you to modify the player's animation when this item is being used. Called on local, server, and remote clients.
void HoldItemFrame(Player player) hook same Allows you to modify the player's animation when the player is holding this item. Called on local, server, and remote clients.
bool AltFunctionUse(Player player) hook same Allows you to make this item usable by right-clicking. When this item is used by right-clicking, altFunctionUse will be set to 2. Check the value of altFunctionUse in UseItem to apply right-click specific logic. For auto-reusing through right clicking, see also ItemsThatAllowRepeatedRightClick. Returns false by default. Called on the local client only. Phone: In a touch profile with an aim stick, Interact switches the alternative mode and the aim stick fires it, as with the Portal Gun.
Asset<Texture2D> AltFunctionIcon(Player player, bool alternative) hook only here Icon of the Interact touch button while this item is held and its alternative use can be switched there, also shown in the touch glyph that {InputTrigger_InteractWithTile} becomes in its tooltip. alternative says which mode is on. Return null for the item's own icon; return ModContent.Request<Texture2D>("Terraria/Images/UI/ExtraIcons/ItemSwap1") for the game's swap arrows.
void HoldItem(Player player) hook same Allows you to make things happen when the player is holding this item (for example, torches make light and water candles increase spawn rate). Called on local, server, and remote clients.
void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) hook same If this item is a fishing pole, allows you to modify the origin and color of its fishing line. Called on local and remote clients.
bool IsQuestFish() hook only here Whether this fish can be an Angler quest.
bool IsAnglerQuestAvailable() hook same Whether or not specific conditions have been satisfied for the Angler to be able to request this item. (For example, Hardmode.) Returns true by default. Called in single player or on the server only.
void AnglerQuestChat(ref string description, ref string catchLocation) hook same Allows you to set what the Angler says when he requests for this item. The description parameter is his dialogue, and catchLocation should be set to "\n(Caught at [location])". Called on the local client only.
void UseStyle(Player player, Rectangle heldItemFrame) hook same Allows you to modify the location and rotation of this item in its use animation. Called on local, server, and remote clients.
void HoldStyle(Player player, Rectangle heldItemFrame) hook same Allows you to modify the location and rotation of this item when the player is holding it. Called on local, server, and remote clients.
Vector2 HoldoutOffset() hook same Allows you to determine the offset of this item's sprite when used by the player. This is only used for items with a useStyle of 5 that aren't staves. Return null to use the vanilla holdout offset; returns null by default. Called on local and remote clients.
void ModifyResearchSorting(ref ItemGroup itemGroup) hook same Allows you to set an item's sorting group in Journey Mode's duplication menu. This is useful for setting custom item types that group well together, or whenever the default vanilla sorting doesn't sort the way you want it. Note that this affects the order of the item in the listing, not which filters the item satisfies.
void UpdateInventory(Player player) hook same Allows you to make things happen when this item is in the player's inventory. This should NOT be used for information accessories; use for those instead. Called on local, server, and remote clients.
void ModifyWeaponDamage(Player player, ref StatModifier damage) hook same Allows you to dynamically modify a weapon's damage based on player and item conditions. Can be utilized to modify damage beyond the tools that DamageClass has to offer. Do not modify damage, modify the damage parameter. Called on local, server, and remote clients.
void ModifyWeaponKnockback(Player player, ref StatModifier knockback) hook same Allows you to dynamically modify a weapon's knockback based on player and item conditions. Can be utilized to modify damage beyond the tools that DamageClass has to offer. Do not modify knockBack, modify the knockback parameter. Called on the local client only.
void ModifyWeaponCrit(Player player, ref float crit) hook same Allows you to dynamically modify a weapon's crit chance based on player and item conditions. Can be utilized to modify damage beyond the tools that DamageClass has to offer. Do not modify crit, modify the crit parameter. Called on the local client only.
bool NeedsAmmo(Player player) hook same Whether or not having no ammo prevents an item that uses ammo from shooting. Return false to allow shooting with no ammo in the inventory, in which case this item will act as if the default ammo for it is being used. Returns true by default. Called on local, server, and remote clients.
void PickAmmo(Item weapon, Player player, ref int type, ref float speed, ref StatModifier damage, ref float knockback) hook same Allows you to modify various properties of the projectile created by a weapon based on the ammo it is using. This hook is called on the ammo. Called on local and remote clients when a player picking ammo but only on the local client when held projectiles are picking ammo.
bool CanChooseAmmo(Item ammo, Player player) hook same Whether or not the given ammo item is valid for this weapon. If this, or CanBeChosenAsAmmo on the ammo, returns false, then the ammo will not be valid for this weapon. By default, returns null and allows useAmmo and ammo to decide. Return true to make the ammo valid regardless of these fields, and return false to make it invalid. If false is returned, the CanConsumeAmmo, CanBeConsumedAsAmmo, OnConsumeAmmo, and OnConsumedAsAmmo hooks are never called. Called on local and remote clients.
bool CanBeChosenAsAmmo(Item weapon, Player player) hook same Whether or not this ammo item is valid for the given weapon. If this, or CanChooseAmmo on the weapon, returns false, then the ammo will not be valid for this weapon. By default, returns null and allows useAmmo and ammo to decide. Return true to make the ammo valid regardless of these fields, and return false to make it invalid. If false is returned, the CanConsumeAmmo, CanBeConsumedAsAmmo, OnConsumeAmmo, and OnConsumedAsAmmo hooks are never called. Called on local and remote clients.
bool CanConsumeAmmo(Item ammo, Player player) hook same Whether or not the given ammo item will be consumed by this weapon. By default, returns true; return false to prevent ammo consumption. If false is returned, the OnConsumeAmmo and OnConsumedAsAmmo hooks are never called. Called on local, server, and remote clients.
bool CanBeConsumedAsAmmo(Item weapon, Player player) hook same Whether or not this ammo item will be consumed by the given weapon. By default, returns true; return false to prevent ammo consumption. If false is returned, the OnConsumeAmmo and OnConsumedAsAmmo hooks are never called. Called on local, server, and remote clients.
void OnConsumeAmmo(Item ammo, Player player) hook same Allows you to make things happen when the given ammo is consumed by this weapon. Called before the ammo stack is reduced, and is never called if the ammo isn't consumed in the first place. Called on local, server, and remote clients.
void OnConsumedAsAmmo(Item weapon, Player player) hook same Allows you to make things happen when this ammo is consumed by the given weapon. Called before the ammo stack is reduced, and is never called if the ammo isn't consumed in the first place. Called on local, server, and remote clients.
bool CanShoot(Player player) hook same Allows you to prevent this item from shooting a projectile on use. Returns true by default. Called on local, server, and remote clients.
void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) hook same Allows you to modify the position, velocity, type, damage and/or knockback of a projectile being shot by this item. These parameters will be provided to Shoot where the projectile will actually be spawned. Called on the local client only.
bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) hook same Allows you to modify this item's shooting mechanism. Return false to prevent vanilla's shooting code from running. Returns true by default. This method is called after the ModifyShootStats hook has had a chance to adjust the spawn parameters. Called on the local client only.
void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) hook same Changes the hitbox of this melee weapon when it is used. Called on the local client only.
void MeleeEffects(Player player, Rectangle hitbox) hook same Allows you to give this melee weapon special effects, such as creating light or dust. Called on the local client only.
void ModifyItemScale(Player player, ref float scale) hook same Allows you to dynamically modify this item's size for the given player, similarly to the effect of the Titan Glove. Do not modify scale, modify the scale parameter. Called on local and remote clients
bool CanHitNPC(Player player, NPC target) hook same Allows you to determine whether this melee weapon can hit the given NPC when swung. Return true to allow hitting the target, return false to block this weapon from hitting the target, and return null to use the vanilla code for whether the target can be hit. Returns null by default. Called on the client hitting the target.
bool CanMeleeAttackCollideWithNPC(Rectangle meleeAttackHitbox, Player player, NPC target) hook same Allows you to determine whether a melee weapon can collide with the given NPC when swung. Use CanHitNPC instead for Flymeal-type effects. Called on the client hitting the target.
void ModifyHitNPC(Player player, NPC target, ref HitModifiers modifiers) hook same Allows you to modify the damage, knockback, etc., that this melee weapon does to an NPC. Called on the client hitting the target.
void OnHitNPC(Player player, NPC target, HitInfo hit, int damageDone) hook same Allows you to create special effects when this melee weapon hits an NPC (for example how the Pumpkin Sword creates pumpkin heads). Called on the client hitting the target.
bool CanHitPvp(Player player, Player target) hook same Allows you to determine whether this melee weapon can hit the given opponent player when swung. Return false to block this weapon from hitting the target. Returns true by default. Called on the client hitting the target.
void ModifyHitPvp(Player player, Player target, ref HurtModifiers modifiers) hook same Allows you to modify the damage, etc., that this melee weapon does to a player. Called on the client taking damage.
void OnHitPvp(Player player, Player target, HurtInfo hurtInfo) hook same Allows you to create special effects when this melee weapon hits a player. Called on the client taking damage.
void UpdateEquip(Player player) hook same Allows you to give effects to this armor or accessory, such as increased damage. Called on local, server, and remote clients.
void UpdateAccessory(Player player, bool hideVisual) hook same Allows you to give effects to this accessory. The hideVisual parameter is whether the player has marked the accessory slot to be hidden from being drawn on the player. Called on local, server, and remote clients.
void UpdateVisibleAccessory(Player player, bool hideVisual) hook same Allows you to set custom draw flags for this accessory that can be checked in a PlayerDrawLayer or other drawcode. Not required if using pre-existing layers (e.g. face, back). hideVisual indicates if the accessory is hidden (in a non-vanity accessory slot that is set to hidden). It sounds counterintuitive for this method to be called on hidden accessories, but this can be used for effects where the visuals of an accessory should be forced despite the player hiding the accessory. For example, wings will always show while in the air and the Shield of Cthulhu will always show while its dash is active even while hidden.
void UpdateItemDye(Player player, int dye, bool hideVisual) hook same Allows tracking custom shader values corresponding to specific items or custom player layers for equipped accessories. dye is the dye of the item in the dye slot. hideVisual indicates if this item is in a non-vanity accessory slot that is set to hidden. Most implementations will not assign shaders if the accessory is hidden, but there are rare cases where it is desired to assign the shader regardless of accessory visibility. One example is Hand Of Creation, the player can disable visibility of the accessory to prevent the backpack visuals from showing, but the stool will still be properly dyed by the corresponding dye item when visible.
void UpdateInfoAccessory(Player player) hook same Allows you to set information accessory fields with the passed in player argument. This hook should only be used for information accessory fields such as the Radar, Lifeform Analyzer, and others. Using it for other fields will likely cause weird side-effects. Called on local, server, and remote clients.
void UpdateVanity(Player player) hook same Allows you to give effects to this accessory when equipped in a vanity slot. Vanilla uses this for boot effects, wings and merman/werewolf visual flags Called on local, server, and remote clients.
void EquipFrameEffects(Player player, EquipType type) hook same Allows you to create special effects (such as dust) when this item's equipment texture of the given equipment type is displayed on the player. Note that this hook is only ever called through this item's associated equipment texture. Called on local, server, and remote clients.
bool IsArmorSet(Item head, Item body, Item legs) hook same Returns whether or not the head armor, body armor, and leg armor make up a set. If this returns true, then this item's UpdateArmorSet method will be called. Returns false by default. Called on local, server, and remote clients.
void UpdateArmorSet(Player player) hook same Allows you to give set bonuses to the armor set that this armor is in. Set setBonus to a string for the bonus description. Called on local, server, and remote clients.
bool IsVanitySet(int head, int body, int legs) hook same Returns whether or not the head armor, body armor, and leg armor textures make up a set. This hook is used for the PreUpdateVanitySet, UpdateVanitySet, and ArmorSetShadows hooks. By default, this will return the same value as the IsArmorSet hook (passing the equipment textures' associated items as parameters), so you will not have to use this hook unless you want vanity effects to be entirely separate from armor sets. Note that this hook is only ever called through this item's associated equipment texture. Called on local, server, and remote clients.
void PreUpdateVanitySet(Player player) hook same Allows you to create special effects (such as the necro armor's hurt noise) when the player wears this item's vanity set. This hook is called regardless of whether the player is frozen in any way. Note that this hook is only ever called through this item's associated equipment texture. Called on local, server, and remote clients.
void UpdateVanitySet(Player player) hook same Allows you to create special effects (such as dust) when the player wears this item's vanity set. This hook will only be called if the player is not frozen in any way. Note that this hook is only ever called through this item's associated equipment texture. Called on local, server, and remote clients.
void ArmorSetShadows(Player player) hook same Allows you to determine special visual effects this vanity set has on the player without having to code them yourself. Note that this hook is only ever called through this item's associated equipment texture. Use the player.armorEffectDrawX bools to activate the desired effects. Called on local, server, and remote clients. player.armorEffectDrawShadow = true;
void SetMatch(bool male, ref int equipSlot, ref bool robes) hook same Allows you to modify the equipment that the player appears to be wearing. This is most commonly used to add legs to robes and for swapping to female variant textures if male is false for head and leg armor. This hook will only be called for head armor, body armor, and leg armor. Note that equipSlot is not the same as the item type of the armor the player will appear to be wearing. Worn equipment has a separate set of IDs. You can find the vanilla equipment IDs by looking at the headSlot, bodySlot, and legSlot fields for items, and modded equipment IDs by looking at EquipLoader. If this hook is called on body armor, equipSlot allows you to modify the leg armor the player appears to be wearing. If you modify it, make sure to set robes to true. If this hook is called on leg armor, equipSlot allows you to modify the leg armor the player appears to be wearing, and the robes parameter is useless. The same is true for head armor. Note that this hook is only ever called through this item's associated equipment texture. Called on local, server, and remote clients.
void DrawArmorColor(Player drawPlayer, float shadow, ref Color color, ref int glowMask, ref Color glowMaskColor) hook same Allows you to modify the colors in which this armor and surrounding accessories are drawn, in addition to which glow mask and in what color is drawn. Note that this hook is only ever called through this item's associated equipment texture. Note that the glowMask parameter will only work with existing glowmask textures (GlowMaskID until custom glowmask support is added. You can use ModifyEquipTextureDraw and manually add a DrawData for the glowmask instead. Called on local and remote clients.
void ArmorArmGlowMask(Player drawPlayer, float shadow, ref int glowMask, ref Color color) hook same Allows you to modify which glow mask and in what color is drawn on the player's arms. Note that this is only called for body armor. Also note that this hook is only ever called through this item's associated equipment texture. Called on local and remote clients.
void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) hook same Allows you to modify the speeds at which you rise and fall when these wings are equipped. Called on local, server, and remote clients.
void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) hook same Allows you to modify these wing's horizontal flight speed and acceleration. Called on local, server, and remote clients.
bool WingUpdate(Player player, bool inUse) hook same Allows for Wings to do various things while in use. inUse is whether or not the jump button is currently pressed and there is remaining wingTime, meaning the wings are actively flying. If inUse is false but controlJump is true, the player is gliding. Called when these wings visually appear on the player. Use to animate wings, create dusts, invoke sounds, and create lights. Note that this hook is only ever called through this item's associated equipment texture. False will keep everything the same. True, you need to handle all animations in your own code. Called on local, server, and remote clients.
bool CanEquipAccessory(Player player, int slot, bool modded) hook same Allows you to disallow the player from equipping this accessory. Return false to disallow equipping this accessory. Do not use this to check for mutually exclusive accessories being equipped, that check is only possible via CanAccessoryBeEquippedWith Returns true by default.
bool CanAccessoryBeEquippedWith(Item equippedItem, Item incomingItem, Player player) hook same Allows you to prevent similar accessories from being equipped multiple times. For example, vanilla Wings. Return false to have the currently equipped item swapped with the incoming item - ie both can't be equipped at same time. This method exists because manually checking armor in CanEquipAccessory will not correctly account for modded accessory slots.
void GetHealLife(Player player, bool quickHeal, ref int healValue) hook same Allows you to temporarily modify the amount of life a life healing item will heal for, based on player buffs, accessories, etc. This is only called for items with a healLife value. Called on local, server, and remote clients.
void GetHealMana(Player player, bool quickHeal, ref int healValue) hook same Allows you to temporarily modify the amount of mana a mana healing item will heal for, based on player buffs, accessories, etc. This is only called for items with a healMana value. Called on local, server, and remote clients.
void ModifyPotionDelay(Player player, ref int baseDelay) hook same Allows you to dynamically modify the potion delay applied by a specific healing potion. baseDelay and PotionDelayModifier will be used to calculate a final potion delay, provided in ApplyPotionDelay. Modders can modify PotionDelayModifier directly in hooks like UpdateAccessory rather than use this hook to adjust potion delay times for all items.
bool ApplyPotionDelay(Player player, int potionDelay) hook same Called before the potion delay is applied to the player after consuming a healing potion. Return false to prevent application of the PotionSickness buff and setting potionDelay.
void Update(WorldItem item, ref float gravity, ref float maxFallSpeed) hook same Allows you to customize this item's movement when lying in the world. Note that this will not be called if this item is currently being grabbed by a player. Called on all clients and the server.
void PostUpdate(WorldItem item) hook same Allows you to make things happen when this item is lying in the world. This will always be called, even when it is being grabbed by a player. This hook should be used for adding light, or for increasing the age of less valuable items. Called on all clients and the server.
void ExtractinatorUse(int extractinatorBlockType, ref int resultType, ref int resultStack) hook same Allows you to modify what item, and in what quantity, is obtained when any item belonging to the extractinator type corresponding to this item is fed into the Extractinator. Use ExtractinatorMode to allow an item to be fed into the Extractinator. This method is only called if ItemID.Sets.ExtractinatorMode[Type] = Type; in used in SetStaticDefaults. Other items belonging to the same extractinator group should use ItemID.Sets.ExtractinatorMode[Type] = ModContent.ItemType<IconicItemForThisExtractinatorType>(); to indicate that they share the same extractinator output pool and to avoid code duplication. By default the parameters will be set to the output of feeding Silt/Slush into the Extractinator. Use extractinatorBlockType to provide different behavior for ChlorophyteExtractinator if desired. ExampleBlock.cs showcases using this to implement unique drops. The TorchExtractinatorGlobalItem.cs example showcases even more advanced behavior. If the Chlorophyte Extractinator item swapping behavior is desired, that is handled by ChlorophyteExtractinator instead. See the example in ExampleBar.cs. This method is not instanced. Called on the local client only.
void GrabRange(WorldItem item, Player player, ref int grabRange) hook same Allows you to modify how close this item must be to the player in order to move towards the player. Called on local, server, and remote clients.
bool GrabStyle(WorldItem item, Player player) hook same Allows you to modify the way this item moves towards the player. Return true if you override this hook; returning false will allow the vanilla grab style to take place. Returns false by default. Called on local, server, and remote clients.
bool CanPickup(WorldItem item, Player player) hook same Allows you to determine whether or not the item can be picked up Called on local, server, and remote clients.
bool OnPickup(WorldItem item, Player player) hook same Allows you to make special things happen when the player picks up this item. Return false to stop the item from being added to the player's inventory; returns true by default. Called on the local client only.
bool ModifyEquipTextureDraw(ref PlayerDrawSet drawInfo, ref DrawData drawData, EquipTexture equipTexture, string methodName) hook same Allows customization of the DrawData responsible for drawing the EquipTexture assigned to this item. Additional DrawData can be added to drawInfo for more advanced drawing if needed. methodName is the name of the method being hooked into. Some EquipType are drawn multiple times depending on layering, this provides that context if relevant. Note that this hook is only ever called through this item's associated equipment texture (ModifyDraw). This means that the Item instance is not the actual equipped item instance. If the visuals depend on item data, you'll need to store that item instance in a ModPlayer and use the data from it rather than this item. See WaspNestPlayer.strongBeesItem for an example of this. Return false to stop the game from adding the drawData to the player drawing. Returns true by default.
bool ItemSpace(Player player) hook same Return true to specify that the item can be picked up despite not having enough room in inventory. Useful for something like hearts or experience items. Use in conjunction with OnPickup to actually consume the item and handle it. Called on local, server, and remote clients.
bool MeleePrefix() hook same Allows you to change whether or not a weapon receives melee prefixes. Return true if the item should receive melee prefixes and false if it should not.
bool WeaponPrefix() hook same Allows you to change whether or not a weapon receives generic prefixes. Return true if the item should receive generic prefixes and false if it should only receive them from another category.
bool RangedPrefix() hook same Allows you to change whether or not a weapon receives ranged prefixes. Return true if the item should receive ranged prefixes and false if it should not.
bool MagicPrefix() hook same Allows you to change whether or not a weapon receives magic prefixes. Return true if the item should receive magic prefixes and false if it should not.
bool SummonPrefix() hook same Whether this item takes summon prefixes.
bool AllowPrefix(int pre) hook same Force a re-roll of a prefix by returning false.
int ChoosePrefix(UnifiedRandom rand) hook same Allows you to manually choose what prefix an item will get.
bool PrefixChance(int pre, UnifiedRandom rand) hook same To prevent putting the item in the tinkerer slot, return false when pre is -3. To prevent rolling of a prefix on spawn, return false when pre is -1. To force rolling of a prefix on spawn, return true when pre is -1. To reduce the probability of a prefix on spawn (pre == -1) to X%, return false 100-4X % of the time. To increase the probability of a prefix on spawn (pre == -1) to X%, return true (4X-100)/3 % of the time. To delete a prefix from an item when the item is loaded, return false when pre is the prefix you want to delete. Use AllowPrefix to prevent rolling of a certain prefix.
bool CanRightClick() hook same Returns whether or not this item does something when it is right-clicked in the inventory. Returns false by default. Called on the local client only.
void RightClick(Player player) hook same Allows you to make things happen when this item is right-clicked in the inventory. By default this will consume the item by 1 stack, so return false in ConsumeItem if that behavior is undesired. This is only called if the item can be right-clicked, meaning OpenableBag is true for the item type or either CanRightClick or CanRightClick return true. Called on the local client only.
bool ConsumeItem(Player player) hook same If this item is consumable and this returns true, then this item will be consumed upon usage. Returns true by default. If false is returned, the OnConsumeItem hook is never called. Called on the local client only.
void OnConsumeItem(Player player) hook same Allows you to make things happen when this item is consumed. Called before the item stack is reduced. Called on the local client only.
void ModifyTooltips(List<TooltipLine> tooltips) hook same Allows you to modify all the tooltips that display for this item. See here for information about TooltipLine. To hide tooltips, please use Hide and defensive coding. Called on a clone of the item, not the original. Modifying instanced fields will have no effect. Called on the local client only.
bool PreDrawTooltip(ReadOnlyCollection<TooltipLine> lines, ref int x, ref int y) hook same Allows you to do things before this item's tooltip is drawn. Called on the local client only.
void PostDrawTooltip(ReadOnlyCollection<DrawableTooltipLine> lines) hook same Allows you to do things after this item's tooltip is drawn. The lines contain draw information as this is ran after drawing the tooltip. Called on the local client only.
bool PreDrawTooltipLine(DrawableTooltipLine line, ref int yOffset) hook same Allows you to do things before a tooltip line of this item is drawn. The line contains draw info. Called on the local client only.
void PostDrawTooltipLine(DrawableTooltipLine line) hook same Allows you to do things after a tooltip line of this item is drawn. The line contains draw info. Called on the local client only.
Color GetAlpha(Color lightColor) hook same Allows you to determine the color and transparency in which this item is drawn. Return null to use the default color (normally light color). Returns null by default. Called on all clients.
bool PreDrawInWorld(WorldItem item, SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) hook same Allows you to draw things behind this item, or to modify the way this item is drawn in the world. Return false to stop the game from drawing the item (useful if you're manually drawing the item). Note that items in the world are drawn centered horizontally sitting at the bottom of the item hitbox, not in the center of the hitbox. To replicate the normal drawing calculations, use the following and then use the spriteBatch: Called on all clients. Main.GetItemDrawFrame(Item.type, out var itemTexture, out var itemFrame); Vector2 drawOrigin = itemFrame.Size() / 2f; Vector2 drawPosition = Item.Bottom - Main.screenPosition - new Vector2(0, drawOrigin.Y); See PreDrawInInventory and PostDrawInInventory for modifying the inventory visuals and ModifyItemDraw for modifying the held item visuals. Returns true by default.
void PostDrawInWorld(WorldItem item, SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) hook same Allows you to draw things in front of this item. This method is called even if PreDrawInWorld returns false. Note that items in the world are drawn centered horizontally sitting at the bottom of the item hitbox, not in the center of the hitbox. To replicate the normal drawing calculations, use the following and then use the spriteBatch: See PreDrawInInventory and PostDrawInInventory for modifying the inventory visuals and ModifyItemDraw for modifying the held item visuals. Called on all clients. Main.GetItemDrawFrame(Item.type, out var itemTexture, out var itemFrame); Vector2 drawOrigin = itemFrame.Size() / 2f; Vector2 drawPosition = Item.Bottom - Main.screenPosition - new Vector2(0, drawOrigin.Y);
bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) hook same Allows you to draw things behind this item in the inventory. Return false to stop the game from drawing the item (useful if you're manually drawing the item). Note that position is the center of the inventory slot and origin is the center of the texture frame to be drawn, so the provided parameters can be passed into the spriteBatch to draw a texture in the typical manner. See PreDrawInWorld and PostDrawInWorld for modifying the in-world visuals and ModifyItemDraw for modifying the held item visuals. Called on the local client only. Returns true by default.
void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) hook same Allows you to draw things in front of this item in the inventory. This method is called even if PreDrawInInventory returns false. Note that position is the center of the inventory slot and origin is the center of the texture frame to be drawn, so the provided parameters can be passed into the spriteBatch to draw a texture in the typical manner. See PreDrawInWorld and PostDrawInWorld for modifying the in-world visuals and ModifyItemDraw for modifying the held item visuals. Called on the local client only.
void NetSend(BinaryWriter writer) hook same Allows you to send custom data for this item between client and server, which will be handled in NetReceive. Called whenever an item container syncs its contents (various MessageIDs and sources), or SyncItem and SpawnInstancedItem are successfully sent, for example when the item is dropped into the world. Can be called on both server and client.
void NetReceive(BinaryReader reader) hook same Receives the custom data sent in NetSend. Called whenever an item container syncs its contents (various MessageIDs and sources), or SyncItem and SpawnInstancedItem are successfully received. Can be called on both server and client.
void SaveData(TagCompound tag) hook same Allows you to save custom data for this item. NOTE: The provided tag is always empty by default, and is provided as an argument only for the sake of convenience and optimization. NOTE: Try to only save data that isn't default values.
void LoadData(TagCompound tag) hook same Allows you to load custom data that you have saved for this item. Try to write defensive loading code that won't crash if something's missing.
void ModifyItemLoot(ItemLoot itemLoot) hook same Allows you to add and modify the loot items that spawn from bag items when opened. The Basic NPC Drops and Loot 1.4 Guide explains how to use the ModifyNPCLoot hook to modify NPC loot as well as this hook. A common usage is to use this hook and ModifyNPCLoot to edit non-expert exclusive drops for bosses. This hook only runs once during mod loading, any dynamic behavior must be contained in the rules themselves.
void AutoStaticDefaults() hook not here Automatically sets certain static defaults. Override this if you do not want the properties to be set for you.
bool CanConsumeBait(Player player) hook not here Choose if this item will be consumed or not when used as bait. return null for vanilla behavior. Called on the local client only.
bool CanResearch() hook not here Allows you to prevent an item from being researched by returning false. True is the default behavior. Called on the local client only.
void OnResearched(bool fullyResearched) hook not here Allows you to create custom behavior when an item is accepted by the Research function Called on the local client only.
void OnCatchNPC(NPC npc, Player player, bool failed) hook not here Allows you to make things happen when this item attempts to catch the given NPC. Called on the local client only.
bool WingGlidingSpeeds(Player player, ref float gravityMultiplier, ref float maxSpeedMultiplier) hook not here Allows you to modify the speed at which you fall when gliding with these wings are equipped. Called on local, server, and remote clients. Return false to prevent vanilla gliding behavior.

ModPrefix

abstract class Terraria.ModLoader.ModPrefix : ModType

Represents a modded prefix (or modifier). The Modifiers page on the Terraria wiki is a good resource for vanilla prefixes.

Member Kind tModLoader What it does
int Type property same The prefix's number.
string LocalizationCategory hook same The folder of this content in the localization files.
LocalizedText DisplayName hook same The name shown to the player, as localized text.
PrefixCategory Category hook same The category your prefix belongs to, PrefixCategory.Custom by default
float RollChance(Item item) hook same The roll chance of your prefix relative to a vanilla prefix, 1f by default.
bool CanRoll(Item item) hook same Returns if your ModPrefix can roll on the given item By default returns RollChance(item) > 0
void SetStats(ref float damageMult, ref float knockbackMult, ref float useTimeMult, ref float scaleMult, ref float shootSpeedMult, ref float manaMult, ref int critBonus) hook same Sets the stat changes for this prefix. If data is not already pre-stored, it is best to store custom data changes to some static variables. All parameters default to 1f, except critBonus which defaults to 0. It is important to remember that a prefix will only be applied to an item if every stat it affects would be changed after multiplication and rounding to the nearest integer. If a ModPrefix is not being applied to items, a multiplier might be too insignificant. The Modifiers page on the Terraria wiki has more details. Use AllStatChangesHaveEffectOn to implement that same restriction for modded stats.
bool AllStatChangesHaveEffectOn(Item item) hook same Use this to check whether modifiers to custom stats would be too small to have an effect after rounding, and prevent the prefix from being applied to the given item if there would be no change. Vanilla stat changes () are checked automatically, so there is no need to override this method to check them
void Apply(Item item) hook same Applies the custom data stats set in SetStats to the given item.
void ModifyValue(ref float valueMult) hook same Allows you to modify the sell price of the item based on the prefix or changes in custom data stats. This also influences the item's rarity.
void ApplyAccessoryEffects(Player player) hook same Use this to modify player stats (or any other applicable data) based on this ModPrefix.
IEnumerable<TooltipLine> GetTooltipLines(Item item) hook same Use this to add tooltips to any item with this prefix applied. Note that the stat bonuses applied via SetStats will automatically generate tooltips. (such as damage, use speed, crit chance, mana cost, scale, shoot speed, and knockback)

ModRarity

abstract class Terraria.ModLoader.ModRarity : ModType

A rarity of your own: its color and where it sits in the order.

Member Kind tModLoader What it does
int Type property same The rarity's number, for Item.rare.
Color RarityColor hook same Your ModRarity's color. Returns White by default.
int GetPrefixedRarity(int offset, float valueMult) hook same Allows you to modify which rarities will come before and after this when a modifier is applied (since modifiers can affect rarity)

PrefixID

struct Terraria.ID.PrefixID

The game's prefixes.

Member Kind tModLoader What it does
IdDictionary Search static field same Finds an ID by name and a name by ID.

PrefixLoader

static class Terraria.ModLoader.PrefixLoader

Finds mod prefixes and runs their hooks.

Member Kind tModLoader What it does
int VanillaCount static property only here How many exist, with the game's and every mod's.
int PrefixCount static property same How many exist, with the game's and every mod's.
ModPrefix GetPrefix(int type) static method same Returns the ModPrefix associated with specified type If not a ModPrefix, returns null.
IReadOnlyList<ModPrefix> GetPrefixesInCategory(PrefixCategory category) static method same Returns a list of all modded prefixes of a certain category.
bool Roll(Item item, UnifiedRandom unifiedRandom, out int prefix, bool justCheck) static method not here Internal here.
bool IsWeaponSubCategory(PrefixCategory category) static method not here Internal here.

tModLoader's PrefixLoader also has 2 public methods that only run the hooks of the same name. Here those runners are internal. Override the hook in your class instead.

RarityLoader

static class Terraria.ModLoader.RarityLoader

Finds mod rarities.

Member Kind tModLoader What it does
int VanillaCount const only here How many exist, with the game's and every mod's.
int RarityCount static property same How many exist, with the game's and every mod's.
ModRarity GetRarity(int type) static method same The ModRarity of a number, or null.

Recipe

struct Terraria.Recipe

A Recipe is a collection of ingredients, tiles, and a resulting Item. This is how players can craft items in the game. The Basic Recipes Guide teaches how to add new recipes to the game and how to manipulate existing recipes. Use Create to create a Recipe instance resulting in the specified item. Use AddIngredient to add ingredients and AddTile to add crafting stations. Finally, use Register to complete the recipe and register it to the game. Recipes can only be added in AddRecipes, AddRecipes, and AddRecipes. Recipes should be edited only in PostAddRecipes.

Member Kind tModLoader What it does
Mod Mod property same The mod that made the recipe.
List<Condition> Conditions property same What must hold to craft.
List<Condition> DecraftConditions property same What must hold to undo the recipe in shimmer.
int RecipeIndex property same The index of the recipe in the Main.recipe array.
bool Disabled property same Any recipe with this flag won't be shown in game.
bool DecraftDisabled property same Any recipe with this flag won't be decrafted in shimmer.
(Recipetarget, bool after) Ordering property same
Recipe Create(int result, int amount) static method same Creates a recipe resulting in the given item and amount but does not yet register it into the game. Call this at the very beginning when creating a new craft.
Recipe AddIngredient(int itemID, int stack) method same Adds an ingredient to this recipe with the given item type and stack size. Ex: recipe.AddIngredient(ItemID.IronAxe) Phone: A recipe takes at most 14 ingredients, because the game needs the last of its 15 slots empty. The 15th throws RecipeException, and Register refuses a recipe filled past that by hand.
Recipe AddIngredient(Mod mod, string itemName, int stack) method same Adds an ingredient to this recipe with the given item name from the given mod, and with the given stack stack. If the mod parameter is null, then it will automatically use an item from the mod creating this recipe. Phone: A recipe takes at most 14 ingredients, because the game needs the last of its 15 slots empty. The 15th throws RecipeException, and Register refuses a recipe filled past that by hand.
Recipe AddIngredient(ModItem item, int stack) method same Adds an ingredient to this recipe of the given type of item and stack size. Phone: A recipe takes at most 14 ingredients, because the game needs the last of its 15 slots empty. The 15th throws RecipeException, and Register refuses a recipe filled past that by hand.
Recipe AddIngredient<T>(int stack) method same Adds an ingredient to this recipe of the given type of item and stack size. Phone: A recipe takes at most 14 ingredients, because the game needs the last of its 15 slots empty. The 15th throws RecipeException, and Register refuses a recipe filled past that by hand.
Recipe AddRecipeGroup(string name, int stack) method same Adds a recipe group ingredient to this recipe with the given RecipeGroup key and stack size. This overload is intended for using modded recipe groups in situations where a reference to the RecipeGroup object itself isn't accessible, but it is usually safer to use the other overloads if at all possible. Recipe groups allow a recipe to use alternate ingredients without making multiple recipes. For example the "IronBar" group accepts either IronBar or LeadBar. The Recipe Groups wiki guide has more information. To use a vanilla recipe group, use AddRecipeGroup using a RecipeGroups entry instead.
Recipe AddRecipeGroup(int recipeGroupId, int stack) method same Adds a recipe group ingredient to this recipe with the given RegisteredId and stack size. Using the AddRecipeGroup method is usually preferred. Recipe groups allow a recipe to use alternate ingredients without making multiple recipes. For example the IronBar group accepts either IronBar or LeadBar. The Recipe Groups wiki guide has more information.
Recipe AddRecipeGroup(RecipeGroup recipeGroup, int stack) method same Adds a recipe group ingredient to this recipe with the given RecipeGroup.
Recipe AddTile<T>() method same Adds a required crafting station to this recipe of the given type of tile.
Recipe AddTile(int tileID) method same Adds a required crafting station with the given tile type to this recipe. Ex: recipe.AddTile(TileID.WorkBenches)
Recipe AddCustomShimmerResult(int itemType, int itemStack) method same What this recipe gives back in shimmer, instead of the ingredients.
Recipe AddCondition(LocalizedText description, Func<bool> condition) method same Adds a condition to craft.
Recipe AddCondition(params Condition[] conditions) method same Adds a condition to craft.
Recipe AddCondition(Condition condition) method same Adds a condition to craft.
Recipe AddCondition(IEnumerable<Condition> conditions) method same Adds a condition to craft.
Recipe AddDecraftCondition(LocalizedText description, Func<bool> condition) method same Adds a condition to undo the recipe in shimmer.
Recipe AddDecraftCondition(params Condition[] conditions) method same Adds a condition to undo the recipe in shimmer.
Recipe AddDecraftCondition(Condition condition) method same Adds a condition to undo the recipe in shimmer.
Recipe AddDecraftCondition(IEnumerable<Condition> conditions) method same Adds a condition to undo the recipe in shimmer.
Recipe ApplyConditionsAsDecraftConditions() method same Adds every condition from Recipe.Conditions to Recipe.DecraftConditions, checking for duplicates.
Recipe DisableDecraft() method same Sets a check that is used during load to prevent this being shimmered/decrafted.
Recipe AddOnCraftCallback(OnCraftCallback callback) method same Sets a callback that will allow you to make anything happen when the recipe is used to create an item.
Recipe AddConsumeItemCallback(ConsumeItemCallback callback) method same Sets a callback that allows you to determine how many of a certain ingredient is consumed when this recipe is used. Return the number of ingredients that will actually be consumed. By default returns numRequired.
Recipe AddConsumeIngredientCallback(IngredientQuantityCallback callback) method same Sets a callback that allows you to determine how many of a certain ingredient is consumed when this recipe is used. Return the number of ingredients that will actually be consumed. By default returns numRequired.
Recipe SortBeforeFirstRecipesOf(int itemId) method same Sorts the recipe before the first one creating the item of the ID given as parameter.
Recipe SortBefore(Recipe recipe) method same Sorts the recipe before the one given as parameter. Both recipes must already be registered.
Recipe SortAfterFirstRecipesOf(int itemId) method same Sorts the recipe after the first one creating the item of the ID given as parameter.
Recipe SortAfter(Recipe recipe) method same Sorts the recipe after the one given as parameter. Both recipes must already be registered.
Recipe Clone() method same Returns a clone of this recipe except the source mod of the Recipe will the currently loading mod. The clone will have to be registered after being tweaked.
Recipe Register() method same Adds this recipe to the game. Call this after you have finished setting the result, ingredients, etc.
bool HasResult(int itemID) method same Whether the recipe makes this item.
bool HasResult(ModItem item) method same Whether the recipe makes this item.
bool HasResult<T>() method same Whether the recipe makes this item.
bool HasIngredient(int itemID) method same Whether the recipe takes this item.
bool HasIngredient(ModItem item) method same Whether the recipe takes this item.
bool HasIngredient<T>() method same Whether the recipe takes this item.
bool HasRecipeGroup(int id) method same Whether the recipe takes this group.
bool HasRecipeGroup(string name) method differs Whether the recipe takes this group. tML: bool HasRecipeGroup(int id)
bool HasRecipeGroup(RecipeGroup group) method same Whether the recipe takes this group.
bool HasTile(int tileID) method same Whether the recipe needs this tile.
bool HasCondition(Condition condition) method same Whether the recipe has this condition.
bool HasShimmerCondition(Condition condition) method same Whether the recipe has this shimmer condition.
bool TryGetResult(int itemID, out Item result) method same Finds the result that is this item.
bool TryGetResult(ModItem item, out Item result) method same Finds the result that is this item.
bool TryGetResult<T>(out Item result) method same Finds the result that is this item.
bool TryGetIngredient(int itemID, out Item ingredient) method same Finds the ingredient that is this item.
bool TryGetIngredient(ModItem item, out Item ingredient) method same Finds the ingredient that is this item.
bool TryGetIngredient<T>(out Item ingredient) method same Finds the ingredient that is this item.
bool RemoveIngredient(Item item) method same Removes an ingredient.
bool RemoveIngredient(int itemID) method same Removes an ingredient.
bool RemoveTile(int tileID) method same Removes a required tile.
bool RemoveRecipeGroup(int groupID) method same Removes a group.
bool RemoveCondition(Condition condition) method same Removes a condition.
bool RemoveShimmerCondition(Condition condition) method same Removes a shimmer condition.
void DisableRecipe() method same Turns the recipe off. It stays in the list, without showing.
void ReplaceResult(int itemID, int stack) method same Changes what the recipe makes.
void ReplaceResult(ModItem item, int stack) method same Changes what the recipe makes.
void ReplaceResult<T>(int stack) method same Changes what the recipe makes.

Recipe.IngredientQuantityRules

static class Terraria.Recipe.IngredientQuantityRules

Reduces how many ingredients a recipe consumes, for AddConsumeIngredientCallback.

Member Kind tModLoader What it does
IngredientQuantityCallback Alchemy static field same Gives 1/3 chance for every ingredient to not be consumed, if used at an alchemy table. (!) This behaviour is already automatically given to all items that can be made at a placed bottle tile.

RecipeException

class Terraria.ModLoader.Exceptions.RecipeException : Exception

Thrown when a recipe is built wrongly, such as an ingredient added twice.

Member Kind tModLoader What it does
new RecipeException(string message) constructor same Creates an instance.

RecipeGroup

struct Terraria.RecipeGroup

An ingredient that accepts any item in the group, such as any wood.

Member Kind tModLoader What it does
string Key property same A unique key for this RecipeGroup.
RecipeGroup Add(int itemID) method differs Adds an item to the group. tML: RecipeGroup Add(int itemID, Func<bool> isPreferred)
RecipeGroup Register(string key, string groupDescriptorKey, params int[] validItems) static method same Creates and registers a RecipeGroup with the given key, group descriptor key, and valid items. If an existing RecipeGroup with the same key exists, the valid items will be merged into the existing group instead of creating a new one. The groupDescriptorKey is a localization key that will be interpolated into the "CombineFormat.RecipeGroup" key, which in English will result in "Any [groupDescriptorKeyValue]". To deviate from this format, use Register instead and provide a custom Func<string> getName function. The first item in the validItems array will be used as the placeholder item for the group.
RecipeGroup Register(string key, Func<string> getName, params int[] validItems) static method same Creates and registers a RecipeGroup with the given key, name function, and valid items. If an existing RecipeGroup with the same key exists, the valid items will be merged into the existing group instead of creating a new one. The getName function is the display value. When using Register the display value will automatically be "Any [groupDescriptorKeyValue]", but this function provides complete control over the display value. The first item in the validItems array will be used as the placeholder item for the group.
void AssignKeysToVanillaGroups() static method not here Internal here.

RecipeItemCreationContext

class Terraria.DataStructures.RecipeItemCreationContext : ItemCreationContext

The items used and the recipe, passed to OnCreated when an item is crafted.

Member Kind tModLoader What it does
Recipe Recipe field same The recipe used.
List<Item> ConsumedItems field same The items spent.
Item DestinationStack field same The stack the result goes into.
new RecipeItemCreationContext(Recipe recipe, List<Item> consumedItems, Item destinationStack) constructor differs Creates an instance. tML: new RecipeItemCreationContext(Recipe recipe)

RecipeLoader

static class Terraria.ModLoader.RecipeLoader

This is where all Recipe hooks are gathered and called.

Member Kind tModLoader What it does
bool RecipeAvailable(Recipe recipe) static method same Returns whether or not the conditions are met for this recipe to be available for the player to use.
bool DecraftAvailable(Recipe recipe) static method not here Returns whether or not the conditions are met for this recipe to be shimmered/decrafted.
void OnCraft(Item item, Recipe recipe, List<Item> consumedItems, Item destinationStack) static method not here recipe.OnCraftHooks followed by Calls ItemLoader.OnCreate with a RecipeItemCreationContext
void ConsumeIngredient(Recipe recipe, int type, ref int amount, bool isDecrafting) static method not here Allows to edit the amount of item the player uses in a recipe. Also used to decide the amount a shimmer transformation returns

StatModifier

struct Terraria.ModLoader.StatModifier

A stat change made of an additive part, a multiplier and flat amounts, as in player.GetDamage(DamageClass.Melee) += 0.1f.

Member Kind tModLoader What it does
StatModifier Default static field same No change.
float Base field same An offset to the base value of the stat. Directly applied to the base stat before multipliers are applied.
float Additive property same The combination of all additive multipliers. Starts at 1
float Multiplicative property same The combination of all multiplicative multipliers. Starts at 1. Applies 'after' all additive bonuses have been accumulated.
float Flat field same Increase to the final value of the stat. Directly added to the stat after multipliers are applied.
new StatModifier() constructor same Creates an instance.
new StatModifier(float additive, float multiplicative, float flat, float @base) constructor same Creates an instance.
bool Equals(object obj) override same Whether both hold the same value.
int GetHashCode() override same The hash of this value.
float ApplyTo(float baseValue) method same Use this to apply the modifiers of this StatModifier to the baseValue. You should assign the value passed in to the return result. For example: damage = CritDamage.ApplyTo(damage) could be used to apply a crit damage modifier to a base damage value Note that when using this to calculate the final damage of a DamageClass make sure to use GetTotalDamage not GetDamage to account for inherited damage modifiers such as Generic damage.
StatModifier CombineWith(StatModifier m) method same Combines the components of two StatModifiers. Typically used to apply the effects of ammo-specific StatModifier to the DamageClass StatModifier values.
StatModifier Scale(float scale) method same Scales all components of this StatModifier for the purposes of applying damage class modifier inheritance. This is NOT intended for typical modding usage, if you are looking to increase this stat by some percentage, use the addition (+) operator.
float Undo(float currentValue) method same Calculates a base value from a provided adjusted value, undoing ApplyTo.

TooltipLine

class Terraria.ModLoader.TooltipLine

This class serves as a way to store information about a line of tooltip for an item. You will create and manipulate objects of this class if you use the ModifyTooltips hook.

Member Kind tModLoader What it does
string Mod field same The name of the mod adding this tooltip line. This will be "Terraria" for all vanilla tooltip lines.
string Name field same The name of the tooltip, used to help you identify its function.
string Text field same The actual text that this tooltip displays.
bool IsModifier field only here The line describes a prefix.
bool IsModifierBad field only here The prefix line is a penalty.
Color OverrideColor field only here The line's color, instead of the default.
Color Color property same The color the tooltip is drawn in. Defaults to White. PrefixGood and PrefixBad are the colors used by prefix stat changes. The actual final color will be affected slightly by the mouse pulse effect (mouseTextColor).
bool OneDropLogo field only here The line is the One Drop logo.
bool Visible property same Whether it shows.
string FullName property same => $"{Mod}/{Name}"
new TooltipLine(Mod mod, string name, string text) constructor same Creates a tooltip line object with the given mod, identifier name, and text. These are the names of the vanilla tooltip lines, in the order in which they appear, along with their functions. All of them will have a mod name of "Terraria". Remember that most of these tooltip lines will not exist depending on the item. "ItemName" - The name of the item. "ItemLoadoutSharedFrom" - "Shared from loadout {0}" "ItemLoadoutShared" - "Shared with other loadouts" "Favorite" - Tells if the item is favorited. "FavoriteDesc" - Tells what it means when an item is favorited. "NoTransfer" - Warning that this item cannot be placed inside itself, used by Money Trough and Void Bag/Vault. "Social" - Tells if the item is in a social slot. "Damage" - The damage value and type of the weapon. "CritChance" - The critical strike chance of the weapon. "Speed" - The use speed of the weapon. "NoSpeedScaling" - Whether this item does not scale with attack speed, added by tModLoader. "SpecialSpeedScaling" - The multiplier this item applies to attack speed bonuses, added by tModLoader. "Knockback" - The knockback of the weapon. "FishingPower" - Tells the fishing power of the fishing pole. "NeedsBait" - Tells that a fishing pole requires bait. "BaitPower" - The bait power of the bait. "Equipable" - Tells that an item is equipable. "WandConsumes" - Tells what item a tile wand consumes. "Quest" - Tells that this is a quest item. "Vanity" - Tells that this is a vanity item. "Defense" - Tells how much defense the item gives when equipped. "PickPower" - The item's pickaxe power. "AxePower" - The item's axe power. "HammerPower" - The item's hammer power. "TileBoost" - How much farther the item can reach than normal items. "HealLife" - How much health the item recovers when used. "HealMana" - How much mana the item recovers when used. "Buffs" - "Press {InputTrigger_QuickBuff} to use buffs" "Healing" - "Press {InputTrigger_Healing} to use" "ManaHealing" - "Press {InputTrigger_ManaHealing} to use" "Mount" - "Press {InputTrigger_Mount} to use" "UseMana" - Tells how much mana the item consumes upon usage. "Placeable" - Tells if the item is placeable. "Ammo" - Tells if the item is ammo. "Consumable" - Tells if the item is consumable. "Material" - Tells if the item can be used to craft something. "Wireable" - Tells if the item is wireable. "Container" - The "Collects nearby dropped items when signaled" line. "WireTrigger" - The "{InputTrigger_InteractWithTile} when placed to signal" line. "Tooltip#" - A tooltip line of the item. # will be 0 for the first line, 1 for the second, etc. "WizardHatDuringAnniversary" - The "Increases your max number of minions by 1" line. "BurningBlock" - The "Burns you when touched without special protection" line. "MechSummonDuringEverything" - The "'Part of a set'" line. "MechdusaSummonNotDuringEverything" - The "'It has no effect in this world'" line. "EtherianManaWarning" - Warning about how the item can't be used without Etherian Mana until the Eternia Crystal has been defeated. "WellFedExpert" - In expert mode, tells that food increases life regeneration. "BuffTime" - Tells how long the item's buff lasts. "OneDropLogo" - The One Drop logo for yoyos.This is a specially-marked tooltip line that has no text. "Expert" - Tells whether the item is from expert-mode. "Master" - Whether the item is exclusive to Master Mode. "PrefixDamage" - The damage modifier of the prefix. "PrefixSpeed" - The usage speed modifier of the prefix. "PrefixCritChance" - The critical strike chance modifier of the prefix. "PrefixUseMana" - The mana consumption modifier of the prefix. "PrefixSize" - The melee size modifier of the prefix. "PrefixShootSpeed" - The shootSpeed modifier of the prefix. "PrefixKnockback" - The knockback modifier of the prefix. "PrefixArmorPenetration" - The armor penetration modifier of the prefix. "PrefixTagDamage" - The tag damage modifier of the prefix. "PrefixAccDefense" - The defense modifier of the accessory prefix. "PrefixAccMaxMana" - The maximum mana modifier of the accessory prefix. "PrefixAccCritChance" - The critical strike chance modifier of the accessory prefix. "PrefixAccDamage" - The damage modifier of the accessory prefix. "PrefixAccMoveSpeed" - The movement speed modifier of the accessory prefix. "PrefixAccMeleeSpeed" - The melee speed modifier of the accessory prefix. "SetBonusSinglePiece" - The set bonus description from a single piece of armor that is not equipped. "SetBonus" - The set bonus description of the armor set. "ItemLoadoutShareHint" - "{InputTriggerUI_FavoriteItem} to share across loadouts" "JourneyResearch" - How many more items need to be researched to unlock duplication in Journey Mode. "JourneyResearchTeammate" - The "Research completed by {0}" line. "ModifiedByMods" - Whether the item has been modified by any mods and what mods when holding shift, added by tModLoader. "BestiaryNotes" - Any bestiary notes, used when hovering items in the bestiary. "SpecialPrice" - Tells the alternate currency price of an item. "Price" - Tells the price of an item. "MissingRequirements" - Tells the crafting requirements not met for crafting this item.
void Hide() method same Hides the line and keeps it in the list.
string ToString() override only here The text form of this value.

← API reference  ·  NPCs →

Clone this wiki locally