tModLoader  0.12 Alpha
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.

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) More...
 
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 More...
 
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. More...
 
virtual void OnMouseHover (AccessorySlotType context)
 Allows you to do stuff while the player is hovering over this slot. More...
 
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 More...
 
- Public Member Functions inherited from Terraria.ModLoader.ModType
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 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...
 

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
string FullName [get]
 The internal name of this, including the mod it is from. More...
 
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...
 

Detailed Description

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

Member Function Documentation

◆ ApplyEquipEffects()

virtual void Terraria.ModLoader.ModAccessorySlot.ApplyEquipEffects ( )
virtual

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)

◆ 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.

◆ IsHidden()

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

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

◆ 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

◆ ModifyDefaultSwapSlot()

virtual bool Terraria.ModLoader.ModAccessorySlot.ModifyDefaultSwapSlot ( Item  item,
int  accSlotToSwapTo 
)
virtual

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.

◆ OnMouseHover()

virtual void Terraria.ModLoader.ModAccessorySlot.OnMouseHover ( AccessorySlotType  context)
virtual

Allows you to do stuff while the player is hovering over this slot.

◆ PreDraw()

virtual bool Terraria.ModLoader.ModAccessorySlot.PreDraw ( AccessorySlotType  context,
Item  item,
Vector2  position,
bool  isHovered 
)
virtual

Allows drawing prior to vanilla ItemSlot.Draw code. Return false to NOT call ItemSlot.Draw

◆ Register()

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

If you make a new ModType, seal this override.

Implements Terraria.ModLoader.ModType.