tModLoader v2022.09
A mod to make and play Terraria mods
|
Inherits Terraria.ModLoader.ModPlayer.
Public Member Functions | |
override IEnumerable< Item > | AddStartingItems (bool mediumCoreDeath) |
Called when the player is created in the menu. You can use this method to add items to the player's starting inventory, as well as their inventory when they respawn in mediumcore. More... | |
override void | Initialize () |
Called whenever the player is loaded (on the player selection screen). This can be used to initialize data structures, etc. More... | |
override void | LoadData (TagCompound tag) |
Allows you to load custom data that you have saved for this player. Try to write defensive loading code that won't crash if something's missing. More... | |
override void | SaveData (TagCompound tag) |
Allows you to save custom data for this player. 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. More... | |
Public Member Functions inherited from Terraria.ModLoader.ModPlayer | |
virtual IEnumerable< Item > | AddStartingItems (bool mediumCoreDeath) |
Called when the player is created in the menu. You can use this method to add items to the player's starting inventory, as well as their inventory when they respawn in mediumcore. More... | |
virtual void | AnglerQuestReward (float rareMultiplier, List< Item > rewardItems) |
Allows you to add to, change, or remove from the items the player earns when finishing an Angler quest. The rareMultiplier is a number between 0.15 and 1 inclusively; the lower it is the higher chance there should be for the player to earn rare items. More... | |
virtual ? bool | CanAutoReuseItem (Item item) |
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. More... | |
virtual bool | CanBeHitByNPC (NPC npc, ref int cooldownSlot) |
Allows you to determine whether the given NPC can hit this player. Return false to block this player from being hit by the NPC. Returns true by default. CooldownSlot determines which of the player's cooldown counters to use (-1, 0, or 1), and defaults to -1. More... | |
virtual bool | CanBeHitByProjectile (Projectile proj) |
Allows you to determine whether the given hostile projectile can hit this player. Return false to block this player from being hit. Returns true by default. More... | |
virtual bool | CanBuyItem (NPC vendor, Item[] shopInventory, Item item) |
Return false to prevent a transaction. Called before the transaction. More... | |
virtual ? bool | CanCatchNPC (NPC target, Item item) |
Allows you to determine whether the given item can catch the given NPC. Return true or false to say the target 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, CombinedHooks.OnCatchNPC is never called. NOTE: this does not classify the given item as a catch tool, which is necessary for catching NPCs in the first place. To do that, you will need to use the "CatchingTool" set in ItemID.Sets. More... | |
virtual bool | CanConsumeAmmo (Item weapon, Item ammo) |
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 hook is never called. More... | |
virtual ? bool | CanConsumeBait (Item bait) |
Choose if this bait will be consumed or not when used for fishing. return null for vanilla behaviour. Not consuming will always take priority over forced consumption More... | |
virtual ? bool | CanHitNPC (Item item, NPC target) |
Allows you to determine whether a player can hit the given NPC by swinging a melee weapon. Return true to allow hitting the target, return false to block this player from hitting the target, and return null to use the vanilla code for whether the target can be hit. Returns null by default. More... | |
virtual ? bool | CanHitNPCWithProj (Projectile proj, NPC target) |
Allows you to determine whether a projectile created by this player can hit the given NPC. Return true to allow hitting the target, return false to block this projectile from hitting the target, and return null to use the vanilla code for whether the target can be hit. Returns null by default. More... | |
virtual bool | CanHitPvp (Item item, Player target) |
Allows you to determine whether a melee weapon swung by this player can hit the given opponent player. Return false to block this weapon from hitting the target. Returns true by default. More... | |
virtual bool | CanHitPvpWithProj (Projectile proj, Player target) |
Allows you to determine whether a projectile created by this player can hit the given opponent player. Return false to block the projectile from hitting the target. Returns true by default. More... | |
virtual bool | CanSellItem (NPC vendor, Item[] shopInventory, Item item) |
Return false to prevent a transaction. Called before the transaction. More... | |
virtual bool | CanShoot (Item item) |
Allows you to prevent an item from shooting a projectile on use. Returns true by default. More... | |
virtual bool | CanUseItem (Item item) |
Return false to prevent an item from being used. By default returns true. More... | |
virtual void | CatchFish (FishingAttempt attempt, ref int itemDrop, ref int npcSpawn, ref AdvancedPopupRequest sonar, ref Vector2 sonarPosition) |
Allows you to change the item or enemy the player gets when sucessfully catching an item or NPC. The Fishing Attempt structure contains most information about the vanilla event, including the Item Rod and Bait used by the player, the liquid it is being fished on, and so on. The Sonar and Sonar position fields allow you to change the text, color, velocity and position of the catch's name (be it item or NPC) freely More... | |
virtual void | clientClone (ModPlayer clientClone) |
Allows you to copy information about this player to the clientClone parameter. You should copy information that you intend to sync between server and client. This hook is called in the Player.clientClone method. See SendClientChanges for more info. More... | |
virtual void | DrawEffects (PlayerDrawSet drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright) |
Allows you to create special effects when this player is drawn, such as creating dust, modifying the color the player is drawn in, etc. The fullBright parameter makes it so that the drawn player ignores the modified color and lighting. Note that the fullBright parameter only works if r, g, b, and/or a is not equal to 1. Make sure to add the indexes of any dusts you create to drawInfo.DustCache, and the indexes of any gore you create to drawInfo.GoreCache. This will be called multiple times a frame if a player afterimage is being drawn. Check More... | |
virtual void | FrameEffects () |
Allows you to modify the armor and accessories that visually appear on the player. In addition, you can create special effects around this character, such as creating dust. | |
virtual void | GetDyeTraderReward (List< int > rewardPool) |
Allows you to modify what items are possible for the player to earn when giving a Strange Plant to the Dye Trader. More... | |
virtual void | GetFishingLevel (Item fishingRod, Item bait, ref float fishingLevel) |
Allows you to modify the player's fishing power. As an example of the type of stuff that should go here, the phase of the moon can influence fishing power. More... | |
virtual void | GetHealLife (Item item, bool quickHeal, ref int healValue) |
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. More... | |
virtual void | GetHealMana (Item item, bool quickHeal, ref int healValue) |
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. More... | |
virtual void | HideDrawLayers (PlayerDrawSet drawInfo) |
Allows you to modify the visibility of layers about to be drawn More... | |
virtual bool | HoverSlot (Item[] inventory, int context, int slot) |
Called whenever the player hovers over an item slot. This can be used to override Main.cursorOverride See ID.CursorOverrideID for cursor override style IDs More... | |
virtual void | Hurt (bool pvp, bool quiet, double damage, int hitDirection, bool crit) |
virtual void | Hurt (bool pvp, bool quiet, double damage, int hitDirection, bool crit, int cooldownCounter) |
Allows you to make anything happen right before damage is subtracted from the player's health. More... | |
virtual void | Initialize () |
Called whenever the player is loaded (on the player selection screen). This can be used to initialize data structures, etc. More... | |
virtual void | Kill (double damage, int hitDirection, bool pvp, PlayerDeathReason damageSource) |
Allows you to make anything happen when the player dies. More... | |
virtual void | LoadData (TagCompound tag) |
Allows you to load custom data that you have saved for this player. Try to write defensive loading code that won't crash if something's missing. More... | |
virtual void | MeleeEffects (Item item, Rectangle hitbox) |
Allows you to give this player's melee weapon special effects, such as creating light or dust. More... | |
virtual void | ModifyCaughtFish (Item fish) |
Allows you to modify the item caught by the fishing player, including stack More... | |
virtual void | ModifyDrawInfo (ref PlayerDrawSet drawInfo) |
Allows you to modify the drawing parameters of the player before drawing begins. More... | |
virtual void | ModifyDrawLayerOrdering (IDictionary< PlayerDrawLayer, PlayerDrawLayer.Position > positions) |
Allows you to reorder the player draw layers. This is called once at the end of mod loading, not during the game. Use with extreme caution, or risk breaking other mods. More... | |
virtual void | ModifyFishingAttempt (ref FishingAttempt attempt) |
Allows you to change information about the ongoing fishing attempt before cought items/NPCs are decided, after all vanilla information has been gathered. Will not be called if various conditions for getting a catch aren't met, meaning you can't modify those. Setting FishingAttempt.rolledItemDrop or FishingAttempt.rolledEnemySpawn is not allowed and will be reset, use CatchFish for that. More... | |
virtual void | ModifyHitByNPC (NPC npc, ref int damage, ref bool crit) |
Allows you to modify the damage, etc., that an NPC does to this player. More... | |
virtual void | ModifyHitByProjectile (Projectile proj, ref int damage, ref bool crit) |
Allows you to modify the damage, etc., that a hostile projectile does to this player. More... | |
virtual void | ModifyHitNPC (Item item, NPC target, ref int damage, ref float knockback, ref bool crit) |
Allows you to modify the damage, knockback, etc., that this player does to an NPC by swinging a melee weapon. More... | |
virtual void | ModifyHitNPCWithProj (Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) |
Allows you to modify the damage, knockback, etc., that a projectile created by this player does to an NPC. More... | |
virtual void | ModifyHitPvp (Item item, Player target, ref int damage, ref bool crit) |
Allows you to modify the damage, etc., that a melee weapon swung by this player does to an opponent player. More... | |
virtual void | ModifyHitPvpWithProj (Projectile proj, Player target, ref int damage, ref bool crit) |
Allows you to modify the damage, etc., that a projectile created by this player does to an opponent player. More... | |
virtual void | ModifyItemScale (Item item, ref float scale) |
Allows you to dynamically modify the given item's size for this player, similarly to the effect of the Titan Glove. More... | |
virtual void | ModifyLuck (ref float luck) |
Allows you to modify a player's luck amount. More... | |
virtual void | ModifyManaCost (Item item, ref float reduce, ref float mult) |
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. More... | |
virtual bool | ModifyNurseHeal (NPC nurse, ref int health, ref bool removeDebuffs, ref string chatText) |
Called on the Client while the nurse chat is displayed. Return false to prevent the player from healing. If you return false, you need to set chatText so the user knows why they can't heal. More... | |
virtual void | ModifyNursePrice (NPC nurse, int health, bool removeDebuffs, ref int price) |
Called on the Client while the nurse chat is displayed and after ModifyNurseHeal. Allows custom pricing for Nurse services. See https://terraria.gamepedia.com/Nurse for the default pricing. More... | |
virtual void | ModifyScreenPosition () |
Use this hook to modify Main.screenPosition after weapon zoom and camera lerp have taken place. | |
virtual void | ModifyShootStats (Item item, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) |
Allows you to modify the position, velocity, type, damage and/or knockback of a projectile being shot by an item. More... | |
virtual void | ModifyStartingInventory (IReadOnlyDictionary< string, List< Item > > itemsByMod, bool mediumCoreDeath) |
Allows you to modify the items that will be added to the player's inventory. Useful if you want to stop vanilla or other mods from adding an item. You can access a mod's items by using the mod's internal name as the indexer, such as: additions["ModName"]. To access vanilla items you can use "Terraria" as the index. More... | |
virtual void | ModifyWeaponCrit (Item item, ref float crit) |
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. More... | |
virtual void | ModifyWeaponDamage (Item item, ref StatModifier damage) |
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. More... | |
virtual void | ModifyWeaponKnockback (Item item, ref StatModifier knockback) |
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. More... | |
virtual void | ModifyZoom (ref float zoom) |
Use this to modify the zoom factor for the player. The zoom correlates to the percentage of half the screen size the zoom can reach. A value of -1 passed in means no vanilla scope is in effect. A value of 1.0 means the scope can zoom half a screen width/height away, putting the player on the edge of the game screen. Vanilla values include .8, .6666, and .5. More... | |
virtual void | NaturalLifeRegen (ref float regen) |
Allows you to modify the power of the player's natural life regeneration. This can be done by multiplying the regen parameter by any number. For example, campfires multiply it by 1.1, while walking multiplies it by 0.5. More... | |
override ModPlayer | NewInstance (Player entity) |
virtual void | OnCatchNPC (NPC npc, Item item, bool failed) |
Allows you to make things happen when the given item attempts to catch the given NPC. More... | |
virtual void | OnConsumeAmmo (Item weapon, Item ammo) |
Allows you to make things happen when the given 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. More... | |
virtual void | OnConsumeMana (Item item, int manaConsumed) |
Allows you to make stuff happen when a player consumes mana on use of an item. More... | |
virtual void | OnEnterWorld (Player player) |
Called on the LocalPlayer when that player enters the world. SP and Client. Only called on the player who is entering. A possible use is ensuring that UI elements are reset to the configuration specified in data saved to the ModPlayer. Can also be used for informational messages. More... | |
virtual void | OnHitAnything (float x, float y, Entity victim) |
This hook is called when a player damages anything, whether it be an NPC or another player, using anything, whether it be a melee weapon or a projectile. The x and y parameters are the coordinates of the victim parameter's center. More... | |
virtual void | OnHitByNPC (NPC npc, int damage, bool crit) |
Allows you to create special effects when an NPC hits this player (for example, inflicting debuffs). More... | |
virtual void | OnHitByProjectile (Projectile proj, int damage, bool crit) |
Allows you to create special effects when a hostile projectile hits this player. More... | |
virtual void | OnHitNPC (Item item, NPC target, int damage, float knockback, bool crit) |
Allows you to create special effects when this player hits an NPC by swinging a melee weapon (for example how the Pumpkin Sword creates pumpkin heads). More... | |
virtual void | OnHitNPCWithProj (Projectile proj, NPC target, int damage, float knockback, bool crit) |
Allows you to create special effects when a projectile created by this player hits an NPC (for example, inflicting debuffs). More... | |
virtual void | OnHitPvp (Item item, Player target, int damage, bool crit) |
Allows you to create special effects when this player's melee weapon hits an opponent player. More... | |
virtual void | OnHitPvpWithProj (Projectile proj, Player target, int damage, bool crit) |
Allows you to create special effects when a projectile created by this player hits an opponent player. More... | |
virtual void | OnMissingMana (Item item, int neededMana) |
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. More... | |
virtual void | OnRespawn (Player player) |
Called when a player respawns in the world. More... | |
virtual void | PlayerConnect (Player player) |
Called on clients when a player connects. More... | |
virtual void | PlayerDisconnect (Player player) |
Called when a player disconnects. More... | |
virtual void | PostBuyItem (NPC vendor, Item[] shopInventory, Item item) |
Called whenever the player buys an item from an NPC. More... | |
virtual void | PostHurt (bool pvp, bool quiet, double damage, int hitDirection, bool crit) |
virtual void | PostHurt (bool pvp, bool quiet, double damage, int hitDirection, bool crit, int cooldownCounter) |
Allows you to make anything happen when the player takes damage. More... | |
virtual void | PostItemCheck () |
Allows you to do anything after the update code for the player's held item is run. Hooks for the middle of the held item update code have more specific names in ModItem and ModPlayer. | |
virtual void | PostNurseHeal (NPC nurse, int health, bool removeDebuffs, int price) |
Called on the Client after the player heals themselves with the Nurse NPC. More... | |
virtual void | PostSavePlayer () |
PreSavePlayer and PostSavePlayer wrap the vanilla player saving code (both are before the ModPlayer.Save). Useful for advanced situations where a save might be corrupted or rendered unusable by the values that normally would save. | |
virtual void | PostSellItem (NPC vendor, Item[] shopInventory, Item item) |
Called whenever the player sells an item to an NPC. More... | |
virtual void | PostUpdate () |
This is called at the very end of the Player.Update method. Final general update tasks can be placed here. | |
virtual void | PostUpdateBuffs () |
This is called right after all of this player's buffs update on the player. This can be used to modify the effects that the buff updates had on this player, and can also be used for general update tasks. | |
virtual void | PostUpdateEquips () |
This is called right after all of this player's equipment and armor sets update on the player, which is sometime after PostUpdateBuffs is called. This can be used to modify the effects that the equipment had on this player, and can also be used for general update tasks. | |
virtual void | PostUpdateMiscEffects () |
This is called after miscellaneous update code is called in Player.Update, which is sometime after PostUpdateEquips is called. This can be used for general update tasks. | |
virtual void | PostUpdateRunSpeeds () |
This is called after the player's horizontal speeds are modified, which is sometime after PostUpdateMiscEffects is called, and right before the player's horizontal position is updated. Use this to modify maxRunSpeed, accRunSpeed, runAcceleration, and similar variables before the player moves forwards/backwards. | |
virtual bool | PreHurt (bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) |
virtual bool | PreHurt (bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource, ref int cooldownCounter) |
This hook is called before every time the player takes damage. The pvp parameter is whether the damage was from another player. The quiet parameter determines whether the damage will be communicated to the server. The damage, hitDirection, and crit parameters can be modified. Set the customDamage parameter to true if you want to use your own damage formula (this parameter will disable automatically subtracting the player's defense from the damage). Set the playSound parameter to false to disable the player's hurt sound, and the genGore parameter to false to disable the dust particles that spawn. (These are useful for creating your own sound or gore.) The deathText parameter can be modified to change the player's death message if the player dies. Return false to stop the player from taking damage. Returns true by default. More... | |
virtual bool | PreItemCheck () |
Allows you to do anything before the update code for the player's held item is run. Return false to stop the held item update code from being run (for example, if the player is frozen). Returns true by default. More... | |
virtual bool | PreKill (double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) |
This hook is called whenever the player is about to be killed after reaching 0 health. Set the playSound parameter to false to stop the death sound from playing. Set the genGore parameter to false to stop the gore and dust from being created. (These are useful for creating your own sound or gore.) Return false to stop the player from being killed. Only return false if you know what you are doing! Returns true by default. More... | |
virtual bool | PreModifyLuck (ref float luck) |
Called before vanilla makes any luck calculations. Return false to prevent vanilla from making their luck calculations. Returns true by default. More... | |
virtual void | PreSaveCustomData () |
Currently never gets called, so this is useless. | |
virtual void | PreSavePlayer () |
PreSavePlayer and PostSavePlayer wrap the vanilla player saving code (both are before the ModPlayer.Save). Useful for advanced situations where a save might be corrupted or rendered unusable by the values that normally would save. | |
virtual void | PreUpdate () |
This is called at the beginning of every tick update for this player, after checking whether the player exists. | |
virtual void | PreUpdateBuffs () |
This is called sometime after SetControls is called, and right before all the buffs update on this player. This hook can be used to add buffs to the player based on the player's state (for example, the Campfire buff is added if the player is near a Campfire). | |
virtual void | PreUpdateMovement () |
This is called right before modifying the player's position based on velocity. Use this to make direct changes to the velocity. | |
virtual void | ProcessTriggers (TriggersSet triggersSet) |
Use this to check on keybinds you have registered. While SetControls is set even while in text entry mode, this hook is only called during gameplay. More... | |
virtual void | ResetEffects () |
This is where you reset any fields you add to your ModPlayer subclass to their default states. This is necessary in order to reset your fields if they are conditionally set by a tick update but the condition is no longer satisfied. | |
virtual void | SaveData (TagCompound tag) |
Allows you to save custom data for this player. 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. More... | |
virtual void | SendClientChanges (ModPlayer clientPlayer) |
Allows you to sync any information that has changed between the server and client. Here, you should check the information you have copied in the clientClone parameter; if they differ between this player and the clientPlayer parameter, then you should send that information using NetMessage.SendData or ModPacket.Send. More... | |
virtual void | SetControls () |
Use this to modify the control inputs that the player receives. For example, the Confused debuff swaps the values of Player.controlLeft and Player.controlRight. This is called sometime after PreUpdate is called. | |
sealed override void | SetupContent () |
If you make a new ModType, seal this override, and call SetStaticDefaults in it. More... | |
virtual bool | ShiftClickSlot (Item[] inventory, int context, int slot) |
Called whenever the player shift-clicks an item slot. This can be used to override default clicking behavior (ie. selling, trashing, moving items). More... | |
virtual bool | Shoot (Item item, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) |
Allows you to modify an item's shooting mechanism. Return false to prevent vanilla's shooting code from running. Returns true by default. More... | |
virtual void | SyncPlayer (int toWho, int fromWho, bool newPlayer) |
Allows you to sync information about this player between server and client. The toWho and fromWho parameters correspond to the remoteClient/toClient and ignoreClient arguments, respectively, of NetMessage.SendData/ModPacket.Send. The newPlayer parameter is whether or not the player is joining the server (it is true on the joining client). More... | |
bool | TypeEquals (ModPlayer other) |
virtual void | UpdateAutopause () |
Allows you to modify the player's stats while the game is paused due to the autopause setting being on. This is called in single player only, some time before the player's tick update would happen when the game isn't paused. | |
virtual void | UpdateBadLifeRegen () |
Allows you to give the player a negative life regeneration based on its state (for example, the "On Fire!" debuff makes the player take damage-over-time). This is typically done by setting Player.lifeRegen to 0 if it is positive, setting Player.lifeRegenTime to 0, and subtracting a number from Player.lifeRegen. The player will take damage at a rate of half the number you subtract per second. | |
virtual void | UpdateDead () |
Similar to UpdateDead, except this is only called when the player is dead. If this is called, then ResetEffects will not be called. | |
virtual void | UpdateDyes () |
Is called in Player.UpdateDyes(), including selection screen. Player Instance sensitive. More... | |
virtual void | UpdateEquips () |
Called after Update Accessories. More... | |
virtual void | UpdateLifeRegen () |
Allows you to increase the player's life regeneration based on its state. This can be done by incrementing Player.lifeRegen by a certain number. The player will recover life at a rate of half the number you add per second. You can also increment Player.lifeRegenTime to increase the speed at which the player reaches its maximum natural life regeneration. | |
virtual void | UpdateVisibleAccessories () |
Is called in Player.Frame() after vanilla functional slots are evaluated, including selection screen to prepare and denote visible accessories. Player Instance sensitive. More... | |
virtual void | UpdateVisibleVanityAccessories () |
Is called in Player.Frame() after vanilla vanity slots are evaluated, including selection screen to prepare and denote visible accessories. Player Instance sensitive. More... | |
virtual float | UseAnimationMultiplier (Item item) |
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. More... | |
virtual float | UseSpeedMultiplier (Item item) |
Allows you to safely change both useTime and useAnimation while keeping the values relative to each other. Useful for status effects. More... | |
virtual float | UseTimeMultiplier (Item item) |
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. More... | |
Public Member Functions inherited from Terraria.ModLoader.ModType< Player, ModPlayer > | |
virtual TModType | Clone (TEntity newEntity) |
Create a copy of this instanced global. Called when an entity is cloned. More... | |
virtual bool | IsLoadingEnabled (Mod mod) |
Allows you to stop Mod.AddContent from actually adding this content. Useful for items that can be disabled by a config. More... | |
virtual void | Load () |
Allows you to perform one-time loading tasks. Beware that mod content has not finished loading here, things like ModContent lookup tables or ID Sets are not fully populated. More... | |
virtual TModType | NewInstance (TEntity entity) |
Create a new instance of this ModType for a specific entity More... | |
virtual void | SetStaticDefaults () |
Allows you to modify the properties after initial loading has completed. | |
virtual void | SetupContent () |
If you make a new ModType, seal this override, and call SetStaticDefaults in it. More... | |
virtual void | Unload () |
Allows you to safely unload things you added in Load. More... | |
virtual bool | IsLoadingEnabled (Mod mod) |
Whether or not this type should be loaded when it's told to. Returning false disables Mod.AddContent from actually loading this type. More... | |
abstract void | Load (Mod mod) |
Called when loading the type. More... | |
abstract void | Unload () |
Called during unloading when needed. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Terraria.ModLoader.ModPlayer | |
override Player | CreateTemplateEntity () |
sealed override void | Register () |
If you make a new ModType, seal this override. More... | |
override void | ValidateType () |
Check for the correct overrides of different hook methods and fields and properties More... | |
Protected Member Functions inherited from Terraria.ModLoader.ModType< Player, ModPlayer > | |
abstract TEntity | CreateTemplateEntity () |
virtual void | InitTemplateInstance () |
Create dummy objects for instanced mod-types | |
override void | InitTemplateInstance () |
Create dummy objects for instanced mod-types | |
abstract void | Register () |
If you make a new ModType, seal this override. More... | |
virtual void | ValidateType () |
Check for the correct overrides of different hook methods and fields and properties More... | |
Properties inherited from Terraria.ModLoader.ModPlayer | |
ushort | Index [get, set] |
Player | Player [get] |
The Player instance that this ModPlayer instance is attached to. | |
Properties inherited from Terraria.ModLoader.ModType< Player, ModPlayer > | |
virtual bool | CloneNewInstances [get] |
Whether to create new instances of this mod type via Clone(TEntity) or via the default constructor Defaults to false (default constructor). | |
TEntity | Entity [get, set] |
string | FullName [get] |
The internal name of this, including the mod it is from. More... | |
virtual bool | IsCloneable [get] |
Whether or not this type is cloneable. Cloning is supported if all reference typed fields in each sub-class which doesn't override Clone are marked with [CloneByReference] | |
Mod | Mod [get, set] |
The mod this belongs to. More... | |
virtual string | Name [get] |
The internal name of this. More... | |
Properties inherited from Terraria.ModLoader.IModType | |
string | FullName [get] |
=> $"{Mod.Name}/{Name}" More... | |
Mod | Mod [get] |
The mod this belongs to. More... | |
string | Name [get] |
The internal name of this instance. More... | |
Properties inherited from Terraria.ModLoader.IIndexed | |
ushort | Index [get] |
|
virtual |
Called when the player is created in the menu. You can use this method to add items to the player's starting inventory, as well as their inventory when they respawn in mediumcore.
mediumCoreDeath | Whether you are setting up a mediumcore player's inventory after their death. |
Reimplemented from Terraria.ModLoader.ModPlayer.
|
virtual |
Called whenever the player is loaded (on the player selection screen). This can be used to initialize data structures, etc.
Reimplemented from Terraria.ModLoader.ModPlayer.
|
virtual |
Allows you to load custom data that you have saved for this player.
Try to write defensive loading code that won't crash if something's missing.
tag | The TagCompound to load data from. |
Reimplemented from Terraria.ModLoader.ModPlayer.
|
virtual |
Allows you to save custom data for this player.
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.
tag | The TagCompound to save data into. Note that this is always empty by default, and is provided as an argument only for the sake of convenience and optimization. |
Reimplemented from Terraria.ModLoader.ModPlayer.