tModLoader v2023.01
A mod to make and play Terraria mods
Terraria.ModLoader.ModAccessorySlot Class Reference

A ModAccessorySlot instance represents a net new accessory slot instance. You can store fields in the ModAccessorySlot class. More...

Inherits Terraria.ModLoader.ModType< TEntity, TModType >.

Inherited by Terraria.ModLoader.Default.UnloadedAccessorySlot.

Public Member Functions

virtual void ApplyEquipEffects ()
 Override to replace the vanilla effect behavior of the slot with your own. By default calls: Player.VanillaUpdateEquips(FunctionalItem), Player.ApplyEquipFunctional(FunctionalItem, ShowVisuals), Player.ApplyEquipVanity(VanityItem)
 
virtual bool CanAcceptItem (Item checkItem, AccessorySlotType context)
 Override to set conditions on what can be placed in the slot. Default is to return false only when item property FitsAccessoryVanity says can't go in to a vanity slot. Return false to prevent the item going in slot. Return true for dyes, if you want dyes. Example: only wings can go in slot. Receives data: More...
 
virtual bool IsEnabled ()
 Override to set conditions on when the slot is valid for stat/vanity calculations and player usage. Example: the demonHeart is consumed and in Expert mode in Vanilla. More...
 
virtual bool IsHidden ()
 Override to control whether or not drawing will be skipped during the given frame. NOTE: Nothing will be drawn, nor will subsequent drawing hooks be called on this slot for the frame while true
 
virtual bool IsVisibleWhenNotEnabled ()
 Override to change the condition on when the slot is visible, but otherwise non-functional for stat/vanity calculations. Defaults to check 'property' IsEmpty More...
 
virtual bool ModifyDefaultSwapSlot (Item item, int accSlotToSwapTo)
 After checking for empty slots in ItemSlot.AccessorySwap, this allows for changing what the default target slot (accSlotToSwapTo) will be. DOES NOT affect vanilla behaviour of swapping items like for like where existing in a slot Return true to set this slot as the default targetted slot.
 
virtual void OnMouseHover (AccessorySlotType context)
 Allows you to do stuff while the player is hovering over this slot.
 
virtual void PostDraw (AccessorySlotType context, Item item, Vector2 position, bool isHovered)
 
virtual bool PreDraw (AccessorySlotType context, Item item, Vector2 position, bool isHovered)
 Allows drawing prior to vanilla ItemSlot.Draw code. Return false to NOT call ItemSlot.Draw
 
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. More...
 
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...
 
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. More...
 
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...
 

Protected Member Functions

sealed override void Register ()
 If you make a new ModType, seal this override. More...
 
- Protected Member Functions inherited from Terraria.ModLoader.ModType< TEntity, TModType >
abstract TEntity CreateTemplateEntity ()
 
virtual void InitTemplateInstance ()
 Create dummy objects for instanced mod-types More...
 
override void InitTemplateInstance ()
 Create dummy objects for instanced mod-types More...
 
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...
 
- Protected Member Functions inherited from Terraria.ModLoader.ModType< TEntity >
abstract TEntity CreateTemplateEntity ()
 
virtual void InitTemplateInstance ()
 Create dummy objects for instanced mod-types More...
 
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

virtual ? Vector2 CustomLocation [get]
 
virtual bool DrawDyeSlot [get]
 
virtual bool DrawFunctionalSlot [get]
 
virtual bool DrawVanitySlot [get]
 
virtual string DyeBackgroundTexture [get]
 
Item DyeItem [get, set]
 
virtual string DyeTexture [get]
 
virtual string FunctionalBackgroundTexture [get]
 
Item FunctionalItem [get, set]
 
virtual string FunctionalTexture [get]
 
bool HideVisuals [get, set]
 
bool IsEmpty [get]
 
ModAccessorySlotPlayer ModSlotPlayer [get]
 
static Player Player [get]
 
int Type [get, set]
 
virtual string VanityBackgroundTexture [get]
 
Item VanityItem [get, set]
 
virtual string VanityTexture [get]
 
- Properties inherited from Terraria.ModLoader.ModType< TEntity, TModType >
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.ModType< TEntity >
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...
 

Detailed Description

A ModAccessorySlot instance represents a net new accessory slot instance. You can store fields in the ModAccessorySlot class.

Member Function Documentation

◆ CanAcceptItem()

virtual bool Terraria.ModLoader.ModAccessorySlot.CanAcceptItem ( Item  checkItem,
AccessorySlotType  context 
)
virtual

Override to set conditions on what can be placed in the slot. Default is to return false only when item property FitsAccessoryVanity says can't go in to a vanity slot. Return false to prevent the item going in slot. Return true for dyes, if you want dyes. Example: only wings can go in slot. Receives data:

checkItem :: the item that is attempting to enter the slot

◆ IsEnabled()

virtual bool Terraria.ModLoader.ModAccessorySlot.IsEnabled ( )
virtual

Override to set conditions on when the slot is valid for stat/vanity calculations and player usage. Example: the demonHeart is consumed and in Expert mode in Vanilla.

Reimplemented in Terraria.ModLoader.Default.UnloadedAccessorySlot.

◆ IsVisibleWhenNotEnabled()

virtual bool Terraria.ModLoader.ModAccessorySlot.IsVisibleWhenNotEnabled ( )
virtual

Override to change the condition on when the slot is visible, but otherwise non-functional for stat/vanity calculations. Defaults to check 'property' IsEmpty

Returns

◆ Register()

sealed override void Terraria.ModLoader.ModAccessorySlot.Register ( )
protectedvirtual

If you make a new ModType, seal this override.

Implements Terraria.ModLoader.ModType< TEntity, TModType >.