Terraria

Join the largest
modding community

More mods

Explore all mods

News & Updates

  • Ini Attributes: Wall Attributes

    Name Type Description

    name string The name of the wall. This is generated from the filename in the case of custom walls.

    id int Sets the ID of the tile.

    DropName string Set to the name of what the tile drops when destroyed.

    House bool Whether this wall is suitable for housing.

    Blend int The id of the wall that blends with this one (usually the same as its own id)....

  • Ini Attributes: Tile Attributes

    Name Type Description

    name string The name of the tile. This may not be displayed ingame, since tiles don't seem to have a name when you mouse over them.

    id int The type of tile this is. This behaves identically to the type attribute that items have. Set it to -1 to indicate a custom tile, or set it to another value to mimic an existing one. See also List of Tiles.

    DropName string The name of the item that the tile drops.

    House bool Is the block can be used to the house

    Width int The width of the image in tiles. A tile is equal to 16 pixels, with a space of two pixels between each tile. See How to make a custom Tile for more information, as it has graphical examples of this system.

    Height int ...

  • Ini Attributes: Projectile Attributes

    Name Type Description

    width int The width of the projectile's hitbox, in pixels.

    height int The height of the projectile's hitbox, in pixels.

    soundDelay int The delay until the projectile's sound plays when initialized.

    melee bool Whether this projectile's damage is considered melee. Melee takes priority over ranged, which takes priority over magic. This means this is rarely used.

    ranged bool Whether this projectile's damage is considered ranged. Melee takes priority over ranged, which takes priority over magic.

    magic bool Whether this projectile's damage is considered magic. Melee takes priority over ranged, which takes priority over magic.

    ownerHitCheck bool Whether or not ...

  • Ini Attributes: NPC Attributes

    Name Type Description
    netAlways bool ???

    buffImmune bool Whether a particular buff may be placed on this NPC.Default value:

    buffImmune = truelifeRegen int How much life the NPC regenerates each second

    .npcSlots float How many slots this NPC takes up in memory storage. There is a hard cap of 200 onscreen at once. Different monsters contribute different amounts. For example, bosses have a number very close to this cap to prevent monsters from spawning during a fight.Default value: 1

    flavaImmune bool Whether this NPC is harmed by lava or not.

    townNPC bool Whether this NPC can live in a house or not.

    friendly bool Whether this NPC deals damage when it collides with a player.

  • Ini Attributes: Item Attributes

    Item Attributes

    Terraria Attributes
    Name Type Description
    width int The width of the item's hitbox while in use. This is used for collision detection to see if a tile or NPC is being hit by it. This is multiplied by scale to get the final size. There are 16 pixels per tile, so a size of 8 to 20 is ideal.

    height int As above, but for the height of the hitbox.

    name string The name of the item shown in game.Default value: "Unnamed"

    crit int The amount of critical hit percentage that this item adds. An amount of 10 would add 10%, for example. When used as armor or an accessory, will always be applied. When it's on a weapon, will only apply to attacks with that weapon. The base percentage for all players is 4% for e...

  • Ini Attributes: Buff Attributes

    Name Type Description
    id int            - The ID for the buff which allows other objects to refer to it. For a custom buff, use -1, otherwise place the value of an existing one. Default value: -1

    tip string     - The tooltip that is displayed when the buff is moused over.Default value: ""

    debuff bool - Whether this is a buff, which may be removed by right clicking, or a debuff which may not be removed manually. It is recommended you set this to false for testing purposes, and then change it to what it should be after you're done testing.

    alpha float - The alpha blending to apply to the buff icon. As this is a float, it is a decimal value. Unsure whether 1.00 is fully transparent or opaque, or if 255 behaves this way, as the fact this ...

  • tConfig Classes: Recipe

    Recipe.AddSimpleRecipe(object output, object... args)
    example uses:​

    Item output = new Item(); output.SetDefaults("Gold Chest"); output.stack = 3; Recipe.AddSimpleRecipe(output,"3 Chest","10 Gold Bar","@Work Bench")
    Recipe.AddSimpleRecipe("2 Mega Spelunker Potion","5 Spelunker Potion","@Bottle","@Water")
    Recipe.AddSimpleRecipe("Lava Bottle","Bottle","@Lava")

    output can be:
    an instance of Item
    a string in format:
    "{item name}" - outputs one {item name}
    "{amount} {item name}" - outputs {amount} of {item name}

    arguments can be:
    instances of Item - recipe materials
    strings in format:
    "{item name}" - requires one {item name} as material
    "{amount} {item name}" - requires {amount} of {item n...

  • tConfig Classes: Tile

    void Initialize(int x, int y) - Called when the tile is placed, or when the world is loaded
    void UseTile(Player player, int x, int y) - Called when the player clicks on the tile
    void PlaceTile(int x, int y) - Called when a tile is placed
    void KillTile(int x, int y, Player player) - Called when a tile is destroyed.
    void PreKillTile(ref int x, ref int y, ref bool LetContinue, ref bool fail, ref bool effectOnly, ref bool noItem, Player P) - called on your tile before it executes any logic, you can change its X, Y and so on, allowing high level manipulation of its death.
    bool StopKillTile(int x, int y) - stop a tile from dying after it dropped its particle effects, called after stop checks from effectOnly and noItem. Return true to stop KillTile there
    bool ...

  • tConfig Classes: Projectile

    void Initialize()
    void AI()
    bool PreAI() - called before AI(); return true to execute AI(), false otherwise
    void PostAI() - called after AI()
    void DamageNPC(NPC npc, ref int damage, ref float knockback)
    void DealtNPC(NPC npc, double damage, Player player)
    void DamagePlayer(ref int damage, Player player) -​ You can use this to apply a code over a player that's hit by a projectile
    void DealtPlayer(double damage,Player player) -​ ​You can use this to apply a code over a player that's hit by a projectile
    void Kill() - Here, decide what to do with the projectile is destroyed. You could create an explosion, for instance.
    bool tileCollide(Vector2 CollideVel) - allows executing code when the projectile hits a tile (only for tile collide p...

  • tConfig Classes: Buff

    There are separate methods for buffs on NPCs and buffs on the Player.
    Called every 'tick':
    public void Effects(Player P,int buffIndex,int buffType,int buffTime)
    public void NPCEffects(NPC N,int buffIndex,int buffType,int buffTime)


    Called when the buff starts:
    public void EffectsStart(Player P,int buffIndex,int buffType,int buffTime)
    public void NPCEffectsStart(NPC N,int buffIndex,int buffType,int buffTime)


    Called when the buff ends:
    public void EffectsEnd(Player P,int buffIndex,int buffType,int buffTime)
    public void NPCEffectsEnd(NPC N,int buffIndex,int buffType,int buffTime)


    Used for saving/loading data:
    void Save(BinaryWriter writer)
    void Load(BinaryReader reader, int version...

  • tConfig Classes: NPC

    void Initialize()
    void FindFrame(int currentFrame) - Handle custom animations here
    void AI() - Handle AI
    bool PreAI() - Called before AI(); return false if you don't want it to run the normal AI routine
    void PostAI() - called after AI()
    bool SpawnNPC(int x, int y, int playerID) - return true if you want the NPC to spawn.
    void SetupShop(Chest chest) - Handle shop items for your Town NPC
    string Chat() - Return the line of text you want the NPC to say
    bool TownSpawn() - return true if you want the NPC to spawn as a Town NPC
    void NPCLoot() - Handle death events and drop items
    string SetName() - Required method to set the name of your Town NPC.
    void DealtNPC(double damage, Player player) - Called after the NPC takes damage from a...

  • tConfig Classes: Prefix

    In Global code file (Prefix.cs):
    List<Prefix> DefinePrefixes()
    Useful method calls or variables:
    Prefix SetWeight(double weight) - set the weight of a prefix, return the prefix itself
    Notes:
    If a prefix isn't loaded, the item will get the "Mysterious" prefix, and should regain the original prefix if the prefix's mod is reloaded
    tConfig Custom Properties

    Name Type Description


    name string - Name is required, this is what gets added to the item name
    suffix bool  - Set suffix to True to make the name appear after the item name
    weight double - Chance to get the prefix

    melee bool - Requirement of the prefix, set to true to apply to melee weapon
    ranged bool - Requirement of the prefix, set...

  • tConfig Classes: Item

    Item

    For everything:
    void Initialize()
    void Save(BinaryWriter writer) - Saves data, for either the world or the player. Also used to transfer data in multiplayer.
    void Load(BinaryReader reader, int version) - Loads data for the world or the player. Also used to transfer data in multiplayer.
    void PlayerGrab(Player player, int playerID, int itemIndex) - Called when the item collides with the player. This is where health or mana crystals give the player health/mana, and normal items go into the player's inventory. Defining this method will override the default behavior for normal items. The itemIndex is the index into the Main.item array.
    public bool OverrideItemGrab(Player P,int PlayerID,int ItemIndex) - return false to call normal grabbing , otherwi...

  • tConfig Classes: Interfaces

    Interfaces

    Interfaces are defined through a class called InterfaceObj. It can include item slots and text-based buttons. Call-back methods are defined using an interface called Interfaceable.

    Interfaceable


    bool DropSlot(int slotNum) - Called when the interface is closed - return true if you want the item in the slot to be dropped, false otherwise
    void ButtonClicked(int buttonNum) - Perform an action when the specified button is clicked on. This will be called if the button is defined to be clickable.
    bool CanPlaceSlot(int slotNum, Item mouseItem) - return true if you want to let the player place / pick up an item in the specified slot. mouseItem is the item currently held by the mouse.
    void PlaceSlot(int slotNum) - Perform some a...

  • tConfig Classes: ModGeneric

    ModGeneric


    Defined in Global\Generic.cs
    void OnLoad() - Called after mods and content are loaded. Can be useful for loading texture packs.
    void OnUnload() - useful for unloading content if you like to keep things super clean
    void UpdateSpawn(Player P) - Global method for changing spawn rates and various things. You can access variables such as NPC.spawnRate and NPC.maxSpawns.
    void ModifySpawnList(List<int> PossibleSpawns) - modify the said list to change what can be rolled for spawning
    void ServerCommand(string text) - you can use it to add server commands by reading the text on them , the method is called before the actual regular text parsing and does not stop it
    void checkXMas() - the regular method is skipped if such meth...

  • tConfig Classes: ModPlayer

    ModPlayer


    Defined in 'Global\Player.cs'.
    void UpdatePlayer(Player player) - Called every 'tick'
    void CreatePlayer(Player player) - Called when a Player instance is created. This is where it sets the player's default starting items.
    void PreUpdatePlayer(Player player) - Called every 'tick', before the effects from items and buffs are applied.
    public bool PreQuickHeal(Player P) - Return true to call regular QuickHeal , false otherwise
    public bool PreQuickMana(Player P) - Return true to call regular QuickMana , false otherwise
    public bool PreQuickGrapple(Player P) - Return true to call regular QuickGrapple , false otherwise
    public bool PreKill(Player P,double Damage,int hitDirection,bool pvp,string deathText) - Return true to le...

  • tConfig Classes: ModWorld

    ModWorld

    Defined in 'Global\World.cs'.
    Interface Related
    void PostDraw(SpriteBatch SP) - Called every tick, after the default drawing method
    void PreDrawInterface(SpriteBatch SP) - called before interface is drawn
    public void PreDrawTiles(SpriteBatch SP,bool solidOnly)
    public void PostDrawTiles(SpriteBatch SP,bool solidOnly)
    public void PreLightTiles(SpriteBatch SP)
    public void PostLightTiles(SpriteBatch SP)
    public bool PreDrawLifeHearts(SpriteBatch SP) - return true to draw player's life hearts regularly , false to skip
    public bool PreDrawManaStars(SpriteBatch SP) - return true to draw player's mana stars regularly , false to skip
    public bool PreDrawBubbleBar(SpriteBatch SP) - return true to draw player's bubbles ...

  • tConfig Classes: Global Classes

    Global Classes

    ModWorld and ModPlayer classes are defined in 'Global\World.cs' and 'Global\Player.cs' respectively.
    void Save(BinaryWriter writer) - Save data to the player or world.
    void Load(BinaryReader reader, int version) - Load data associated with the player or world.
    void Initialize(int modIndex) - Called when the world or player is loaded. It is HIGHLY recommended that you write this method for resetting variables. If you don't, then switching to a different world or player could result in unexpected behavior. The modIndex value is required for networking purposes.
    ...

  • tConfig Classes: ModWorld Networking

    ModWorld Networking

    Defined in 'Global\World.cs':
    void NetReceive(int msg, BinaryReader reader) - Called when a net message is received for this ModWorld class.
    void NetSend(int msg, BinaryWriter writer) - Called when a net message needs to be sent
    void PlayerConnected(int playerID) - Called on the server when a player connects
    void SyncPlayers() - Called on the server when a player joins, and periodically afterwards
    void NetReceiveIntercept(messageBuffer msgBuffer, int b, int start, int length, ref int num)
    void NetSendIntercept(int num, ref int num2, ref int num3, int msgType, int remoteClient, int ignoreClient, string text, int number, float number2, float number3, float number4, int number5)
    To send a message with NetSend, you w...