FANDOM


The information in this article is for tAPI r11 based on Terraria v1.2.4.1.

Items are the most prevalent thing to make changes to. There are a ton of attributes for you to play with, such as their size, damage, effects, recipe, and the like.
Items

PropertiesEdit

Name Type Description
name string This is the name of the item, specifically the name in which it is referred to by the game and not the name displayed to the player
texture string The texture file tied to the item code (leave out .png in code)
code string
displayName string The name of the item in-game
width int
height int
scale int The size of the item when in use, default is 1, increase to make item bigger in use, and decrease to make smaller
tooltip string The tooltip of the item
useStyle
holdStyle
useAnimation
useTime
channel
maxStack
pick
axe
hammer
tileBoost
placeStyle
damage
knockback
healLife
healMana
potion
consumable
autoReuse
useTurn
defense
rare int The rarity of the item, increase for greater rarity
shootSpeed
notAmmo
lifeRegen
manaIncrease
mana
noUseGraphic
vanity
crit
melee
magic
ranged
summon
reuseDelay
color
notMaterial
mech
makeNPC
hairDyeColor
hairDyeGlows
questItem
questAnglerText
fishingPole
lavaRod
honeyRod
waterRod
bait
fish
catchChance
worldLayer
liquidType
biomes
value
buffTime
buff
autoSelect
useSound
ammo
useAmmo
shoot
createTile
tileWand
createWall
noMelee
wings
wingTime
wingSpeedMax
wingRateMult
holdoutOffset
holdoutOrigin
accessory
textureHandsOn
textureHandsOff
textureNeck
textureBack
textureFront
textureShoes
textureWaist
textureShield
textureFace
textureBalloon
armorHead
textureHead
hairType
setName
armorLegs
textureLegs
armorBody
hasHands
hasArms
textureBody
textureArm
textureFemale
recipes

HooksEdit

Hook Name Description

OnUpdate()

public override void OnUpdate(ref float gravity, ref float maxVelocity) { }

Called on items in world, useful for making soul-like items.

  • No Return
PreWorldDraw()
public override bool PreWorldDraw(SpriteBatch sb) { return true; }

description here

  • Return true to
PostWorldDraw()
public override void PostWorldDraw(SpriteBatch sb) { }

description here

  • No Return
CanPickup()
public override bool CanPickup(Player player, bool vacuum)
{
    return true;
}

Called when an item comes in range of being picked up. When vacuum is true, the item is being vaccumed towards the player and not actually being picked up.

  • Return true to allow the player to pick up
  • Return false to disallow the player to pick up

OnPickup()

public override bool OnPickup(Player player)
{
    return true;
}

Called when an item is picked up by the player.

  • Return true to place the item in the players inventory
  • Return fase to make the item dissapear (like hearts and mana stars)

UseItem()

public override bool? UseItem(Player player)
{
    return null;
}

description here

  • Returns null
UseItemEffects()
public override void UseItemEffects(Player P, Rectangle rect) { }

description here

  • No Return
CanUse()
public override bool CanUse(Player player)
{
    return true;
}

Called when the player is about to use an item.

  • Return true to allow the player to use the item
  • Return false to disallow the player from using the item
ConsumeItem()
public override bool ConsumeItem(Player p)
{
    return true;
}

called when a consumable item is about to be consumed.

  • Return true to consume the item
  • Return false to not consume an item
ConsumeAmmo()
public override bool ConsumeAmmo(Player p)
{
    return true;
}

Called when ammo is about to be consumed (on gun and ammo).

  • Return true to consume the item
  • Return false to not consume an item
ConsumeBait()
public override bool ConsumeBait(Player p)
{
    return true;
}

Called when bait is about to be consumed (on bait and fishing rod).

  • Return true to consume the item
  • Return false to not consume an item
UseStyle()
public override void UseStyle(Player p) { }

description here

  • No Return
HoldStyle()
public override void HoldStyle(Player p) { }

description here

  • No Return
SetUseFrame()
public override void SetUseFrame(Player p) { }

description here

  • No Return
SetHoldFrame()
public override bool SetHoldFrame(Player p)
{
    return false;
}

Sets the holding frame of the item

  • Return true to override the frame
  • Return false to allow normal behavior (ie hook frames)
SetUseHitbox()
public override Rectangle SetUseHitbox(Player p, Rectangle rect)
{
    return rect;
}

description here

  • No Return
PreItemCheck()
public override void PreItemCheck(Player p) { }

Called before item check executes.

  • No Return
PostItemCheck()
public override void PostItemCheck(Player p) { }

Called after item check executes

  • No Return
OnBuy()
public override void OnBuy(Chest shop, int slot, Item item) { }

description here

  • No Return
OnCraft()
public override void OnCraft(Recipe recipe) { }

description here

  • No Return
OnAffixName()
public override string OnAffixName(string currentName, string oldName)
{
    return currentName;
}

description here

  • No Return
PreReforge()
public override bool PreReforge()
{
    return true;
}

description here

  • No Return
PostReforge()
public override void PostReforge() { }

description here

  • No Return
PreShoot()
public override bool PreShoot(Player player, 
                              Vector2 position, 
                              Vector2 velocity, 
                              int projType, 
                              int damage, 
                              float knockback)
{
    return true;
}

description here

  • Return
CanEquip()
public override bool CanEquip(Player player, int slot)
{
    return true;
}

description here

  • Return true to allow the player to equip
  • Return false to dissallow the player to equip
OnEquip()
public override void OnEquip(Player player, int slot) { }

description here

  • No Return
OnUnEquip()
public override void OnUnEquip(Player player, int slot) { }

description here

  • No Return
Effects()
public override void Effects(Player player) { }

description here

  • No Return
VanityEffects()
public override void VanityEffects(Player player) { }

description here

  • No Return
ArmorSetBonus()
public override void ArmorSetBonus(Player player) { }

Called when a full armor set is worn.

  • No Return
VanitySetBonus()
public override void VanitySetBonus(Player player) { }

Called when a full armor set is visually worn.

  • No Return
IsArmorSet()
public override bool IsArmorSet(Player player, bool vanity)
{
    return false;
}

Called to check if the player has an armor set. Can be used to create custom sets utilizing vanilla items (in a similar manner to 'ancient' sets) or sets that utilize only 2 items

  • Return false to execute normal behavior
  • Return true to run the armor set methods
DyeHair()
public override Color DyeHair(Player player, Color dyeColor, ref bool glows)
{
    return dyeColor;
}

Called on custom dye items, if glows is true then the hair glows regardless of light level.

  • Returns a Color
DamagePlayer()
public override void DamagePlayer(NPC npc, 
                                  Player owner, 
                                  int hitDir, 
                                  ref int damage, 
                                  ref bool crit, 
                                  ref float critMult) { }

Called when an NPC damages this item's player.

  • No Return
DealtPlayer()
public override void DealtPlayer(NPC npc, Player owner, int hitDir, int dmgDealt, bool crit) { }

Called when an NPC damages this item's player.

  • No Return
DamagePVP()
public override void DamagePVP(Player owner, 
                               Player p, 
                               int hitDir, 
                               ref int damage, 
                               ref bool crit, 
                               ref float critMult) { }

Called when this item's player attacks another player.

  • No Return
DealtPVP()
public override void DealtPVP(Player owner, Player p, int hitDir, int dmgDealt, bool crit) { }

Called when this item's player attacks another player.

  • No Return
DamageNPC()
public override void DamageNPC(Player owner, 
                               NPC npc, 
                               int hitDir, 
                               ref int damage, 
                               ref float knockback, 
                               ref bool crit, 
                               ref float critMult) { }

Called when this item's player damages an NPC.

  • No Return
DealtNPC()
public override void DealtNPC(Player owner, 
                              NPC npc, 
                              int hitDir, 
                              int dmgDealt, 
                              float knockback, 
                              bool crit) { }

Called when this item's player damages an NPC.

  • No Return
CanHitPlayer()
public override bool? CanHitPlayer(NPC npc, Player owner)
{
    return null;
}

description here

  • Returns null
CanHitPVP()
public override bool? CanHitPVP(Player owner, Player p)
{
    return null;
}

description here

  • Returns null
CanHitNPC()
public override bool? CanHitNPC(Player owner, NPC npc)
{
    return null;
}

description here

  • Returns null
OnHitPVP()
public override void OnHitPVP(Player owner, Player victim, Vector2 hitLocation) { }

description here

  • No Return
OnHitNPC()
public override void OnHitNPC(Player owner, NPC victim, Vector2 hitLocation) { }

description here

  • No Return
GetFishingLevel()
public override void GetFishingLevel(Player player, Item bait, ref int fishingLevel) { }

liquidType: 0-2, water, lava, honey

poolCount = the amount of water tiles in the pool

worldLayer: 0-4, sky, surface, dirtlayer, rocklayer, hell

if caughtType is -1, it will bobber but not spawn any item when brought back, allowing for unconventional catches

  • No Return
OnFishSelected()
public override void OnFishSelected(Player player, 
                                    Item fishingRod, 
                                    Item bait, 
                                    int liquidType, 
                                    int poolCount, 
                                    int worldLayer, 
                                    int questFish, 
                                    ref int caughtType) { }

description here

  • No Return
ModifyDrawLayerList()
public override void ModifyDrawLayerList(Player player, List<PlayerLayer> list, int slot) { }

description here

  • No Return
ModifyDrawLayerHeadList()
public override void ModifyDrawLayerHeadList(Player player, List<PlayerLayer> list, int slot) { }

description here

  • No Return
ModifyDrawColor()
public override Color ModifyDrawColor(Player owner, Color color) { return color; }

description here

  • No Return
ModifyToolTip()
public override void ModifyToolTip(Player owner, List<string> list) { }

description here

  • No Return

NotesEdit

See also: List of Items

Template:NavboxClasses

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.