tModLoader v0.11.8.9
A mod to make and play Terraria mods
ModItem.cs
Go to the documentation of this file.
1using Microsoft.Xna.Framework;
2using Microsoft.Xna.Framework.Graphics;
3using System;
4using System.Collections.Generic;
5using System.Collections.ObjectModel;
6using System.IO;
7using System.Text.RegularExpressions;
9using Terraria.Utilities;
10
11namespace Terraria.ModLoader
12{
16 public class ModItem
17 {
18 //add modItem property to Terraria.Item (internal set)
19 //set modItem to null at beginning of Terraria.Item.ResetStats
26 public Item item {
27 get;
28 internal set;
29 }
30
37 public Mod mod {
38 get;
39 internal set;
40 }
41
45 public string Name {
46 get;
47 internal set;
48 }
49
54 get;
55 internal set;
56 }
57
62 get;
63 internal set;
64 }
65
69 public virtual string Texture => (GetType().Namespace + "." + Name).Replace('.', '/');
70
71 [Obsolete("override ModItem.OnlyShootOnSwing property", true)]
72 public bool projOnSwing;
73
74 [Obsolete("override ModItem.BossBagNPC property", true)]
75 public int bossBagNPC;
76
77 [Obsolete]
78 private bool ProjOnSwing_Obsolete {
79 get => projOnSwing;
80 set => projOnSwing = value;
81 }
82
83 [Obsolete]
84 private int BossBagNPC_Obsolete {
85 get => bossBagNPC;
86 set => bossBagNPC = value;
87 }
88
89 public ModItem() {
90 item = new Item { modItem = this };
91 }
92
99 public virtual bool Autoload(ref string name) {
100 return mod.Properties.Autoload;
101 }
102
107 public virtual bool CloneNewInstances => false;
108
119 public virtual ModItem Clone() => (ModItem)MemberwiseClone();
120
127 public virtual ModItem Clone(Item item) => NewInstance(item);
128
135 public virtual ModItem NewInstance(Item itemClone) {
136 if (CloneNewInstances) {
137 var clone = Clone();
138 clone.item = itemClone;
139 return clone;
140 }
141
142 var copy = (ModItem)Activator.CreateInstance(GetType());
143 copy.item = itemClone;
144 copy.mod = mod;
145 copy.Name = Name;
146 copy.ProjOnSwing_Obsolete = ProjOnSwing_Obsolete;
147 copy.BossBagNPC_Obsolete = BossBagNPC_Obsolete;
148 return copy;
149 }
150
155 public virtual void SetDefaults() {
156 }
157
161 public virtual void AutoDefaults() {
162 EquipLoader.SetSlot(item);
163 }
164
169 public virtual void SetStaticDefaults() {
170 }
171
175 public virtual void AutoStaticDefaults() {
176 Main.itemTexture[item.type] = ModContent.GetTexture(Texture);
177
178 var flameTexture = Texture + "_Flame";
179 if (ModContent.TextureExists(flameTexture)) {
180 Main.itemFlameTexture[item.type] = ModContent.GetTexture(flameTexture);
181 Main.itemFlameLoaded[item.type] = true;
182 }
183
185 DisplayName.SetDefault(Regex.Replace(Name, "([A-Z])", " $1").Trim());
186 }
187
192 public virtual int ChoosePrefix(UnifiedRandom rand) => -1;
193
207 public virtual bool? PrefixChance(int pre, UnifiedRandom rand) => null;
208
212 public virtual bool AllowPrefix(int pre) => true;
213
218 public virtual bool CanUseItem(Player player) {
219 return true;
220 }
221
226 public virtual void UseStyle(Player player) {
227 }
228
233 public virtual void HoldStyle(Player player) {
234 }
235
240 public virtual void HoldItem(Player player) {
241 }
242
248 public virtual float UseTimeMultiplier(Player player) {
249 return 1f;
250 }
251
257 public virtual float MeleeSpeedMultiplier(Player player) {
258 return 1f;
259 }
260
267 public virtual void GetHealLife(Player player, bool quickHeal, ref int healValue) {
268 }
269
276 public virtual void GetHealMana(Player player, bool quickHeal, ref int healValue) {
277 }
278
285 public virtual void ModifyManaCost(Player player, ref float reduce, ref float mult) {
286 }
287
295 public virtual void OnMissingMana(Player player, int neededMana) {
296 }
297
303 public virtual void OnConsumeMana(Player player, int manaConsumed) {
304 }
305
315 [Obsolete("Use ModifyWeaponDamage", true)]
316 public virtual void GetWeaponDamage(Player player, ref int damage) {
317 }
318
325 [Obsolete("Use ModifyWeaponDamage overload with the additional flat parameter")]
326 public virtual void ModifyWeaponDamage(Player player, ref float add, ref float mult) {
327 }
328
336 public virtual void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) {
337 }
338
348 public virtual void GetWeaponKnockback(Player player, ref float knockback) {
349 }
350
361 public virtual void GetWeaponCrit(Player player, ref int crit) {
362 }
363
373 public virtual void PickAmmo(Item weapon, Player player, ref int type, ref float speed, ref int damage, ref float knockback) {
374 }
375
376 [Obsolete("PickAmmo now has a weapon parameter that represents the item using the ammo.")]
377 public virtual void PickAmmo(Player player, ref int type, ref float speed, ref int damage, ref float knockback) {
378 }
379
386 public virtual bool ConsumeAmmo(Player player) {
387 return true;
388 }
389
395 public virtual void OnConsumeAmmo(Player player) {
396 }
397
409 public virtual bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) {
410 return true;
411 }
412
419 public virtual void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) {
420 }
421
427 public virtual void MeleeEffects(Player player, Rectangle hitbox) {
428 }
429
436 public virtual bool? CanHitNPC(Player player, NPC target) {
437 return null;
438 }
439
448 public virtual void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) {
449 }
450
459 public virtual void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) {
460 }
461
470 public virtual bool CanHitPvp(Player player, Player target) {
471 return true;
472 }
473
481 public virtual void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) {
482 }
483
491 public virtual void OnHitPvp(Player player, Player target, int damage, bool crit) {
492 }
493
500 public virtual bool UseItem(Player player) {
501 return false;
502 }
503
510 public virtual bool ConsumeItem(Player player) {
511 return true;
512 }
513
519 public virtual void OnConsumeItem(Player player) {
520 }
521
527 public virtual bool UseItemFrame(Player player) {
528 return false;
529 }
530
536 public virtual bool HoldItemFrame(Player player) {
537 return false;
538 }
539
545 public virtual bool AltFunctionUse(Player player) {
546 return false;
547 }
548
553 public virtual void UpdateInventory(Player player) {
554 }
555
560 public virtual void UpdateEquip(Player player) {
561 }
562
568 public virtual void UpdateAccessory(Player player, bool hideVisual) {
569 }
570
576 public virtual void UpdateVanity(Player player, EquipType type) {
577 }
578
585 public virtual bool IsArmorSet(Item head, Item body, Item legs) {
586 return false;
587 }
588
593 public virtual void UpdateArmorSet(Player player) {
594 }
595
602 public virtual bool IsVanitySet(int head, int body, int legs) {
603 Item headItem = new Item();
604 if (head >= 0) {
605 headItem.SetDefaults(Item.headType[head], true);
606 }
607 Item bodyItem = new Item();
608 if (body >= 0) {
609 bodyItem.SetDefaults(Item.bodyType[body], true);
610 }
611 Item legItem = new Item();
612 if (legs >= 0) {
613 legItem.SetDefaults(Item.legType[legs], true);
614 }
615 return IsArmorSet(headItem, bodyItem, legItem);
616 }
617
622 public virtual void PreUpdateVanitySet(Player player) {
623 }
624
629 public virtual void UpdateVanitySet(Player player) {
630 }
631
637 public virtual void ArmorSetShadows(Player player) {
638 }
639
648 public virtual void SetMatch(bool male, ref int equipSlot, ref bool robes) {
649 }
650
654 public virtual bool CanRightClick() {
655 return false;
656 }
657
662 public virtual void RightClick(Player player) {
663 }
664
669 public virtual void OpenBossBag(Player player) {
670 }
671
677 public virtual bool ReforgePrice(ref int reforgePrice, ref bool canApplyDiscount) {
678 return true;
679 }
680
686 public virtual bool NewPreReforge() {
687 return true;
688 }
689
690 // @todo: PreReforge marked obsolete until v0.11
691 [method: Obsolete("PreReforge now returns a bool to control whether the reforge takes place. For now, use NewPreReforge")]
692 public virtual void PreReforge() {
693 item.modItem?.NewPreReforge();
694 }
695
700 public virtual void PostReforge() {
701 }
702
708 public virtual void DrawHands(ref bool drawHands, ref bool drawArms) {
709 }
710
716 public virtual void DrawHair(ref bool drawHair, ref bool drawAltHair) {
717 }
718
723 public virtual bool DrawHead() {
724 return true;
725 }
726
731 public virtual bool DrawBody() {
732 return true;
733 }
734
739 public virtual bool DrawLegs() {
740 return true;
741 }
742
751 public virtual void DrawArmorColor(Player drawPlayer, float shadow, ref Color color, ref int glowMask, ref Color glowMaskColor) {
752 }
753
761 public virtual void ArmorArmGlowMask(Player drawPlayer, float shadow, ref int glowMask, ref Color color) {
762 }
763
773 public virtual void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising,
774 ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) {
775 }
776
783 public virtual void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) {
784 }
785
792 public virtual bool WingUpdate(Player player, bool inUse) {
793 return false;
794 }
795
801 public virtual void Update(ref float gravity, ref float maxFallSpeed) {
802 }
803
807 public virtual bool CanBurnInLava()
808 {
809 return false;
810 }
811
815 public virtual void PostUpdate() {
816 }
817
823 public virtual void GrabRange(Player player, ref int grabRange) {
824 }
825
831 public virtual bool GrabStyle(Player player) {
832 return false;
833 }
834
839 public virtual bool CanPickup(Player player) {
840 return true;
841 }
842
848 public virtual bool OnPickup(Player player) {
849 return true;
850 }
851
857 public virtual bool ItemSpace(Player player) {
858 return false;
859 }
860
866 public virtual Color? GetAlpha(Color lightColor) {
867 return null;
868 }
869
880 public virtual bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) {
881 return true;
882 }
883
893 public virtual void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) {
894 }
895
907 public virtual bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor,
908 Color itemColor, Vector2 origin, float scale) {
909 return true;
910 }
911
922 public virtual void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor,
923 Color itemColor, Vector2 origin, float scale) {
924 }
925
930 public virtual Vector2? HoldoutOffset() {
931 return null;
932 }
933
938 public virtual Vector2? HoldoutOrigin() {
939 return null;
940 }
941
947 public virtual bool CanEquipAccessory(Player player, int slot) {
948 return true;
949 }
950
956 public virtual void ExtractinatorUse(ref int resultType, ref int resultStack) {
957 }
958
965 public virtual void AutoLightSelect(ref bool dryTorch, ref bool wetTorch, ref bool glowstick) {
966 }
967
972 public virtual void CaughtFishStack(ref int stack) {
973 }
974
978 public virtual bool IsQuestFish() {
979 return false;
980 }
981
985 public virtual bool IsAnglerQuestAvailable() {
986 return true;
987 }
988
994 public virtual void AnglerQuestChat(ref string description, ref string catchLocation) {
995 }
996
1001
1005 public virtual int BossBagNPC => BossBagNPC_Obsolete;
1006
1010 public virtual bool IgnoreDamageModifiers => false;
1011
1016 public virtual TagCompound Save() {
1017 return null;
1018 }
1019
1024 public virtual void Load(TagCompound tag) {
1025 }
1026
1031 public virtual void LoadLegacy(BinaryReader reader) {
1032 }
1033
1038 public virtual void NetSend(BinaryWriter writer) {
1039 }
1040
1045 public virtual void NetRecieve(BinaryReader reader) {
1046 }
1047
1051 public virtual void AddRecipes() {
1052 }
1053
1058 public virtual void OnCraft(Recipe recipe) {
1059 }
1060
1068 public virtual bool PreDrawTooltip(ReadOnlyCollection<TooltipLine> lines, ref int x, ref int y) {
1069 return true;
1070 }
1071
1076 public virtual void PostDrawTooltip(ReadOnlyCollection<DrawableTooltipLine> lines) {
1077 }
1078
1085 public virtual bool PreDrawTooltipLine(DrawableTooltipLine line, ref int yOffset) {
1086 return true;
1087 }
1088
1093 public virtual void PostDrawTooltipLine(DrawableTooltipLine line) {
1094 }
1095
1100 public virtual void ModifyTooltips(List<TooltipLine> tooltips) {
1101 }
1102 }
1103}
This class serves as a way to store information about a line that will be drawn of tooltip for an ite...
This serves as a central place to store equipment slots and their corresponding textures....
Definition: EquipLoader.cs:12
Manages content added by mods. Liasons between mod content and Terraria's arrays and oversees the Loa...
Definition: ModContent.cs:27
static bool TextureExists(string name)
Returns whether or not a texture with the specified name exists.
Definition: ModContent.cs:91
static Texture2D GetTexture(string name)
Gets the texture with the specified name. The name is in the format of "ModFolder/OtherFolders/FileNa...
Definition: ModContent.cs:72
Mod is an abstract class that you will override. It serves as a central place from which the mod's co...
Definition: Mod.cs:25
ModProperties Properties
Definition: Mod.cs:52
This class serves as a place for you to place all your properties and hooks for each item....
Definition: ModItem.cs:17
virtual bool PreDrawTooltip(ReadOnlyCollection< TooltipLine > lines, ref int x, ref int y)
Allows you to do things before this item's tooltip is drawn.
Definition: ModItem.cs:1068
virtual void UpdateInventory(Player player)
Allows you to make things happen when this item is in the player's inventory (for example,...
Definition: ModItem.cs:553
virtual void SetMatch(bool male, ref int equipSlot, ref bool robes)
Allows you to modify the equipment that the player appears to be wearing. This hook will only be call...
Definition: ModItem.cs:648
virtual void MeleeEffects(Player player, Rectangle hitbox)
Allows you to give this melee weapon special effects, such as creating light or dust.
Definition: ModItem.cs:427
virtual void GetWeaponKnockback(Player player, ref float knockback)
Allows you to temporarily modify this weapon's knockback based on player buffs, etc....
Definition: ModItem.cs:348
virtual void PostUpdate()
Allows you to make things happen when this item is lying in the world. This will always be called,...
Definition: ModItem.cs:815
virtual bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
Allows you to draw things behind this item in the inventory. Return false to stop the game from drawi...
Definition: ModItem.cs:907
ModTranslation Tooltip
The translations for the display name of this tooltip.
Definition: ModItem.cs:61
virtual bool DrawBody()
Return false to hide the player's body when this body armor is worn. Returns true by default....
Definition: ModItem.cs:731
virtual bool IsQuestFish()
Whether or not the Angler can ever randomly request this type of item for his daily quest....
Definition: ModItem.cs:978
virtual void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox)
Changes the hitbox of this melee weapon when it is used.
Definition: ModItem.cs:419
virtual bool CanPickup(Player player)
Allows you to determine whether or not the item can be picked up
Definition: ModItem.cs:839
virtual void PostDrawTooltipLine(DrawableTooltipLine line)
Allows you to do things after a tooltip line of this item is drawn. The line contains draw info.
Definition: ModItem.cs:1093
virtual void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration)
Allows you to modify these wing's horizontal flight speed and acceleration.
Definition: ModItem.cs:783
virtual bool GrabStyle(Player player)
Allows you to modify the way this item moves towards the player. Return true if you override this hoo...
Definition: ModItem.cs:831
Mod mod
Gets the mod.
Definition: ModItem.cs:37
virtual void GrabRange(Player player, ref int grabRange)
Allows you to modify how close this item must be to the player in order to move towards the player.
Definition: ModItem.cs:823
virtual void PickAmmo(Item weapon, Player player, ref int type, ref float speed, ref int damage, ref float knockback)
Allows you to modify the projectile created by a weapon based on the ammo it is using....
Definition: ModItem.cs:373
virtual void UpdateAccessory(Player player, bool hideVisual)
Allows you to give effects to this accessory. The hideVisual parameter is whether the player has mark...
Definition: ModItem.cs:568
virtual void DrawHands(ref bool drawHands, ref bool drawArms)
Allows you to determine whether the skin/shirt on the player's arms and hands are drawn when this bod...
Definition: ModItem.cs:708
virtual void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend)
Allows you to modify the speeds at which you rise and fall when these wings are equipped.
Definition: ModItem.cs:773
virtual float MeleeSpeedMultiplier(Player player)
Allows you to change the effective useAnimation of this item.
Definition: ModItem.cs:257
virtual bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI)
Allows you to draw things behind this item, or to modify the way this item is drawn in the world....
Definition: ModItem.cs:880
virtual bool IsArmorSet(Item head, Item body, Item legs)
Returns whether or not the head armor, body armor, and leg armor make up a set. If this returns true,...
Definition: ModItem.cs:585
virtual void AutoDefaults()
Automatically sets certain defaults. Override this if you do not want the properties to be set for yo...
Definition: ModItem.cs:161
virtual bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
This is called before the weapon creates a projectile. You can use it to create special effects,...
Definition: ModItem.cs:409
virtual ? bool PrefixChance(int pre, UnifiedRandom rand)
To prevent putting the item in the tinkerer slot, return false when pre is -3. To prevent rolling of ...
virtual void OnConsumeAmmo(Player player)
Allows you to makes things happen when ammo is consumed. Called both by the gun and by the ammo....
Definition: ModItem.cs:395
virtual bool UseItemFrame(Player player)
Allows you to modify the player's animation when this item is being used. Return true if you modify t...
Definition: ModItem.cs:527
virtual ? Vector2 HoldoutOffset()
Allows you to determine the offset of this item's sprite when used by the player. This is only used f...
Definition: ModItem.cs:930
virtual ? bool CanHitNPC(Player player, NPC target)
Allows you to determine whether this melee weapon can hit the given NPC when swung....
Definition: ModItem.cs:436
virtual bool DrawHead()
Return false to hide the player's head when this head armor is worn. Returns true by default....
Definition: ModItem.cs:723
virtual bool CloneNewInstances
Whether instances of this ModItem are created through Clone or constructor (by default implementation...
Definition: ModItem.cs:107
virtual void LoadLegacy(BinaryReader reader)
Allows you to load pre-v0.9 custom data that you have saved for this item.
Definition: ModItem.cs:1031
virtual bool CanRightClick()
Returns whether or not this item does something when it is right-clicked in the inventory....
Definition: ModItem.cs:654
virtual void HoldItem(Player player)
Allows you to make things happen when the player is holding this item (for example,...
Definition: ModItem.cs:240
virtual bool DrawLegs()
Return false to hide the player's legs when this leg armor or shoe accessory is worn....
Definition: ModItem.cs:739
virtual void NetRecieve(BinaryReader reader)
Receives the custom data sent in the NetSend hook.
Definition: ModItem.cs:1045
virtual bool NewPreReforge()
This hook gets called when the player clicks on the reforge button and can afford the reforge....
Definition: ModItem.cs:686
virtual void PostDrawTooltip(ReadOnlyCollection< DrawableTooltipLine > lines)
Allows you to do things after this item's tooltip is drawn. The lines contain draw information as thi...
Definition: ModItem.cs:1076
virtual void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
Allows you to draw things in front of this item. This method is called even if PreDrawInWorld returns...
Definition: ModItem.cs:893
virtual void AutoLightSelect(ref bool dryTorch, ref bool wetTorch, ref bool glowstick)
Allows you to tell the game whether this item is a torch that cannot be placed in liquid,...
Definition: ModItem.cs:965
virtual ModItem NewInstance(Item itemClone)
Create a new instance of this ModItem for an Item instance. Called at the end of Item....
Definition: ModItem.cs:135
virtual void OnMissingMana(Player player, int neededMana)
Allows you to make stuff happen when a player doesn't have enough mana for the item they are trying t...
Definition: ModItem.cs:295
virtual void NetSend(BinaryWriter writer)
Allows you to send custom data for this item between client and server.
Definition: ModItem.cs:1038
virtual void OnHitPvp(Player player, Player target, int damage, bool crit)
Allows you to create special effects when this melee weapon hits a player.
Definition: ModItem.cs:491
virtual void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit)
Allows you to create special effects when this melee weapon hits an NPC (for example how the Pumpkin ...
Definition: ModItem.cs:459
virtual void UpdateVanitySet(Player player)
Allows you to create special effects (such as dust) when the player wears this item's vanity set....
Definition: ModItem.cs:629
virtual bool UseItem(Player player)
Allows you to make things happen when this item is used. Return true if using this item actually does...
Definition: ModItem.cs:500
virtual bool AllowPrefix(int pre)
Force a re-roll of a prefix by returning false.
virtual void SetDefaults()
This is where you set all your item's properties, such as width, damage, shootSpeed,...
Definition: ModItem.cs:155
virtual bool OnlyShootOnSwing
Setting this to true makes it so that this weapon can shoot projectiles only at the beginning of its ...
Definition: ModItem.cs:1000
virtual bool PreDrawTooltipLine(DrawableTooltipLine line, ref int yOffset)
Allows you to do things before a tooltip line of this item is drawn. The line contains draw info.
Definition: ModItem.cs:1085
virtual bool IsVanitySet(int head, int body, int legs)
Returns whether or not the head armor, body armor, and leg armor textures make up a set....
Definition: ModItem.cs:602
virtual void Update(ref float gravity, ref float maxFallSpeed)
Allows you to customize this item's movement when lying in the world. Note that this will not be call...
Definition: ModItem.cs:801
virtual void OnCraft(Recipe recipe)
Allows you to make anything happen when the player crafts this item using the given recipe.
Definition: ModItem.cs:1058
virtual void RightClick(Player player)
Allows you to make things happen when this item is right-clicked in the inventory....
Definition: ModItem.cs:662
virtual int ChoosePrefix(UnifiedRandom rand)
Allows you to manually choose what prefix an item will get.
virtual void ModifyManaCost(Player player, ref float reduce, ref float mult)
Allows you to temporarily modify the amount of mana this item will consume on use,...
Definition: ModItem.cs:285
virtual void DrawHair(ref bool drawHair, ref bool drawAltHair)
Allows you to determine whether the player's hair or alt (hat) hair draws when this head armor is wor...
Definition: ModItem.cs:716
virtual void UpdateVanity(Player player, EquipType type)
Allows you to create special effects (such as dust) when this item's equipment texture of the given e...
Definition: ModItem.cs:576
virtual ModItem Clone(Item item)
Create a copy of this instanced ModItem. Called when an item is cloned. Defaults to NewInstance(item)
virtual bool CanEquipAccessory(Player player, int slot)
Allows you to disallow the player from equipping this accessory. Return false to disallow equipping t...
Definition: ModItem.cs:947
string Name
The internal name of this ModItem.
Definition: ModItem.cs:45
virtual void ArmorArmGlowMask(Player drawPlayer, float shadow, ref int glowMask, ref Color color)
Allows you to modify which glow mask and in what color is drawn on the player's arms....
Definition: ModItem.cs:761
virtual bool IsAnglerQuestAvailable()
Whether or not specific conditions have been satisfied for the Angler to be able to request this item...
Definition: ModItem.cs:985
virtual void UpdateEquip(Player player)
Allows you to give effects to this armor or accessory, such as increased damage.
Definition: ModItem.cs:560
virtual string Texture
The file name of this item's texture file in the mod loader's file space.
Definition: ModItem.cs:69
virtual bool CanBurnInLava()
Returns whether or not this item burns when it is thrown into lava despite item.rare not being 0....
Definition: ModItem.cs:807
virtual ? Color GetAlpha(Color lightColor)
Allows you to determine the color and transparency in which this item is drawn. Return null to use th...
Definition: ModItem.cs:866
virtual ModItem Clone()
Returns a clone of this ModItem. Allows you to decide which fields of your ModItem class are copied o...
virtual void SetStaticDefaults()
This is where you set all your item's static properties, such as names/translations and the arrays in...
Definition: ModItem.cs:169
virtual void GetHealMana(Player player, bool quickHeal, ref int healValue)
Allows you to temporarily modify the amount of mana a mana healing item will heal for,...
Definition: ModItem.cs:276
virtual bool WingUpdate(Player player, bool inUse)
Allows for Wings to do various things while in use. "inUse" is whether or not the jump button is curr...
Definition: ModItem.cs:792
virtual void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit)
Allows you to modify the damage, knockback, etc., that this melee weapon does to an NPC.
Definition: ModItem.cs:448
virtual float UseTimeMultiplier(Player player)
Allows you to change the effective useTime of this item.
Definition: ModItem.cs:248
virtual void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat)
Allows you to temporarily modify this weapon's damage based on player buffs, etc. This is useful for ...
Definition: ModItem.cs:336
virtual TagCompound Save()
Allows you to save custom data for this item. Returns null by default.
Definition: ModItem.cs:1016
virtual void Load(TagCompound tag)
Allows you to load custom data that you have saved for this item.
Definition: ModItem.cs:1024
virtual void AutoStaticDefaults()
Automatically sets certain static defaults. Override this if you do not want the properties to be set...
Definition: ModItem.cs:175
virtual void OnConsumeItem(Player player)
Allows you to make things happen when this item is consumed. Called before the item stack is reduced.
Definition: ModItem.cs:519
virtual void ModifyTooltips(List< TooltipLine > tooltips)
Allows you to modify all the tooltips that display for this item. See here for information about Tool...
Definition: ModItem.cs:1100
virtual ? Vector2 HoldoutOrigin()
Allows you to determine the point on this item's sprite that the player holds onto when using this it...
Definition: ModItem.cs:938
virtual void HoldStyle(Player player)
Allows you to modify the location and rotation of this item when the player is holding it.
Definition: ModItem.cs:233
virtual bool Autoload(ref string name)
Allows you to automatically load an item instead of using Mod.AddItem. Return true to allow autoloadi...
Definition: ModItem.cs:99
virtual void OnConsumeMana(Player player, int manaConsumed)
Allows you to make stuff happen when a player consumes mana on use of this item.
Definition: ModItem.cs:303
virtual bool ConsumeItem(Player player)
If this item is consumable and this returns true, then this item will be consumed upon usage....
Definition: ModItem.cs:510
virtual int BossBagNPC
The type of NPC that drops this boss bag. Used to determine how many coins this boss bag contains....
Definition: ModItem.cs:1005
virtual void PostReforge()
This hook gets called immediately after an item gets reforged by the Goblin Tinkerer....
Definition: ModItem.cs:700
virtual void OpenBossBag(Player player)
Allows you to give items to the given player when this item is right-clicked in the inventory if the ...
Definition: ModItem.cs:669
virtual void ExtractinatorUse(ref int resultType, ref int resultStack)
Allows you to modify what item, and in what quantity, is obtained when this item is fed into the Extr...
Definition: ModItem.cs:956
virtual void UseStyle(Player player)
Allows you to modify the location and rotation of this item in its use animation.
Definition: ModItem.cs:226
virtual void AnglerQuestChat(ref string description, ref string catchLocation)
Allows you to set what the Angler says when he requests for this item. The description parameter is h...
Definition: ModItem.cs:994
virtual void ModifyWeaponDamage(Player player, ref float add, ref float mult)
Allows you to temporarily modify this weapon's damage based on player buffs, etc. This is useful for ...
Definition: ModItem.cs:326
virtual bool ConsumeAmmo(Player player)
Whether or not ammo will be consumed upon usage. Called both by the gun and by the ammo; if at least ...
Definition: ModItem.cs:386
virtual bool AltFunctionUse(Player player)
Allows you to make this item usable by right-clicking. Returns false by default. When this item is us...
Definition: ModItem.cs:545
virtual void GetWeaponCrit(Player player, ref int crit)
Allows you to temporarily modify this weapon's crit chance based on player buffs, etc....
Definition: ModItem.cs:361
virtual void UpdateArmorSet(Player player)
Allows you to give set bonuses to the armor set that this armor is in. Set player....
Definition: ModItem.cs:593
virtual bool IgnoreDamageModifiers
Set this to true to prevent this weapon or ammo item from being adjusted by damage modifiers.
Definition: ModItem.cs:1010
virtual void DrawArmorColor(Player drawPlayer, float shadow, ref Color color, ref int glowMask, ref Color glowMaskColor)
Allows you to modify the colors in which this armor and surrounding accessories are drawn,...
Definition: ModItem.cs:751
virtual void ArmorSetShadows(Player player)
Allows you to determine special visual effects this vanity set has on the player without having to co...
Definition: ModItem.cs:637
virtual void AddRecipes()
This is essentially the same as Mod.AddRecipes. Do note that this will be called for every instance o...
Definition: ModItem.cs:1051
Item item
The item object that this ModItem controls.
Definition: ModItem.cs:26
virtual void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit)
Allows you to modify the damage, etc., that this melee weapon does to a player.
Definition: ModItem.cs:481
virtual void PickAmmo(Player player, ref int type, ref float speed, ref int damage, ref float knockback)
Definition: ModItem.cs:377
virtual bool ItemSpace(Player player)
Return true to specify that the item can be picked up despite not having enough room in inventory....
Definition: ModItem.cs:857
virtual bool HoldItemFrame(Player player)
Allows you to modify the player's animation when the player is holding this item. Return true if you ...
Definition: ModItem.cs:536
virtual void PreUpdateVanitySet(Player player)
Allows you to create special effects (such as the necro armor's hurt noise) when the player wears thi...
Definition: ModItem.cs:622
virtual bool ReforgePrice(ref int reforgePrice, ref bool canApplyDiscount)
Returns if the normal reforge pricing is applied. If true or false is returned and the price is alter...
Definition: ModItem.cs:677
virtual void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
Allows you to draw things in front of this item in the inventory. This method is called even if PreDr...
Definition: ModItem.cs:922
virtual void CaughtFishStack(ref int stack)
Allows you to determine how many of this item a player obtains when the player fishes this item.
Definition: ModItem.cs:972
ModTranslation DisplayName
The translations for the display name of this item.
Definition: ModItem.cs:53
virtual bool CanUseItem(Player player)
Returns whether or not this item can be used. By default returns true.
Definition: ModItem.cs:218
virtual void GetWeaponDamage(Player player, ref int damage)
Allows you to temporarily modify this weapon's damage based on player buffs, etc. This is useful for ...
Definition: ModItem.cs:316
virtual bool OnPickup(Player player)
Allows you to make special things happen when the player picks up this item. Return false to stop the...
Definition: ModItem.cs:848
virtual bool CanHitPvp(Player player, Player target)
Allows you to determine whether this melee weapon can hit the given opponent player when swung....
Definition: ModItem.cs:470
virtual void GetHealLife(Player player, bool quickHeal, ref int healValue)
Allows you to temporarily modify the amount of life a life healing item will heal for,...
Definition: ModItem.cs:267
virtual void PreReforge()
Definition: ModItem.cs:692
EquipType
This is an enum of all the types of equipment that exist. An equipment type is defined as a type or l...
Definition: EquipType.cs:7
bool Autoload
Whether or not this mod will autoload content by default. Autoloading content means you do not need t...