The information in this article is for Terraria v1.0.6.1.

The Main class is resposible for coordinating all the other classes and making sure they play nicely together. Since this class is the core of the game, changing any of the values could produce profound changes, including causing a game crash. That's not to say you shouldn't use this class - you should just be mindful of how your changes will affect things. Currently the only methods and properties that are accessible are the static ones (being that main doesn't have an object instance).
Main Class
Read More


Name Type Description
chestDepositHover bool N/A
chestDepositScale float N/A
chestLootHover bool N/A
chestLootScale float N/A
chestStackHover bool N/A
chestStackScale float N/A
curMusic int N/A
newMusic int N/A
shop Chest[] N/A
toggleFullscreen bool N/A

Static PropertiesEdit

Name Type Description
antLionTexture Texture2D
armorAlpha float
armorArmTexture Texture2D[]
armorArmTextureCount int
armorArmTextureMax int
armorBodyTexture Texture2D[]
armorBodyTextureCount int
armorBodyTextureMax int
armorHeadTexture Texture2D[]
armorHeadTextureCount int
armorHeadTextureMax int
armorHide bool
armorLegTexture Texture2D[]
armorLegTextureCount int
armorLegTextureMax int
autoGen bool
autoJoin bool
autoPass bool
autoPause bool
autoSave bool
autoShutdown bool
availableRecipe int[]
availableRecipeY float[]
background int
backgroundHeight int[]
backgroundTexture Texture2D[]
backgroundWidth int[]
blackTileTexture Texture2D
bloodMoon bool
boneArmTexture Texture2D
bottomWorld float
bubbleTexture Texture2D
buffAlpha float[]
buffName string[]
buffString string
buffTexture Texture2D[]
buffTextureCount int
buffTextureMax int
buffTip string[]
caveParrallax float
cBuff string Keychar for Quick Buff
cDown string Keychar for Down
cdTexture Texture2D
chain2Texture Texture2D
chain3Texture Texture2D
chain4Texture Texture2D
chain5Texture Texture2D
chain6Texture Texture2D
chainTexture Texture2D
chat2Texture Texture2D
chatBackTexture Texture2D
chatLength int
chatLine ChatLine[]
chatMode bool
chatRelease bool
chatText string
chatTexture Texture2D
cHeal string Keychar for Quick Heal
checkForSpawns int
chest Chest[]
chestText string
cHook string Keychar for Grappling Hook
cInv string Keychar for Inventory
cJump string Keychar for Jump
cLeft string Keychar for Move Left
clientPlayer Player
cloud Cloud[]
cloudLimit int
cloudTexture Texture2D[]
cMana string Keychar for Quick Mana
combatText CombatText[]
craftGuide bool
craftingAlpha float
craftingHide bool
cRight string Keychar for Move Right
cThrowItem string Keychar for Throw Item
cUp string Keychar for Up
curRelease int
cursorAlpha float
cursorColor Color
cursorColorDirection int
cursorScale float
cursorTexture Texture2D
dayTime bool Returns true if it's daytime, false if it's nighttime. (Terraria v. 1.1.2)
debuff bool[]
dedServ bool
defaultIP string
drawTime int
dungeonTiles int
dungeonX int
dungeonY int
dust Dust[]
dustTexture Texture2D
editSign bool
engine AudioEngine
evilTiles int
fadeCounter int
fadeTexture Texture2D
femalePantsTexture Texture2D
femaleShirtTexture Texture2D
femaleShirt2Texture Texture2D
femaleShoesTexture Texture2D
femaleUnderShirtTexture Texture2D
femaleUnderShirt2Texture Texture2D
fixedTiming bool
focusRecipe int
fontCombatText SpriteFont[]
fontDeathText SpriteFont
fontItemStack SpriteFont
fontMouseText SpriteFont
frameRate int
frameRelease bool
gameMenu bool
gamePaused bool
getIP string
getPort string
ghostTexture Texture2D
gore Gore[]
goreTexture Texture2D[]
goreTextureCount int
goreTextureMax int
grabSky bool
guideItem Item
hasArms HashSet<int>
hasFocus bool
hasHands HashSet<int>
HBLockTexture Texture2D[]
hcColor Color
heartTexture Texture2D
helpText int
hideUI bool
hotbarScale float[]
ignoreErrors bool
inputTextEnter bool
invAlpha float
invasionDelay int
invasionSize int
invasionType int
invasionWarn int
invasionX double
invDir float
inventoryBack10Texture Texture2D
inventoryBack2Texture Texture2D
inventoryBack3Texture Texture2D
inventoryBack4Texture Texture2D
inventoryBack5Texture Texture2D
inventoryBack6Texture Texture2D
inventoryBack7Texture Texture2D
inventoryBack8Texture Texture2D
inventoryBack9Texture Texture2D
inventoryBackTexture Texture2D
iS float
item Item[]
itemText ItemText[]
itemTexture Texture2D[]
itemTextureCount int
itemTextureMax int
jungleTiles int
keyState KeyboardState
lastItemUpdate int
lastNPCUpdate int
leftWorld float
libPath string
liquid Liquid[]
liquidBuffer LiquidBuffer[]
liquidTexture Texture2D[]
loadPlayer Player[]
loadPlayerPath string[]
loadWorld string[]
loadWorldPath string[]
logoTexture Texture2D
magmaBGFrame int
magmaBGFrameCounter int
manaTexture Texture2D
maxItemTypes int
maxItemUpdates int
maxMP int
maxNetPlayers int
maxNPCUpdates int
maxScreenH int
maxScreenW int
maxSectionsX int
maxSectionsY int
maxTilesX int
maxTilesY int
mcColor Color
menuFocus int
menuMode int
menuMultiplayer bool
menuServer bool
meteorTiles int
minScreenH int
minScreenW int
modVersion string
moonModY short
moonPhase int
moonTexture Texture2D
motd string Message of the day
mouseColor Color
mouseHC bool
mouseItem Item
mouseLeftRelease bool
mouseRightRelease bool
mouseState MouseState mouseState gives information about the position and state of the mouse and its buttons.
mouseTextColor byte
mouseTextColorChange int
music Cue[]
musicFade float[]
musicVolume float
myPlayer int
netMode int VERY useful property to be used for making multiplayer-friendly mods. 1=Client computer. 2=Server. Use in conjunction with NetMessage to handle server-side stuff.
netPlayCounter int
NewText String/int

Displays text on screen. Used as:

Main.NewText("This is the text", 175, 75, 255).

The three numbers refer to Red, Green, and Blue respectively for the chat color.

newWorldName string
ninjaTexture Texture2D
npc NPC[]

An array of all the NPCs in the world. (Further testing needed: it appears that the length is set to 201 with not all NPCs initialized. It also appears that the whoAmI values of NPCs refer to their position in this array)

npcChatFocus1 bool
npcChatFocus2 bool
npcChatFocus3 bool
npcChatRelease bool
npcChatText string
npcFrameCount int[]
npcShop int
npcTexture Texture2D[]
npcTextureCount int
npcTextureMax int
numAvailableRecipes int
numChatLines int
numClouds int The number of clouds
numDust int
numStars int
oldMouseState MouseState
oldStatusText string
player Player[]
playerBeltTexture Texture2D
playerEyesTexture Texture2D
playerEyeWhitesTexture Texture2D
playerHairTexture Texture2D[]
playerHairTextureCount int
playerHairTextureMax int
playerHands2Texture Texture2D
playerHandsTexture Texture2D
playerHeadTexture Texture2D
playerInventory bool
playerPantsTexture Texture2D
PlayerPath string
playerPathName string
playerShirtTexture Texture2D
playerShoesTexture Texture2D
playerUnderShirt2Texture Texture2D
playerUnderShirtTexture Texture2D
projectile Projectile[]
projectileTexture Texture2D[]
projectileTextureCount int
projectileTextureMax int
rand Random
raTexture Texture2D
recentIP string[]
recentPort int[]
recentWorld string[]
recipe Recipe[]
releaseUI bool
resetClouds bool
reTexture Texture2D
rightWorld float
rockLayer double
SavePath string
saveTimer int
screenHeight int
screenLastPosition Vector2
screenPosition Vector2
screenWidth int
serverStarting bool
showFrameRate bool
showItemOwner bool
showItemText bool
showSpam bool
showSplash bool
shroomCapTexture Texture2D
sign Sign[]
signBubble bool
signText string
signX int
signY int
skipMenu bool
soundBank ???
soundChat SoundEffect
soundCoins SoundEffect
soundDig SoundEffect[]
soundDoorClosed SoundEffect
soundDoorOpen SoundEffect
soundDoubleJump SoundEffect
soundDrown SoundEffect
soundFemaleHit SoundEffect[]
soundGrab SoundEffect
soundGrass SoundEffect
soundInstanceChat SoundEffectInstance
soundInstanceCoins SoundEffectInstance
soundInstanceDig SoundEffectInstance[]
soundInstanceDoorClosed SoundEffectInstance
soundInstanceDoorOpen SoundEffectInstance
soundInstanceDoubleJump SoundEffectInstance
soundInstanceDrown SoundEffectInstance
soundInstanceFemaleHit SoundEffectInstance[]
soundInstanceGrab SoundEffectInstance
soundInstanceGrass SoundEffectInstance
soundInstanceItem SoundEffectInstance[]
soundInstanceMaxMana SoundEffectInstance
soundInstanceMenuClose SoundEffectInstance
soundInstanceMenuOpen SoundEffectInstance
soundInstanceMenuTick SoundEffectInstance
soundInstanceNPCHit SoundEffectInstance[]
soundInstanceNPCKilled SoundEffectInstance[]
soundInstancePlayerHit SoundEffectInstance[]
soundInstancePlayerKilled SoundEffectInstance
soundInstanceRoar SoundEffectInstance[]
soundInstanceRun SoundEffectInstance
soundInstanceShatter SoundEffectInstance
soundInstanceSplash SoundEffectInstance[]
soundInstanceTink SoundEffectInstance[]
soundInstanceUnlock SoundEffectInstance
soundInstanceZombie SoundEffectInstance[]
soundItem SoundEffect[]
soundMaxMana SoundEffect
soundMenuClose SoundEffect
soundMenuOpen SoundEffect
soundMenuTick SoundEffect
soundNPCHit SoundEffect[]
soundNPCKilled SoundEffect[]
soundPlayerHit SoundEffect[]
soundPlayerKilled SoundEffect
soundRoar SoundEffect[]
soundRun SoundEffect
soundShatter SoundEffect
soundSplash SoundEffect[]
soundTink SoundEffect[]
soundUnlock SoundEffect
soundVolume float
soundZombie SoundEffect[]
spamCount int
spawnTileX int
spawnTileY int
spikeBaseTexture Texture2D
splashTexture Texture2D
stackCounter int
stackDelay int
stackSplit int
star Star[]
starTexture Texture2D[]
statusText string
stopTimeOuts bool
sun2Texture Texture2D
sunModY short
sunTexture Texture2D
tConfigHash string
teamColor Color[]
teamCooldown int
teamCooldownLen int
teamTexture Texture2D
textBackTexture Texture2D
tile Tile[,]
tileAlch bool[]
tileBlockLight bool[]
tileColor Color
tileCount int[] A map of the number of tiles (indexed by tile type) 'near' the current player. Used for checking the player's current biome.
tileCut bool[]
tileDropName string[]
tileDungeon bool[]
tileFrameImportant bool[]
tileHeight int[]
tileLavaDeath bool[]
tileMergeDirt bool[]
tileName string[]
tileNoAttach bool[]
tileNoFail bool[]
tilePretendType int[]
tileShine int[]
tilesLoaded bool
tileSolid bool[]
tileSolidTop bool[]
tileStone bool[]
tileTable bool[]
tileTexture Texture2D[]
tileTextureCount int
tileTextureMax int
tileWaterDeath bool[]
tileWidth int[]
time double

Used in conjuction with Main.dayTime to determine time of day. (Terraria v. 1.1.2)

If Main.dayTime == true, Main.time goes from 0.0 (dawn) to 54000.0 (nightfall) and resets.

If Main.dayTime == false, Main.time goes from 0.0 (nightfall) to 32400.0 (dawn) and resets. 16200.0 (midnight) is in the middle.

timeOut int
topWorld float
trashItem Item
trashTexture Texture2D
treeBranchTexture Texture2D[]
treeTopTexture Texture2D[]
updateTime int
verboseNetplay bool
versionNumber string
versionNumber2 string
wallHouse bool[]
wallTexture Texture2D[]
wallTextureCount int
wallTextureMax int
waveBank WaveBank
windSpeed float
windSpeedSpeed float
worldID int
worldName string
WorldPath string
worldPathName string
worldSurface double


Method Name Description
None N/A

Static MethodsEdit

Method Name Description
public static Item armorSwap(Item newItem)

Swaps the equipped item on right click?

  • Returns ??? as Item
public static void BankCoins()


  • Returns no value
public static double CalculateDamage(int Damage, int Defense)

Calculates the damage that would be dealt, for a given

  • Returns the final damage as double
public static void ChestCoins()


  • Returns no value
public static void CursorColor()


  • Returns no value
public static int DamageVar(float dmg)


  • Returns ??? as int
public static IntPtr FindWindow(string lpClassName, string lpWindowName)

This is a wrap around the native WinAPI FindWindow function. This function finds window with caption lpWindowName and window's class name (see ).

  • Returns handle to the window that has the specified class name and window name
public string GetInputText(string oldString)


  • Returns ??? as string
public static short GetKeyState(int keyCode)


  • Returns ??? as short
public static IntPtr LoadLibrary(string dllToLoad)

Loads a .dll library?

  • Returns ??? as IntPtr


Here are some links from an older version of this page for various variable types. These should really be located elsewhere, but until that page is up, this shall suffice.

Classes in Terraria

Chest | Cloud | Collision | Dust | Gore | Item | Lighting | Liquid | Main | NPC | Player | Projectile | Recipe | Sign | Star | WorldGen