tModLoader Documentation

repository·1.4.5·Indexed 25 days ago

https://github.com/tmodloader/tmodloader

An open-source, community-driven modification API for Terraria that enables players to create, install, and play mods in single-player and multiplayer. The documentation covers modding implementation details such as custom visual EquipTypes, ModTypes, and VictoryPoses, as well as the ExampleMod reference project. It also includes technical details on the tModLoader CLI for decompiling, patching, and regenerating source code.

Tokens
4.8K
Snippets
14
Records
60
Agent score
91%

What's inside tModLoader

  1. Implement a custom visual EquipType

    1.4.5

    A visual EquipType allows multiple items to share a single PlayerDrawLayer at a specific position on the player character. This prevents textures from layering incorrectly (e.g., rendering multiple sets of boots simultaneously) by ensuring only the latest visible item of that type is rendered.

    To implement a complete custom visual EquipType, you need the following components:

    1. A Loader Class (e.g., EarringsLoader): Manages loading and tracking equipment textures for the custom type.
    2. A GlobalItem Class (e.g., EarringsGlobalItem): Detects when items are equipped and passes their data (including dye/shader info) to the player class.
    3. A Player Class (e.g., EarringsPlayer): Stores the state of which specific equipment is currently active and its visual modifiers.
    4. A PlayerDrawLayer Class (e.g., EarringsDrawLayer): Inherits from PlayerDrawLayer to handle the actual rendering logic.
    5. An Autoload Attribute (e.g., AutoloadEquip_EarringAttribute): An attribute applied to ModItem classes to automatically register their textures for the custom EquipType.
  2. Upload content to the TML Mod Browser

    1.4.5

    Mod creators can upload content to the TML Mod Browser using Steam's verification system. By uploading, you agree to the following:

    • The TML Team has the right to alter, modify, or remove any uploaded content at their discretion.
    • Successful upload messages do not guarantee the content is available or that the upload was truly successful.
    • You may not upload material that infringes on any copyright, patent, trademark, or other proprietary rights.
    • You may remove your own uploaded content, but this does not guarantee removal from other channels where it may have propagated.
    • Content creators cannot force the removal of content that users have already downloaded through the TML Software or Mod Browser.
    • Access to the Mod Browser service may be permanently denied to any individual without the right to appeal.
  3. Set up a dedicated tModLoader server on macOS

    1.4.5
    To run a dedicated tModLoader server, you must first install the un-modded Terraria server (available at http://terraria.org/server/terraria-server-1353.zip). Once the base server is installed, follow the manual installation instructions to copy the tModLoader files into the directory where you installed the Terraria server. For detailed command-line instructions, refer to the tModLoader Dedicated Host guide.
  4. Use the Terraria trademark in Mod promotional materials

    1.4.5

    When creating or promoting a Mod, you may use the Terraria trademark only in a referential way to indicate compatibility. You must adhere to these constraints:

    • Use referential phrases like for use with or compatible with.
    • Do not include Terraria as part of the Mod's name.
    • Ensure the word Terraria appears less prominent than the Mod name.
    • The reference must not imply endorsement, sponsorship, or a false association with Re-Logic, Inc.
    • Do not use the trademark in a way that shows Re-Logic, Inc. or the Terraria game in a false or derogatory light.
  5. Download and install ExampleMod for local experimentation

    1.4.5

    You can download ExampleMod to your local machine to experiment with the code or build it in-game.

    1. Download the stable.zip archive.
    2. Extract the ExampleMod folder.
    3. Place the ExampleMod folder into your ModSources folder (located within your tModLoader saves folder).

    Once placed in ModSources, you can build ExampleMod in-game just like any other mod.

    https://github.com/tModLoader/tModLoader/archive/refs/heads/stable.zip