ModTile Class

Base class for creating custom tiles, blocks, and furniture.

Overview

The ModTile class lets you create custom placeable blocks, furniture, and decorative tiles with custom behaviors.

Simple Block Example

using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;

namespace YourMod.Tiles
{
    public class ExampleTile : ModTile
    {
        public override void SetStaticDefaults()
        {
            Main.tileSolid[Type] = true; // Block is solid
            Main.tileMergeDirt[Type] = true; // Merges with dirt
            Main.tileBlockLight[Type] = true; // Blocks light
            TileID.Sets.Ore[Type] = true; // Ore type (optional)
            AddMapEntry(new Color(100, 100, 100)); // Map color
            DustType = DustID.Stone;
            HitSound = SoundID.Tink;
            MinPick = 50; // Requires 50+ pickaxe power
        }
    }
}

Creating Furniture

Furniture tiles are more complex with placement rules:

public class ExampleChair : ModTile
{
    public override void SetStaticDefaults()
    {
        Main.tileFrameImportant[Type] = true; // Critical for furniture
        Main.tileNoAttach[Type] = true;
        TileID.Sets.HasOutlines[Type] = true;
        TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2);
        TileObjectData.newTile.CoordinateHeights = new[] { 16, 18 };
        TileObjectData.addTile(Type);
        AddMapEntry(new Color(120, 85, 60), "Example Chair");
        DustType = DustID.WoodFurniture;
        TileID.Sets.DisableSmartCursor[Type] = true;
    }
}

Common Tile Properties

tileSolid

Block is solid (can't walk through)

Main.tileSolid[Type] = true;

tileBlockLight

Block prevents light passing through

Main.tileBlockLight[Type] = true;

MinPick

Minimum pickaxe power to mine

MinPick = 100;

DustType

Particle effect when mined

DustType = DustID.Stone;

For complete ModTile documentation:

View Full Documentation