tModLoader v2024.08
A mod to make and play Terraria mods
EquipLoader Class Reference

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

Static Public Member Functions

static int AddEquipTexture (Mod mod, string texture, EquipType type, ModItem item=null, string name=null, EquipTexture equipTexture=null)
 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. More...
 
static void EquipFrameEffects (Player player)
 Hook Player.PlayerFrame Calls each of the item's equipment texture's FrameEffects hook.
 
static int GetEquipSlot (Mod mod, string name, EquipType type)
 Gets the slot/ID of the equipment texture corresponding to the given name. Returns -1 if no EquipTexture with the given name is found. More...
 
static EquipTexture GetEquipTexture (EquipType type, int slot)
 Gets the equipment texture for the specified equipment type and ID. More...
 
static EquipTexture GetEquipTexture (Mod mod, string name, EquipType type)
 Gets the EquipTexture instance corresponding to the name and EquipType. Returns null if no EquipTexture with the given name and EquipType is found. More...
 

Static Public Attributes

static readonly EquipType[] EquipTypes = (EquipType[])Enum.GetValues(typeof(EquipType))
 

Detailed Description

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 Function Documentation

◆ AddEquipTexture()

static int EquipLoader.AddEquipTexture ( Mod  mod,
string  texture,
EquipType  type,
ModItem  item = null,
string  name = null,
EquipTexture  equipTexture = null 
)
static

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.

If both an internal name and associated item are provided, the EquipTexture's name will be set to the internal name, alongside the keys for the equipTexture dictionary.
Additionally, if multiple EquipTextures of the same type are registered for the same item, the first one to be added will be the one automatically displayed on the player and mannequins.

Parameters
modThe mod the equipment texture is from.
equipTextureThe equip texture.
itemThe item.
nameThe internal name.
typeThe type.
textureThe texture.
Returns
the ID / slot that is assigned to the equipment texture.

◆ GetEquipSlot()

static int EquipLoader.GetEquipSlot ( Mod  mod,
string  name,
EquipType  type 
)
static

Gets the slot/ID of the equipment texture corresponding to the given name. Returns -1 if no EquipTexture with the given name is found.

Parameters
modThe mod the equipment texture is from.
nameThe name.
type
Returns

◆ GetEquipTexture() [1/2]

static EquipTexture EquipLoader.GetEquipTexture ( EquipType  type,
int  slot 
)
static

Gets the equipment texture for the specified equipment type and ID.

Parameters
type
slot
Returns

◆ GetEquipTexture() [2/2]

static EquipTexture EquipLoader.GetEquipTexture ( Mod  mod,
string  name,
EquipType  type 
)
static

Gets the EquipTexture instance corresponding to the name and EquipType. Returns null if no EquipTexture with the given name and EquipType is found.

Parameters
modThe mod the equipment texture is from.
nameThe name.
typeThe type.
Returns