tModLoader v2024.09
A mod to make and play Terraria mods
Main Class Reference

Inherits Game.

Classes

class  CurrentFrameFlags
 
struct  CurrentPlayerOverride
 
struct  InfoToSetBackColor
 
class  NativeMethods
 
struct  SceneArea
 
class  TextDisplayCache
 

Public Types

enum  WorldPreparationState { AwaitingData , ProcessingData , Ready }
 

Public Member Functions

void autoCreate (string worldSize)
 
void AutoHost ()
 
void AutoJoin (string IP, string player=null)
 
void AutoPass ()
 
void ClearCachedTileDraws ()
 
void DedServ ()
 
void DrawCapture (Microsoft.Xna.Framework.Rectangle area, CaptureSettings settings)
 
void DrawHealthBar (float X, float Y, int Health, int MaxHealth, float alpha, float scale=1f, bool noFlip=false)
 Draws a small health bar.
spriteBatch should already be started before calling this method. More...
 
void DrawInfernoRings ()
 
void DrawInterface_Resources_Buffs ()
 
void DrawItems ()
 
void DrawMouseOver ()
 
void DrawNPC (int iNPCIndex, bool behindTiles)
 
void DrawNPCCheckAlt (NPC n)
 
void DrawNPCDirect (SpriteBatch mySpriteBatch, NPC rCurrentNPC, bool behindTiles, Vector2 screenPos)
 
void DrawNPCDirect_QueenSlimeWings (NPC rCurrentNPC, SpriteBatch mySpriteBatch, Vector2 screenPos, Vector2 drawCenter, Microsoft.Xna.Framework.Color originColor)
 
void DrawProj (int i)
 
void DrawProjDirect (Projectile proj)
 
void DrawSimpleSurfaceBackground (Vector2 areaPosition, int areaWidth, int areaHeight)
 
void DrawTileCracks (int crackType, HitTile hitter)
 
void DrawWindowsIMEPanel (Vector2 position, float xAnchor=0f)
 
void EnableAutoShutdown ()
 
static IntPtr FindWindow (string lpClassName, string lpWindowName)
 
void FullscreenStartup ()
 
static short GetKeyState (int keyCode)
 
void GUIBarsDraw ()
 
void GUIChatDraw ()
 
void HandleIME ()
 
void LoadAccBack (int i)
 
void LoadAccBalloon (int i)
 
void LoadAccBeard (int i)
 
void LoadAccFace (int i)
 
void LoadAccFront (int i)
 
void LoadAccHandsOff (int i)
 
void LoadAccHandsOn (int i)
 
void LoadAccNeck (int i)
 
void LoadAccShield (int i)
 
void LoadAccShoes (int i)
 
void LoadAccWaist (int i)
 
void LoadArmorBody (int i)
 
void LoadArmorHead (int i)
 
void LoadArmorLegs (int i)
 
void LoadBackground (int i)
 
void LoadDedConfig (string configPath)
 
void LoadFlameRing ()
 
void LoadGore (int i)
 
void LoadHair (int i)
 
void LoadItem (int i)
 Loads the item texture if needed. All modded item textures are already loaded during mod loading so this is only needed before accessing vanilla item textures. Use TextureAssets.Item to access the item texture: TextureAssets.Item[Type].Value More...
 
void LoadItemFlames (int i)
 
void loadLib (string path)
 
static IntPtr LoadLibrary (string dllToLoad)
 
void LoadNPC (int i)
 Loads the NPC texture if needed. All modded NPC textures are already loaded during mod loading so this is only needed before accessing vanilla NPC textures. Use TextureAssets.Npc to access the NPC texture: TextureAssets.Npc[Type].Value More...
 
void LoadProjectile (int i)
 Loads the projectile texture if needed. All modded projectile textures are already loaded during mod loading so this is only needed before accessing vanilla projectile textures. Use TextureAssets.Projectile to access the projectile texture: TextureAssets.Projectile[Type].Value More...
 
void LoadTiles (int i)
 Loads the tile texture if needed. All modded tile textures are already loaded during mod loading so this is only needed before accessing vanilla tile textures. Use TextureAssets.Tile to access the tile texture: TextureAssets.Tile[Type].Value More...
 
void LoadWall (int i)
 Loads the wall texture if needed. All modded wall textures are already loaded during mod loading so this is only needed before accessing vanilla wall textures. Use TextureAssets.Wall to access the tile texture: TextureAssets.Wall[Type].Value More...
 
void LoadWings (int i)
 
void MouseText (string cursorText, int rare=0, byte diff=0, int hackedMouseX=-1, int hackedMouseY=-1, int hackedScreenWidth=-1, int hackedScreenHeight=-1, int pushWidthX=0)
 Sets the tooltip text to be drawn next to the cursor. If used in conjunction with Main.HoverItem, an item tooltip will be shown, otherwise the text will be drawn as is with no background box. Similar to Main.hoverItemName except it will still show if an item is held on the mouse. Use UICommon.TooltipMouseText(string) instead to draw a non-item tooltip with the hover text background boxes, if that setting is not disabled by the user.
 
void MouseText (string cursorText, string buffTooltip, int rare=0, byte diff=0, int hackedMouseX=-1, int hackedMouseY=-1, int hackedScreenWidth=-1, int hackedScreenHeight=-1, int pushWidthX=0, bool noOverride=false)
 
void MouseTextHackZoom (string text, int itemRarity, byte diff=0, string buffTooltip=null)
 
void MouseTextHackZoom (string text, string buffTooltip=null)
 
void MouseTextNoOverride (string cursorText, int rare=0, byte diff=0, int hackedMouseX=-1, int hackedMouseY=-1, int hackedScreenWidth=-1, int hackedScreenHeight=-1, int pushWidthX=0)
 
void NeverSleep ()
 
void NewMOTD (string newMOTD)
 
void oldDrawWater (bool bg=false, int Style=0, float Alpha=1f)
 
delegate void OnPlayerSelected (PlayerFileData player)
 
void OnTileChangeEvent (int x, int y, int count, TileChangeType eventType)
 
void PrepareDrawnEntityDrawing (Entity entity, int intendedShader, Matrix? overrideMatrix)
 
void PrepareDrawnProjectileDrawing (Projectile proj)
 
void ResetAllContentBasedRenderTargets ()
 
void SetMouseNPC (int index, int type)
 
void SetMouseNPC_ToHousingQuery ()
 
void SetNetPlayers (int mPlayers)
 
void setServerWorldRollbacks (string rollBacksToKeep)
 
void SetWorld (string world, bool cloud)
 
void SetWorldName (string world)
 
bool ShouldUpdateEntities ()
 
void updateCloudLayer ()
 
void UpdateDisplaySettings ()
 
void UpdateParticleSystems ()
 
void UpdateViewZoomKeys ()
 
void UpdateWeather (GameTime gameTime, int currentDayRateIteration)
 
void YouCanSleepNow ()
 
- Public Member Functions inherited from Game
void Dispose ()
 
void Exit ()
 
void ResetElapsedTime ()
 
void Run ()
 
void RunOneFrame ()
 
void SuppressDraw ()
 
void Tick ()
 

Static Public Member Functions

static void AddSignalTraps ()
 
static void Ambience ()
 
static void AnglerQuestSwap ()
 
static void AnimateTiles_CritterCages ()
 
static bool AnyPlayerReadyToFightKingSlime ()
 
static Microsoft.Xna.Framework.Color buffColor (Microsoft.Xna.Framework.Color newColor, float R, float G, float B, float A)
 
static void BuilderTogglePageHandler (int startY, int activeToggles, out bool moveDownForButton, out int startIndex, out int endIndex)
 
static void BuyHairWindow ()
 
static int CalculateWaterStyle (bool ignoreFountains=false)
 
static void CancelClothesWindow (bool quiet=false)
 
static void CancelHairWindow ()
 
static bool CanDryadPlayStardewAnimation (Player player, NPC npc)
 
static bool CanPlayCreditsRoll ()
 
static bool CanStartInvasion (int type=1, bool ignoreDelay=false)
 
static void CheckForMoonEventsScoreDisplay ()
 
static void CheckForMoonEventsStartingTemporarySeasons ()
 
static void checkHalloween ()
 
static void CheckInvasionProgressDisplay ()
 
static void checkXMas ()
 
static void ClearPendingPlayerSelectCallbacks ()
 
static void ClearSmartInteract ()
 
static void CloseNPCChatOrSign ()
 
static void ClosePlayerChat ()
 
static void clrInput ()
 Clears text input from any keys pressed since the last time GetInputText was called. Call when activating a menu with text input or focusing an element with text input to prevent keys pressed beforehand to be immediately captured as input.
 
static string ConvertFromSafeArgument (string arg)
 
static int ConvertPaintIdToTileShaderIndex (int paintIndexOnTile, bool isUsedForPaintingGrass, bool useWallShaderHacks)
 
static string ConvertToSafeArgument (string arg)
 
static void CraftItem (Recipe r)
 
static void CursorColor ()
 
static void CycleFrameSkipMode ()
 
static int DamageVar (float dmg, float luck=0f)
 Multiplies the input damage by a random value between 0.85f and 1.15f. More...
 
static int DamageVar (float dmg, int percent, float luck=0f)
 
static void DoUpdate_AnimateItemIcons ()
 
static int DrawBuffIcon (int drawBuffText, int buffSlotOnPlayer, int x, int y)
 Draws the buff icon corresponding to the buff in Main.LocalPlayer.buffType[buffSlotOnPlayer ]. More...
 
static void DrawCursor (Vector2 bonus, bool smart=false)
 
static void DrawGamepadInstructions ()
 
static void DrawInterface_29_SettingsButton ()
 
static void DrawInterface_Resources_ClearBuffs ()
 
static void DrawInvasionProgress ()
 
static void DrawItemIcon (SpriteBatch spriteBatch, Item theItem, Vector2 screenPositionForItemCenter, Microsoft.Xna.Framework.Color itemLightColor, float sizeLimit)
 
static Vector2 DrawPlayerItemPos (float gravdir, int itemtype)
 
static void DrawSettingButton (ref bool mouseOver, ref float scale, int posX, int posY, string text, string textSizeMatcher, Action clickAction)
 
static Vector2 DrawThickCursor (bool smart=false)
 
static void DrawTileInWater (Vector2 drawOffset, int x, int y)
 
static void DrawWallOfFish ()
 
static void DrawWallOfStars ()
 
static Vector2 DrawWhip_BoneWhip (Projectile proj, List< Vector2 > controlPoints)
 
static Vector2 DrawWhip_CoolWhip (Projectile proj, List< Vector2 > controlPoints)
 
static Vector2 DrawWhip_FireWhip (Projectile proj, List< Vector2 > controlPoints)
 
static Vector2 DrawWhip_RainbowWhip (Projectile proj, List< Vector2 > controlPoints)
 
static Vector2 DrawWhip_ThornWhip (Projectile proj, List< Vector2 > controlPoints)
 
static Vector2 DrawWhip_WhipBland (Projectile proj, List< Vector2 > controlPoints)
 
static Vector2 DrawWhip_WhipMace (Projectile proj, List< Vector2 > controlPoints)
 
static Vector2 DrawWhip_WhipScythe (Projectile proj, List< Vector2 > controlPoints)
 
static Vector2 DrawWhip_WhipSword (Projectile proj, List< Vector2 > controlPoints)
 
static void EntitySpriteDraw (DrawData data)
 
static void EntitySpriteDraw (Texture2D texture, Vector2 position, Microsoft.Xna.Framework.Rectangle? sourceRectangle, Microsoft.Xna.Framework.Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float worthless=0f)
 
static void EntitySpriteDraw (Texture2D texture, Vector2 position, Microsoft.Xna.Framework.Rectangle? sourceRectangle, Microsoft.Xna.Framework.Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float worthless=0f)
 
static void ExecuteCommand (string text, CommandCaller commandCaller)
 
static void FakeLoadInvasionStart ()
 
static void FindAnnouncementBoxStatus ()
 
static void FixUIScale ()
 
static void GetAreaToLight (out int firstTileX, out int lastTileX, out int firstTileY, out int lastTileY)
 
static BestiaryUnlockProgressReport GetBestiaryProgressReport ()
 
static string GetBuffTooltip (Player player, int buffType)
 
static string GetInputText (string oldString, bool allowMultiLine=false)
 
static void GetItemDrawFrame (int item, out Texture2D itemTexture, out Microsoft.Xna.Framework.Rectangle itemFrame)
 Gets the texture and frame of the given item type (Item.type). More...
 
static MoonPhase GetMoonPhase ()
 The current moon phaseexpressed as a MoonPhase. Use moonPhase to get the moon phase as an int instead.
 
static Vector2 GetPlayerArmPosition (Projectile proj)
 
static Microsoft.Xna.Framework.Color GetPlayerHeadBordersColor (Player plr)
 
static string GetPlayerPathFromName (string playerName, bool cloudSave)
 
static int GetPreferredBGStyleForPlayer ()
 
static int GetProjectileDesiredShader (Projectile proj)
 
static Microsoft.Xna.Framework.Point GetScreenOverdrawOffset ()
 
static string GetWorldPathFromName (string worldName, bool cloudSave)
 
static void GoToWorldSelect ()
 
static Microsoft.Xna.Framework.Color hslToRgb (float Hue, float Saturation, float Luminosity, byte a=byte.MaxValue)
 
static Microsoft.Xna.Framework.Color hslToRgb (Vector3 hslVector)
 
static double hue2rgb (double c, double t1, double t2)
 
static void InfoDisplayPageHandler (int startX, ref string mouseText, out int startingDisplay, out int endingDisplay)
 
static void InitializeItemAnimations ()
 
static void InputTextChest ()
 
static void InputTextSign ()
 
static void InputTextSignCancel ()
 
static bool InSmartCursorHighlightArea (int x, int y, out bool actuallySelected)
 
static bool IsFastForwardingTime ()
 
static bool IsItDay ()
 Similar to dayTime, but always returns false in remixWorld worlds. This should be used instead of dayTime for logic taking into account the state of the world rather the specific hour. Some examples include boss spawners and boss despawn behaviors.
 
static bool IsLiquidStyleWater (int liquidStyle)
 
static bool IsNPCActiveAndOneOfTypes (int npcIndex, params int[] types)
 
static bool IsTileBiomeSightable (int tileX, int tileY, ref Color sightColor)
 Checks if a tile at the given coordinates counts towards tile coloring from the Biome Sight buff.
 
static bool IsTileSpelunkable (int tileX, int tileY)
 Checks if a tile at the given coordinates counts towards tile coloring from the Spelunker buff, and is detected by various pets.
 
static void ItemIconCacheUpdate (int selectedItemID)
 
static void ItemIconCacheVerification ()
 
static void LoadPlayers ()
 
static void LoadTestLog (string logname)
 
static void LoadWorlds ()
 
static void LockCraftingForThisCraftClickDuration ()
 
static void Moondialing ()
 
static void MouseText_DrawItemTooltip_GetLinesInfo (Item item, ref int yoyoLogo, ref int researchLine, float oldKB, ref int numLines, string[] toolTipLine, bool[] preFixLine, bool[] badPreFixLine, string[] toolTipNames, out int prefixlineIndex)
 
static void NewLightning ()
 
static void NewText (object o, Color? color=null)
 
static void NewText (string newText, byte R=byte.MaxValue, byte G=byte.MaxValue, byte B=byte.MaxValue)
 Spawns chat text on the local client. Does nothing on the server. To send chat text from the server, use one of the following:
• Terraria.Chat.ChatHelper.BroadcastChatMessage(NetworkText, Color, int) sends a message from the server to be displayed in chat for all clients.
• Terraria.Chat.ChatHelper.SendChatMessageToClient(NetworkText, Color, int) sends a message from the server to be displayed in chat for a specific client. For floating text, such as damage, see CombatText

 
static void NewTextMultiline (string text, bool force=false, Microsoft.Xna.Framework.Color c=default(Microsoft.Xna.Framework.Color), int WidthLimit=-1)
 
static void NotifyOfEvent (GameNotificationType type)
 
static float NPCAddHeight (NPC theNPC)
 
static void OnSubmitServerIP (string inputText)
 
static void OpenCharacterSelectUI ()
 
static void OpenClothesWindow ()
 
static void OpenHairWindow ()
 
static void OpenPlayerChat ()
 
static void OpenPlayerSelect (OnPlayerSelected method)
 
static void OpenReportsMenu ()
 
static void OpenResourcePacksMenu (UIState uiStateToGoBackTo)
 
static void OpenWorldSelectUI ()
 
static void PlayInteractiveProjectileOpenCloseSound (int projType, bool open)
 
static void PrintTimedMessage (string message, params object[] arguments)
 
static void QueueMainThreadAction (Action action)
 
static Microsoft.Xna.Framework.Color quickAlpha (Microsoft.Xna.Framework.Color oldColor, float Alpha)
 
static void RegisterItemAnimation (int index, DrawAnimation animation)
 Registers an animation for an item type to draw inside UI (not world or held item on player). To enable its animation in the world, use ItemID.Sets.AnimatesAsSoul in conjunction with this More...
 
static void ReleaseHostAndPlayProcess ()
 
static void ReportInvasionProgress (int progress, int progressMax, int icon, int progressWave)
 
static void ResetKeyBindings ()
 
static void ResetWindCounter (bool resetExtreme=false)
 
static Microsoft.Xna.Framework.Point ReverseGravitySupport (Microsoft.Xna.Framework.Point pos, int height=0)
 
static Microsoft.Xna.Framework.Rectangle ReverseGravitySupport (Microsoft.Xna.Framework.Rectangle box)
 
static Vector2 ReverseGravitySupport (Vector2 pos, float height=0f)
 
static Vector3 rgbToHsl (Microsoft.Xna.Framework.Color newColor)
 
static Task RunOnMainThread (Action action)
 Wait for an action to be performed on the main thread. More...
 
static Task< T > RunOnMainThread< T > (Func< T > func)
 Wait for an action to be performed on the main thread. More...
 
static void SaveClothesWindow ()
 
static void SaveRecent ()
 
static bool SaveSettings ()
 
static void SelectPlayer (PlayerFileData data)
 
static void SetCameraGamepadLerp (float lerp)
 
static void SetCameraLerp (float lerp, int time)
 
static void SetDisplayMode (int width, int height, bool fullscreen)
 
static void SetFullScreen (bool fullscreen)
 
static void SetNPCShopIndex (int index)
 
static void SetRecommendedZoomContext (Matrix matrix)
 
static void SetResolution (int width, int height)
 
static void SetupTileMerge ()
 
static Microsoft.Xna.Framework.Color shine (Microsoft.Xna.Framework.Color newColor, int type)
 
static void shine (ref Vector3 newColor, int type)
 
static bool ShouldNormalEventsBeAbleToStart ()
 
static bool ShouldShowInvisibleWalls ()
 
static void SkipToTime (int timeToSet, bool setIsDayTime)
 
static void snowing ()
 
static double starGameMath (double value=1.0)
 
static void StartClientGameplay ()
 
static void startDedInput ()
 
static void startDedInputCallBack ()
 
static void StartInvasion (int type=1)
 
static void startPumpkinMoon ()
 
static void StartRain ()
 Starts rain for a random amount of time. Should be called on the server (netMode != client) - vanilla syncs it using SyncRain.
You can also call this on the client to update visuals immediately, assuming it was/will be called serverside as well (Journey Mode rain slider does this).
 
static void StartSlimeRain (bool announce=true)
 
static void startSnowMoon ()
 
static void stopMoonEvent ()
 
static void StopRain ()
 Stops rain. Should be called on the server (netMode != client) - vanilla syncs it using SyncRain.
You can also call this on the client to update visuals immediately, assuming it was called serverside as well (Journey Mode rain slider does this).
 
static void StopSlimeRain (bool announce=true)
 
static void SubmitSignText ()
 
static void Sundialing ()
 
static void SwitchNetMode (int mode)
 
static void SyncAnInvasion (int toWho)
 
static void SyncRain ()
 Syncs rain state if StartRain or StopRain were called in the same tick and caused a change to

See also
maxRaining

.
Can be called on any side, but only the server will actually sync it.

 
static void TeleportEffect (Microsoft.Xna.Framework.Rectangle effectRect, int Style, int extraInfo=0, float dustCountMult=1f, TeleportationSide side=TeleportationSide.Entry, Vector2 otherPosition=default(Vector2))
 
static void ToggleFullScreen ()
 
static void ToggleGameplayUpdates (bool state)
 
static void TriggerPing (Vector2 position)
 
static bool TryGetBuffTime (int buffSlotOnPlayer, out int buffTimeValue)
 Checks if the buff at index buffSlotOnPlayer is allowed to draw a "remaining time" text, and sets buffTimeValue to it. More...
 
static void TryRemovingBuff (int i, int b)
 Calls Player.DelBuff with index i after checking Main.debuff of buff type b. Will toggle Player.hideMisc for pet and light pet. More...
 
static void TryRemovingBuff_CheckBuffHideMisc (int slot, int buffID)
 
static void TrySetPreparationState (WorldPreparationState state)
 
static int UnlockedMaxHair ()
 
static void UpdateTime_StartDay (ref bool stopEvents)
 
static void UpdateTime_StartNight (ref bool stopEvents)
 
static void UpdateTimeRate ()
 
static void UpdateTimeRate_Inner ()
 
static void UpdateWorldPreparationState ()
 
static string ValueToCoins (long value)
 
static bool WallLightAt (int i, int j)
 
static bool WallLightAt (int i, int j, bool showInvisibleWalls)
 
static void WeGameRequireExitGame ()
 

Public Attributes

RenderTarget2D backgroundTarget
 
RenderTarget2D backWaterTarget
 
RenderTarget2D blackTarget
 
CameraModifierStack CameraModifiers = new CameraModifierStack()
 
bool chestCancelHover
 
float chestCancelScale = 1f
 
bool chestDepositHover
 
float chestDepositScale = 1f
 
bool chestLootHover
 
float chestLootScale = 1f
 
bool chestRenameHover
 
float chestRenameScale = 1f
 
bool chestStackHover
 
float chestStackScale = 1f
 
ChumBucketProjectileHelper ChumBucketProjectileHelper = new ChumBucketProjectileHelper()
 
int currentNPCShowingChatBubble = -1
 
int DiscoStyle
 
List< int > DrawCacheFirstFractals = new List<int>(1000)
 
List< int > DrawCacheNPCProjectiles = new List<int>(200)
 
List< int > DrawCacheNPCsBehindNonSolidTiles = new List<int>(200)
 
List< int > DrawCacheNPCsMoonMoon = new List<int>(200)
 
List< int > DrawCacheNPCsOverPlayers = new List<int>(200)
 
List< int > DrawCacheProjsBehindNPCs = new List<int>(1000)
 
List< int > DrawCacheProjsBehindNPCsAndTiles = new List<int>(1000)
 
List< int > DrawCacheProjsBehindProjectiles = new List<int>(1000)
 
List< int > DrawCacheProjsOverPlayers = new List<int>(1000)
 
List< int > DrawCacheProjsOverWiresUI = new List<int>(1000)
 
bool gammaTest
 
int invBottom = 210
 
RenderTarget2D mapSectionTexture
 
RenderTarget2D[,] mapTarget = new RenderTarget2D[mapTargetX, mapTargetY]
 
int mouseNPCIndex = -1
 
int mouseNPCType = -1
 
bool playOldTile
 
RejectionMenuInfo RejectionMenuInfo
 
Chest[] shop = new Chest[2]
 
SpelunkerProjectileHelper SpelunkerProjectileHelper = new SpelunkerProjectileHelper()
 
int textBlinkerCount
 
int textBlinkerState
 
RenderTarget2D tile2Target
 
TilePaintSystemV2 TilePaintSystem
 
TileDrawing TilesRenderer
 
RenderTarget2D tileTarget
 
bool unityMouseOver
 
WallDrawing WallsRenderer
 
RenderTarget2D wallTarget
 
WaterfallManager waterfallManager
 

Static Public Attributes

static GameTime _drawInterfaceGameTime
 
static UnifiedRandom _rand
 
static bool _shouldUseStormMusic = false
 
static bool _shouldUseWindyDayMusic = false
 
static float aBar = 1f
 
static UIAchievementsMenu AchievementsMenu = new UIAchievementsMenu()
 
static IMultiplayerClosePlayersOverlay ActiveClosePlayersTeamOverlay = new NewMultiplayerClosePlayersOverlay()
 
static PlayerFileData ActivePlayerFileData = new PlayerFileData()
 
static WorldFileData ActiveWorldFileData = new WorldFileData()
 
static bool afterPartyOfDoom = false
 
static bool allChestStackHover
 
static bool AllowUnfocusedInputOnGamepad
 
static bool alreadyGrabbingSunOrMoon
 
static AmbienceServer AmbienceServer
 
static int ambientCounter
 
static int ambientError
 
static float ambientLavafallStrength = 0f
 
static float ambientLavafallX = -1f
 
static float ambientLavafallY = -1f
 
static float ambientLavaStrength
 
static float ambientLavaX = -1f
 
static float ambientLavaY = -1f
 
static float ambientVolume = 1f
 
static float ambientWaterfallStrength = 0f
 
static float ambientWaterfallX = -1f
 
static float ambientWaterfallY = -1f
 
static int anglerQuest
 
static bool anglerQuestFinished
 
static int[] anglerQuestItemNetIDs
 
static List< string > anglerWhoFinishedToday = new List<string>()
 
static bool AnnouncementBoxDisabled
 
static int AnnouncementBoxRange = -1
 
static float armorAlpha = 1f
 
static bool armorHide
 
const string assemblyVersionNumber = "1.4.4.9"
 
static IAssetRepository Assets
 
static AssetSourceController AssetSourceController
 
static float atmo
 
static IAudioSystem audioSystem
 
static bool autoGen
 
static string autoGenFileLocation = null
 
static GenerationProgress AutogenProgress = new GenerationProgress()
 
static string AutogenSeedName
 
static bool autoJoin
 
static bool autoPass
 
static bool autoPause = false
 
static bool autoSave = true
 
static bool autoShutdown
 
static int[] availableRecipe = new int[Recipe.maxRecipes]
 Contains recipe indexes (Recipe.RecipeIndex) of the recipes currently being shown in the UI, either for crafting or a Guide query.
 
static float[] availableRecipeY = new float[Recipe.maxRecipes]
 
static int background
 
static bool BackgroundEnabled = true
 
static int[] backgroundHeight = new int[maxBackgrounds]
 
static SpriteViewMatrix BackgroundViewMatrix
 
static int[] backgroundWidth = new int[maxBackgrounds]
 
static bool bannerMouseOver
 
static int BartenderHelpTextIndex = 0
 
static BestiaryDatabase BestiaryDB
 
static BestiaryUnlocksTracker BestiaryTracker
 
static UIBestiaryTest BestiaryUI
 
static bool betterDebugRelease
 
static float[] bgAlphaFarBackLayer = new float[14]
 
static float[] bgAlphaFrontLayer = new float[14]
 
static int bgDelay
 
static int[] bgFrame = new int[14]
 
static int[] bgFrameCounter = new int[14]
 
static int bgScroll
 
static int bgStyle
 
static BigProgressBarSystem BigBossProgressBar = new BigProgressBarSystem()
 
static int[] birdCageFrame = new int[cageFrames]
 
static int[] birdCageFrameCounter = new int[cageFrames]
 
static int BlackFadeIn
 
static bool blockInput = false
 
static string blockKey = Microsoft.Xna.Framework.Input.Keys.None.ToString()
 
static bool blockMouse
 
static bool bloodMoon
 If true a Blood Moonis currently happening.
 
static int[] blueBirdCageFrame = new int[cageFrames]
 
static int[] blueBirdCageFrameCounter = new int[cageFrames]
 
static NPCHeadRenderer BossNPCHeadRenderer = null
 
static float bottomWorld = 38400f
 
static float[] buffAlpha = new float[BuffID.Count]
 
static bool[] buffDoubleApply = new bool[BuffID.Count]
 
static bool[] buffNoSave = new bool[BuffID.Count]
 Indexed by BuffID. If true for a given BuffID, then that buff will not be saved when exiting a world.
Vanilla sets this for DoT effects (BuffID.Poisoned), short item buffs (BuffID.Panic), mount buffs, and conditionally-applied buffs (BuffID.Campfire, BuffID.Werewolf).
Defaults to false.
 
static bool[] buffNoTimeDisplay = new bool[BuffID.Count]
 Prevents status effects which have their entries set to true from displaying the amount of time they have left.
Defaults to false; most, if not all, status effects which have their entries set to true here are related to mounts, pets, and summons.

 
static int buffScanAreaHeight = (maxScreenH + 800) / 16 - 1
 
static int buffScanAreaWidth = (maxScreenW + 800) / 16 - 1
 
static string buffString = ""
 
static int[] bunnyCageFrame = new int[cageFrames]
 
static int[] bunnyCageFrameCounter = new int[cageFrames]
 
static int[,] butterflyCageFrame = new int[9, cageFrames]
 
static int[,] butterflyCageFrameCounter = new int[9, cageFrames]
 
static byte[,] butterflyCageMode = new byte[9, cageFrames]
 
static int cageFrames = 25
 
static Camera Camera = new Camera()
 
static float cameraX
 
static bool cancelWormHole = false
 
static bool CaptureModeDisabled = false
 
static int caveBackground = 0
 
static int[] caveBackStyle = new int[4]
 
static int[] caveBackX = new int[4]
 
static float caveParallax = 0.88f
 
static string cBuff = "B"
 
static string cDown = "S"
 
static string cFavoriteKey = "LeftAlt"
 
static bool changeTheTitle
 
static IChatMonitor chatMonitor = new RemadeChatMonitor()
 
static bool chatRelease
 
static string chatText = ""
 
static string cHeal = "H"
 
static int checkForSpawns
 
static Chest[] chest = new Chest[8000]
 Contains all the placed chests in the world. This includes dressers and chests, but not player storage such as piggy bank and safe.
 
static string cHook = "E"
 
static ChromaEngine Chroma
 
static ChromaHotkeyPainter ChromaPainter
 
static string cInv = "Escape"
 
static string cJump = "Space"
 
static bool clearMap
 
static string cLeft = "A"
 
static Player clientPlayer = new Player()
 Used internally for network syncing. Use Main.LocalPlayer to access the player for the local user.
 
static string clientUUID
 
static bool clothesWindow
 
static Cloud[] cloud = new Cloud[200]
 
static float cloudAlpha
 
static int[] cloudBG
 
static float cloudBGActive
 
static float cloudBGAlpha
 
static float[] cloudBGX = new float[2]
 
static FavoritesFile CloudFavoritesData = new FavoritesFile("ModLoader/favorites.json", true)
 
static string CloudPlayerPath = Program.SaveFolderName + "/players"
 
static string CloudWorldPath = Program.SaveFolderName + "/worlds"
 
static string cMana = "J"
 
static string cMapAlphaDown = "PageDown"
 
static string cMapAlphaUp = "PageUp"
 
static string cMapFull = "M"
 
static string cMapStyle = "Tab"
 
static string cMapZoomIn = "Add"
 
static string cMapZoomOut = "Subtract"
 
static string cMount = "R"
 
static int colorDelay
 
static Microsoft.Xna.Framework.Color ColorOfTheSkies
 
static CombatText[] combatText = new CombatText[100]
 
static Preferences Configuration = new Preferences(SavePath + Path.DirectorySeparatorChar + "config.json")
 
static bool ContentLoaded = false
 
static List< INeedRenderTargetContentContentThatNeedsRenderTargets = new List<INeedRenderTargetContent>()
 
const string copyrightText = "Copyright © 2022 Re-Logic"
 
static int[] corruptBG = new int[3]
 
static bool[] countsAsHostForGameplay = new bool[256]
 
static float craftingAlpha = 1f
 
static bool craftingHide
 
static CreativeUI CreativeMenu = new CreativeUI()
 
static Microsoft.Xna.Framework.Color creativeModeColor = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.HotPink, Microsoft.Xna.Framework.Color.White, 0.1f)
 
static string cRight = "D"
 
static int[] crimsonBG = new int[3]
 
static bool critterCage
 
static bool CrouchingEnabled = false
 
static string cSmart = "LeftControl"
 
static bool cSmartCursorModeIsToggleAndNotHold = true
 
static string cThrowItem = "T"
 
static string cTorch = "LeftShift"
 
static string cUp = "W"
 
static int curMusic
 
const int curRelease = 279
 
static Entity CurrentDrawnEntity
 
static int CurrentDrawnEntityShader
 
static object CurrentInputTextTakerOverride
 
static Vector2 CurrentPan = Vector2.Zero
 
static float cursorAlpha
 
static Microsoft.Xna.Framework.Color cursorColor = Microsoft.Xna.Framework.Color.White
 
static int cursorColorDirection = 1
 
static int cursorOverride = -1
 
static float cursorScale
 
const double dayLength = 54000.0
 
static int dayMusic
 
static double dayRate = 1
 The rate at which time updates per tick.
Can be modified using ModSystem.ModifyTimeRate(ref double, ref double, ref double). Capped at 86,400.0.
 
static bool dayTime = true
 True during the day hours (4:30 AM to 7:30 PM), false during night hours (7:30 PM to 4:30 AM). In conjunction with time these represent the in-game time of the world. Note that IsItDay additionally takes into account the constant night state of remixWorld worlds and should be used instead for logic taking into account the state of the world rather the specific hour. Some examples include boss spawners and boss despawn behaviors.
 
static bool[] debuff = new bool[BuffID.Count]
 Categorizes status effects for which this is set to true as being debuffs instead of buffs.
This has multiple effects on gameplay:
More...
 
static BasicDebugDrawer DebugDrawer
 
static string debugWords = ""
 
static bool dedServ
 True on the server process, false on the client. Use this to selectively run code on server or client, such as loading texture assets. dedServ is the same as netMode == ID.NetmodeID.Server.
 
static int dedServCount1
 
static int dedServCount2
 
static bool dedServFPS
 
static string defaultChestName = string.Empty
 
static int DefaultDamageVariationPercent = 15
 
static string defaultIP = ""
 
static string DefaultSeed = ""
 
static List< IEnumerator > DelayedProcesses = new List<IEnumerator>()
 
static float demonTorch = 1f
 
static int demonTorchDir = 1
 
static int[] desertBG = new int[3]
 
static double desiredWorldEventsUpdateRate = 1
 
static double desiredWorldTilesUpdateRate = 1
 
static Vector2 destroyerHB = new Vector2(0f, 0f)
 
static bool DisableIntenseVisualEffects = false
 
static int DiscoB
 
static int DiscoG
 
static int DiscoR = 255
 
static int[] displayHeight = new int[99]
 
static int[] displayWidth = new int[99]
 
static bool dontStarveWorld = false
 If true, the world was generated with the The Constantsecret world seed. See also WorldGen.dontStarveWorldGen.
 
static int[,] dragonflyJarFrame = new int[7, cageFrames]
 
static int[,] dragonflyJarFrameCounter = new int[7, cageFrames]
 
static bool drawBackGore
 
static bool drawBetterDebug
 
static bool drawDiag
 
static bool drawingPlayerChat
 
static bool drawRelease
 
static int drawsCountedForFPS
 
static bool drawSkip
 
static bool drawToScreen
 
static Player dresserInterfaceDummy
 
static bool drewLava
 
static DroneCameraTracker DroneCameraTracker = new DroneCameraTracker()
 
static bool drunkWorld = false
 If true, the world was generated with the Drunk worldsecret world seed. See also WorldGen.drunkWorldGen.
 
static int[] duckCageFrame = new int[cageFrames]
 
static int[] duckCageFrameCounter = new int[cageFrames]
 
static int dungeonX
 
static int dungeonY
 
static Dust[] dust = new Dust[6001]
 
static bool eclipse
 If true a Solar Eclipseis currently happening.
 
static float eclipseLight
 
static bool editChest
 
static bool editSign
 
static int EquipPage
 
static int EquipPageSelected
 
static Microsoft.Xna.Framework.Color errorColor = new Microsoft.Xna.Framework.Color(255, 0, 0)
 
static int essDir = -1
 
static float essScale = 1f
 
static float exitScale = 0.8f
 
static int extremeWindCounter
 
static int fadeCounter
 
static int[] fairyJarFrame = new int[cageFrames]
 
static int[] fairyJarFrameCounter = new int[cageFrames]
 
static bool fastForwardTimeToDawn
 
static bool fastForwardTimeToDusk
 
static Microsoft.Xna.Framework.Input.Keys FavoriteKey = Microsoft.Xna.Framework.Input.Keys.LeftAlt
 
static int[] fishBowlFrame = new int[cageFrames]
 
static int[] fishBowlFrameCounter = new int[cageFrames]
 
static byte[] fishBowlFrameMode = new byte[cageFrames]
 
static int focusColor
 
static int focusRecipe
 An index into availableRecipe indicating the currently selected Recipe.
 
static float ForcedMinimumZoom = 1f
 
static bool forceHalloweenForToday
 
static bool forceXMasForToday
 
static int fpsCount
 
static Stopwatch fpsTimer = new Stopwatch()
 
static int frameRate
 
static bool frameRelease
 
static FrameSkipMode FrameSkipMode = FrameSkipMode.Subtle
 
static int[] frogCageFrame = new int[cageFrames]
 
static int[] frogCageFrameCounter = new int[cageFrames]
 
static bool gameInactive
 
static bool gameMenu = true
 If true, the game is currently in the main menus. If false the game is in the game world.
 
static bool gamePad = false
 
static float GamepadCursorAlpha = 0f
 
static bool GamepadDisableCursorItemIconInner = true
 
static bool GamepadDisableInstructionsDisplay
 
static bool gamePaused
 
static GameTime gameTimeCache = new GameTime()
 
static GameTipsDisplay gameTips
 
static SpriteViewMatrix GameViewMatrix
 
static float GameZoomTarget = 1f
 
static bool getGoodWorld = false
 If true, the world was generated with the For the worthysecret world seed. See also WorldGen.getGoodWorldGen.
 
static string getIP = defaultIP
 
static string getPort = Convert.ToString(Netplay.ListenPort)
 
static byte gFade
 
static byte gFadeDir = 1
 
static float gFader
 
static float gfxQuality = 1f
 
static float gfxRate = 0.01f
 
static bool GlobalTimerPaused = false
 
static float GlobalTimeWrappedHourly
 
static Gore[] gore = new Gore[601]
 
static float grabMapX
 
static float grabMapY
 
static GraphicsDeviceManager graphics
 
static int[] grasshopperCageFrame = new int[cageFrames]
 
static int[] grasshopperCageFrameCounter = new int[cageFrames]
 
static float GraveyardVisualIntensity
 
static int[] grebeCageFrame = new int[cageFrames]
 
static int[] grebeCageFrameCounter = new int[cageFrames]
 
static Item guideItem = new Item()
 
static int hairStart
 
static HairstyleUnlocksHelper Hairstyles = new HairstyleUnlocksHelper()
 
static bool hairWindow
 
static int[] hallowBG = new int[3]
 
static bool halloween
 If true the Halloweenseasonal event is currently active.
 
static bool hardMode
 True if the world is in hard mode. This doubles as an indicator if NPCID.WallofFlesh has been defeated since they are tied together.
 
static bool hasFocus
 
static bool HasInteractibleObjectThatIsNotATile = false
 
static float hBar = -1f
 
static Microsoft.Xna.Framework.Color hcColor = new Microsoft.Xna.Framework.Color(1f, 0.15f, 0.1f)
 
static byte HealthBarDrawSettings = 1
 
static int hellBackStyle
 
static int helpText
 
static bool HidePassword
 
static bool hidePlayerCraftingMenu
 
static bool hideUI
 
static Microsoft.Xna.Framework.Color highVersionColor = new Microsoft.Xna.Framework.Color(255, 255, 0)
 
static float[] hotbarScale
 
static bool HoveringOverAnNPC
 
static Item HoverItem = new Item()
 The item to be displayed as an item tooltip. Set to a Item.Clone of an existing item instance. Needs to be set in conjunction with hoverItemName to work, although the Item.HoverName will actually be shown. Use Item.SetNameOverride(string) to customize the item name shown.
 
static string hoverItemName = ""
 Sets the tooltip text to be drawn next to the cursor. Will be ignored if Main.mouseItem is not air, meaning the player is holding an item on the mouse. If used in conjunction with Main.HoverItem, an item tooltip will be shown, otherwise the text will be drawn as is with no background box. Similar to Main.MouseText(string, int, byte, int, int, int, int, int) except it won't show if an item is held on the mouse. Use UICommon.TooltipMouseText(string) instead to draw a non-item tooltip with the hover text background boxes, if that setting is not disabled by the user.
 
static int iceBackStyle
 
static bool ignoreErrors = true
 
static bool inFancyUI = false
 
static bool ingameOptionsWindow = false
 
static UserInterface InGameUI = new UserInterface()
 
static bool InGuideCraftMenu
 
static float InitialMapScale = 1f
 
static bool[,] initMap = new bool[mapTargetX, mapTargetY]
 
static Preferences InputProfiles = new Preferences(SavePath + Path.DirectorySeparatorChar + "input profiles.json")
 
static KeyboardState inputText
 
static bool inputTextEnter
 
static bool inputTextEscape
 
static bool InReforgeMenu
 
static Main instance
 
static int instantBGTransitionCounter = 2
 
static int interactedDresserTopLeftX
 
static int interactedDresserTopLeftY
 
static float invAlpha = 1f
 
static int invasionDelay
 
static int invasionProgress
 
static float invasionProgressAlpha
 
static int invasionProgressDisplayLeft
 
static int invasionProgressIcon
 
static int invasionProgressMax
 
static int invasionProgressMode = 2
 
static bool invasionProgressNearInvasion
 
static int invasionProgressWave
 
static int invasionSize
 
static int invasionSizeStart
 
static int invasionType
 If not 0, an invasion event is currently active:
If 1 (InvasionID.GoblinArmy), a Goblin Armyis happening.
If 2 (InvasionID.SnowLegion), a Frost Legionis happening.
If 3 (InvasionID.PirateInvasion), a Pirate Invasionis happening.
If 4 (InvasionID.MartianMadness), a Martian Madnessis happening.
 
static int invasionWarn
 
static double invasionX
 
static float invDir = 1f
 
const int InventoryAmmoSlotsCount = 4
 
const int InventoryAmmoSlotsStart = 54
 
static Microsoft.Xna.Framework.Color inventoryBack = new Microsoft.Xna.Framework.Color(220, 220, 220, 220)
 
const int InventoryCoinSlotsCount = 4
 
const int InventoryCoinSlotsStart = 50
 
const int InventoryItemSlotsCount = 50
 
const int InventoryItemSlotsStart = 0
 
static float inventoryScale = 0.75f
 
const int InventorySlotsTotal = 58
 
static bool inventorySortMouseOver
 
static bool InvisibleCursorForGamepad = true
 
static float iS = 1f
 
static bool IsInTheMiddleOfLoadingSettings
 
static bool isMouseLeftConsumedByUI = false
 
static GeneralIssueReporter IssueReporter
 
static IssueReportsIndicator IssueReporterIndicator = new IssueReportsIndicator()
 
static Item[] item = new Item[401]
 Contains all the Items in the game world. Items should only be spawned via Item.NewItem(IEntitySource, int, int, int, int, int, int, bool, int, bool, bool) or similar methods. Player.QuickSpawnItem(IEntitySource, int, int) is an option that is safe to call from client code. Only entries in this array that are Entity.active are relevant. The last entry is a dummy entry used for overflow and should not be accessed. Modders seeking to run logic on all items should use ActiveItems to iterate over the Main.item entries to easily account for inactive entries and the dummy entry.
 
static DrawAnimation[] itemAnimations = new DrawAnimation[ItemID.Count]
 
static List< int > itemAnimationsRegistered = new List<int>()
 
static ItemDropDatabase ItemDropsDB
 
static ItemDropResolver ItemDropSolver
 
static int[] itemFrame = new int[401]
 
static int[] itemFrameCounter = new int[401]
 
static int[,] jellyfishCageFrame = new int[3, cageFrames]
 
static int[,] jellyfishCageFrameCounter = new int[3, cageFrames]
 
static byte[,] jellyfishCageMode = new byte[3, cageFrames]
 
static int jungleBackStyle
 
static int[] jungleBG = new int[3]
 
static int keyCount
 
static int[] keyInt = new int[10]
 
static KeyboardState keyState
 
static string[] keyString = new string[10]
 
static int[] ladybugCageFrame = new int[cageFrames]
 
static int[] ladybugCageFrameCounter = new int[cageFrames]
 
static double ladyBugRainBoost = 0
 
static int lastItemUpdate
 
static Microsoft.Xna.Framework.Point LastLoadedResolution
 
static int lastMouseX
 
static int lastMouseY
 
static int lastNPCUpdate
 
static int[] lavaFishBowlFrame = new int[cageFrames]
 
static int[] lavaFishBowlFrameCounter = new int[cageFrames]
 
static float lBar = 1f
 
static float leftWorld = 0f
 
static Microsoft.Xna.Framework.Color legendaryModeColor = Microsoft.Xna.Framework.Color.LimeGreen
 
static string libPath = ""
 
static bool LightingEveryFrame = true
 
static float lightning
 
static bool[] lightPet = new bool[BuffID.Count]
 Categorizes status effects for which this is set to true as being tied to a light pet, preventing them from overlapping with other light pet status effects.
Defaults to false; all vanilla light pets have their entries here set to true.

 
static Liquid[] liquid = new Liquid[Liquid.maxLiquid]
 
static float[] liquidAlpha = new float[15]
 
static LiquidBuffer[] liquidBuffer = new LiquidBuffer[50000]
 
static int lo
 
static bool loadMap
 
static int loadMapLastX
 
static bool loadMapLock
 
static ulong LobbyId = 0uL
 
static FavoritesFile LocalFavoriteData = new FavoritesFile(SavePath + "/favorites.json", isCloud: false)
 
static GolfState LocalGolfState = new GolfState()
 
static bool lockMenuBGChange = false
 
static int LogicCheckScreenHeight = 1200
 
static int LogicCheckScreenWidth = 1920
 
static int LogoA = 255
 
static int LogoB
 
static bool LogoT
 
static int[] macawCageFrame = new int[cageFrames]
 
static int[] macawCageFrameCounter = new int[cageFrames]
 
static int[] maggotCageFrame = new int[cageFrames]
 
static int[] maggotCageFrameCounter = new int[cageFrames]
 
static int magmaBGFrame
 
static int magmaBGFrameCounter
 
static int[] mallardCageFrame = new int[cageFrames]
 
static int[] mallardCageFrameCounter = new int[cageFrames]
 
static UIManageControls ManageControlsMenu = new UIManageControls()
 
static WorldMap Map
 
static int mapDelay = 2
 
static bool mapEnabled = true
 
static FileMetadata MapFileMetadata
 
static bool mapFullscreen
 
static Vector2 mapFullscreenPos = new Vector2(-1f, -1f)
 
static float mapFullscreenScale = 4f
 
static MapIconOverlay MapIcons = new MapIconOverlay().AddLayer(new SpawnMapLayer()).AddLayer(new TeleportPylonsMapLayer()).AddLayer(Pings)
 
static bool mapInit
 
static int mapMaxX = 0
 
static int mapMaxY
 
static float mapMinimapAlpha = 1f
 
static float mapMinimapDefaultScale = 1.05f
 
static float mapMinimapScale = mapMinimapDefaultScale
 
static int mapMinX = 0
 
static int mapMinY
 
static float mapOverlayAlpha = 0.35f
 
static float mapOverlayScale = 2.5f
 
static MapHeadRenderer MapPlayerRenderer = new MapHeadRenderer()
 
static bool mapReady
 
static float MapScale = 1f
 
static int mapStyle = 1
 
static int mapTargetX = 5
 
static int mapTargetY = 2
 
static int mapTime = mapTimeMax
 
static int mapTimeMax = 30
 
static bool[,] mapWasContentLost = new bool[mapTargetX, mapTargetY]
 
static float martianLight = 1f
 
static int martianLightDir = 1
 
static float masterColor = 1f
 
static int masterColorDir = 1
 
static readonly int maxBackgrounds = 298
 
const int MaxBannerTypes = 290
 
const int maxCharSelectHair = 51
 
static readonly int maxChests = 8000
 
const int maxClouds = 200
 
const int maxCombatText = 100
 
const int maxDust = 6000
 
static int maxDustToDraw = 6000
 
const int maxGore = 600
 
const int maxHairOfStylistDefault = 123
 
const int maxHairStyles = 165
 
static readonly int maxItems = 400
 
const int maxItemText = 20
 
static int maxItemUpdates = 5
 
const int maxLiquidTypes = 15
 
static int maxMapUpdates = 250000
 
const int maxMoons = 9
 
static int maxMP = 10
 
static readonly int maxMusic = 92
 
static int maxNetPlayers = 255
 
static readonly int maxNPCs = 200
 
static int maxNPCUpdates = 5
 
const int maxPlayers = 255
 
static readonly int maxProjectiles = 1000
 
static bool maxQ = true
 
static int maxRain = 750
 
static float maxRaining
 
static int maxScreenH = 1200
 
static int maxScreenW = 1920
 
static int maxSectionsX = maxTilesX / 200
 
static int maxSectionsY = maxTilesY / 150
 
const int MaxShopIDs = 100
 
const int maxStars = 400
 
const int maxStarTypes = 4
 
static int maxTilesX = (int)rightWorld / 16 + 1
 The width of the currently-loaded world in tiles.
 
static int maxTilesY = (int)bottomWorld / 16 + 1
 The height of the currently-loaded world in tiles.
 
const int MaxTimeout = 120
 
static Microsoft.Xna.Framework.Color mcColor = new Microsoft.Xna.Framework.Color(1f, 0.6f, 0f)
 
static bool[] meleeBuff = new bool[BuffID.Count]
 Categorizes status effects for which this is set to true as being from flasks, preventing them from overlapping with other flask status effects.
Defaults to false; all vanilla flask effects have their entries here set to true.

 
static bool menuBGChangedDay = false
 
static bool menuBGChangedNight = false
 
static int menuFocus = 0
 
static int menuMode = Interface.loadModsID
 
static bool menuMultiplayer
 
static bool menuServer
 
static ServerMode MenuServerMode = ServerMode.Lobby | ServerMode.FriendsCanJoin
 
static int menuSkip
 
static UserInterface MenuUI = new UserInterface()
 
static float MenuXMovement = 0f
 
static MinimapFrameManager MinimapFrameManagerInstance
 
static int miniMapHeight
 
static int miniMapWidth
 
static int miniMapX
 
static int miniMapY
 
static float MinimumZoomComparerX = 1920f
 
static float MinimumZoomComparerY = 1200f
 
static int minScreenH = 720
 
static int minScreenW = 800
 
static int moondialCooldown
 
static short moonModY
 
static int moonPhase
 The current moon phaseexpressed as an int. Use GetMoonPhase to get the moon phase as a MoonPhase instead.
 
static int moonType = 0
 
static string motd = ""
 
static Microsoft.Xna.Framework.Color MouseBorderColor = new Microsoft.Xna.Framework.Color(64, 64, 64, 64)
 
static ColorSlidersSet mouseBorderColorSlider = new ColorSlidersSet()
 
static float MouseBuildingGridAlpha
 
static int[] mouseCageFrame = new int[cageFrames]
 
static int[] mouseCageFrameCounter = new int[cageFrames]
 
static Microsoft.Xna.Framework.Color mouseColor = new Microsoft.Xna.Framework.Color(255, 50, 95)
 
static ColorSlidersSet mouseColorSlider = new ColorSlidersSet()
 
static bool mouseExit
 
static Item mouseItem = new Item()
 The item currently being carried by the mouse.
 
static bool mouseLeft
 
static bool mouseLeftRelease
 
static bool mouseMiddle
 
static bool mouseMiddleRelease
 
static bool mouseReforge
 
static bool mouseRight
 
static bool mouseRightRelease
 
static bool MouseShowBuildingGrid
 
static bool mouseText
 
static byte mouseTextColor
 A value that oscillates between 190 and 255. It is used to drive the slight pulsing color effect seen in much of the text shown in-game. The value is used to create Colors by passing in this value as either all 4 parameters or just the alpha parameter.

Main.MouseTextColorReal can be used to access the typical pulsing white Color value.
 
static int mouseTextColorChange = 1
 
static int mouseX
 
static bool mouseXButton1
 
static bool mouseXButton1Release
 
static bool mouseXButton2
 
static bool mouseXButton2Release
 
static int mouseY
 
static int multiplayerNPCSmoothingRange = 300
 
static int[] mushroomBG = new int[3]
 
static int musicBox2 = -1
 
static int musicBoxNotModifiedByVolume = -1
 
static int musicError
 
static float[] musicFade = new float[maxMusic]
 
static bool[] musicNoCrossFade = new bool[maxMusic]
 
static float musicPitch = 0f
 
static float musicVolume = 1f
 
static int myPlayer
 The index in player of this client's Player.
If this is 255, this client is the server. Main.LocalPlayer is shorthand for Main.player[Main.myPlayer] and retrieves the local Player object.
 
static int netMode
 Denotes the current network mode: 0 for single player client, 1 for multiplayer client, and 2 for server.
Using ID.NetmodeID entries instead of 0, 1, and 2 will greatly enhance code readability.
Modders must properly use netMode to selectively run code, such as code affecting the game world. Following examples in ExampleMod and Terraria code as well as reading the Basic Netcode guideare the best way to learn how to use netMode correctly.
dedServ is the same as netMode == ID.NetmodeID.Server
 
static int netPlayCounter
 
static bool netRelease
 
static int newMusic
 
static string newWorldName = ""
 
const double nightLength = 32400.0
 
static bool noTrapsWorld = false
 If true, the world was generated with the No trapssecret world seed. See also WorldGen.noTrapsWorldGen.
 
static bool notTheBeesWorld = false
 If true, the world was generated with the Not the beessecret world seed. See also WorldGen.notTheBees.
 
static bool noWindowBorder = false
 
static NPC[] npc = new NPC[201]
 Contains all the NPCs in the game world. NPC are spawned via the NPC.NewNPC(IEntitySource, int, int, int, int, float, float, float, float, int) method. Only entries in this array that are Entity.active are relevant. Each NPC has an Entity.whoAmI corresponding to their index within Main.npc. The last entry is a dummy entry used for overflow and should not be accessed. Modders seeking to run logic on all NPCs should use ActiveNPCs to iterate over the Main.npc entries to easily account for inactive entries and the dummy entry.
 
static bool[] npcCatchable = new bool[NPCID.Count]
 Used to denote an NPC as being catchable by bug nets and similar.
Contrary to its name, this array isn't actually used for catching logic at all.
It is instead used to determine if an NPC can be released back into the world after being caught.
These NPC will be forced NPC.friendly for 1.5 seconds if naturally spawned.

 
static int npcChatCornerItem
 The item type of the item icon to display at the bottom right corner of the NPC chat window. The Angler uses this functionality to display the fishing quest fish item, but it can be used to show any item. Assign during ModNPC.GetChat. Defaults to 0.
 
static bool npcChatFocus1
 
static bool npcChatFocus2
 
static bool npcChatFocus3
 
static bool npcChatFocus4
 
static bool npcChatRelease
 
static string npcChatText = ""
 
static int[] npcFrameCount
 The number of animation frames this NPC's texture has. ModNPC should use ModNPC.FindFrame(int) to adjust NPC.frame.Y to change the drawn frame.
 
static Dictionary< int, byte > npcLifeBytes = new Dictionary<int, byte>()
 
static int npcStreamSpeed = 30
 
static int numAvailableRecipes
 The count of Recipes being shown. The length of availableRecipe.
 
const int numberOfHairstyles = 165
 
static int numClouds = 200
 
static int numCloudsTemp = numClouds
 
static int numDisplayModes
 
const int numInfoIcons = 13
 
static int numStars
 
const int numTileColors = 32
 
const int numTreeStyles = 32
 
static int oceanBG
 
static readonly int offLimitBorderTiles = 40
 
static int offScreenRange = 200
 
static Vector2[] OffsetsNPCOffhand
 
static Vector2[] OffsetsPlayerHeadgear
 
static Vector2[] OffsetsPlayerOffhand
 
static Vector2[] OffsetsPlayerOnhand
 
static KeyboardState oldInputText
 
static KeyboardState oldKeyState
 
static float oldMaxRaining
 
static int oldNPCShop
 
static string oldStatusText = ""
 
static int oldUndergroundBackground
 
static Microsoft.Xna.Framework.Color OurFavoriteColor = new Microsoft.Xna.Framework.Color(255, 231, 69)
 
static int[] owlCageFrame = new int[cageFrames]
 
static int[] owlCageFrameCounter = new int[cageFrames]
 
static ParticleRenderer ParticleSystem_World_BehindPlayers = new ParticleRenderer()
 
static ParticleRenderer ParticleSystem_World_OverPlayers = new ParticleRenderer()
 
static bool PendingBorderlessState
 
static Player PendingPlayer = null
 
static int PendingResolutionHeight = 600
 
static int PendingResolutionWidth = 800
 
static int[] penguinCageFrame = new int[cageFrames]
 
static int[] penguinCageFrameCounter = new int[cageFrames]
 
static bool[] persistentBuff = new bool[BuffID.Count]
 Allows status effects for which this is set to true to persist after the afflicted player's death.
Defaults to false; all vanilla flask effects have their entries here set to true.

 
static PingMapLayer Pings = new PingMapLayer()
 
static Ref< Effect > PixelShaderRef = new Ref<Effect>()
 
static bool placementPreview = true
 
static Player[] player = new Player[256]
 Contains all the Players in the game world. Only entries in this array that are Entity.active are relevant. Each player has a Entity.whoAmI corresponding to their index within Main.player. myPlayer is the index of the local player as well. The last entry is a dummy entry used for server operations and should not be accessed. Modders seeking to run logic on all players should use ActivePlayers to iterate over the Main.player entries to easily account for inactive entries and the dummy entry.
 
static bool playerInventory
 Indicates if the full player inventory is currently showing.
 
static List< PlayerFileDataPlayerList = new List<PlayerFileData>()
 
static int PlayerOverheadChatMessageDisplayTime = 400
 
static string PlayerPath = Path.Combine(SavePath, "Players")
 
static IPlayerRenderer PlayerRenderer = new LegacyPlayerRenderer()
 
static Player[] playerVisualClone = new Player[256]
 
static PopupText[] popupText = new PopupText[20]
 
static IPlayerRenderer PotionOfReturnRenderer = new ReturnGatePlayerRenderer()
 
static bool preventStackSplitReset
 
static bool PreventUpdatingTargets = true
 
static Projectile[] projectile = new Projectile[1001]
 Contains all the Projectiles in the game world. Projectiles should only be spawned via Projectile.NewProjectile(IEntitySource, float, float, float, float, int, int, float, int, float, float, float) or similar methods. Projectile ordering is not consistent between multiplayer clients. Only entries in this array that are Entity.active are relevant. Each projectile has a Entity.whoAmI corresponding to their index within Main.projectile. The last entry is a dummy entry used for overflow and should not be accessed. Modders seeking to run logic on all projectiles should use ActiveProjectiles to iterate over the Main.projectile entries to easily account for inactive entries and the dummy entry.
 
static int[,] projectileIdentity = new int[256, 1001]
 
static int ProjectileUpdateLoopIndex = -1
 
static int[] projFrames = new int[ProjectileID.Count]
 Indicates how many frames of animation are in each projectile type spritesheet.
Use Projectile.frame to animate the projectile.
The Basic Projectile Guideteaches how to animate projectiles.
Indexed by Projectile.type. Defaults to 1.
 
static bool[] projHook = new bool[ProjectileID.Count]
 
static bool[] projHostile = new bool[ProjectileID.Count]
 
static bool[] projPet = new bool[ProjectileID.Count]
 
static bool pumpkinMoon
 If true a Pumpkin Moonis currently happening.
 
static bool[] pvpBuff = new bool[BuffID.Count]
 Indexed by BuffID. If true for a given BuffID, then that buff can be applied to players by other players in PvP.
Defaults to false.
 
static TeleportPylonsSystem PylonSystem
 
static int qaStyle
 
static bool qRelease = false
 
static Rain[] rain = new Rain[maxRain + 1]
 
static bool raining
 
static double rainTime
 
static int rare
 
static RasterizerState Rasterizer = RasterizerState.CullCounterClockwise
 
static int[] ratCageFrame = new int[cageFrames]
 
static int[] ratCageFrameCounter = new int[cageFrames]
 
static bool recBigList
 
static string[] recentIP = new string[maxMP]
 
static int[] recentPort = new int[maxMP]
 
static string[] recentWorld = new string[maxMP]
 
static bool recFastScroll
 
static Recipe[] recipe = new Recipe[Recipe.maxRecipes]
 Contains all the Recipe in the game. Be sure to read the Basic Recipes wiki pageto learn how to create and edit recipes. Modders should not attempt to manually edit Main.recipe, doing so will break things. Recipes can be disabled or edited but should not be removed. Recipe ordering can be done through the sort methods, such as Recipe.SortBefore(Recipe). Main.recipe is populated during mod loading and should not be changed in-game. Dynamic recipe availability is done through recipe conditions.
 
static int recStart
 
static int[] redBirdCageFrame = new int[cageFrames]
 
static int[] redBirdCageFrameCounter = new int[cageFrames]
 
static Item reforgeItem = new Item()
 
static float reforgeScale = 0.8f
 
static bool refreshMap
 
static Dictionary< int, GameModeDataRegisteredGameModes
 
static bool releaseUI
 
static bool remixWorld = false
 If true, the world was generated with the Don't dig up (aka Remix)secret world seed. See also WorldGen.remixWorldGen.
 
static bool render
 
static int renderCount = 99
 
static bool renderNow
 
static bool resetClouds = true
 
static bool resetMapFull
 
static PlayerResourceSetsManager ResourceSetsManager
 
static bool ReversedUpDownArmorSetBonuses
 
static bool RGBRelease
 
static float rightWorld = 134400f
 
static double rockLayer
 The y-coordinate of the top of the caverns layer, in tile coordinates. More...
 
static Microsoft.Xna.Framework.Point rulerLineDisplayValues = default(Microsoft.Xna.Framework.Point)
 
static bool runningCollectorsEdition
 
static SamplerState SamplerStateForCursor = SamplerState.LinearClamp
 
static int saveTimer = 0
 
static float sBar = -1f
 
static Vector2 sceneBackgroundPos = Vector2.Zero
 
static SceneMetrics SceneMetrics
 
static Vector2 sceneTile2Pos = Vector2.Zero
 
static Vector2 sceneTilePos = Vector2.Zero
 
static Vector2 sceneWallPos = Vector2.Zero
 
static Vector2 sceneWaterPos = Vector2.Zero
 
static int[,] scorpionCageFrame = new int[2, cageFrames]
 
static int[,] scorpionCageFrameCounter = new int[2, cageFrames]
 
static bool screenBorderless = true
 
static int screenBorderlessPendingResizes
 
static int screenHeight = 864
 
static Vector2 screenLastPosition
 
static bool screenMaximized = true
 
static Vector2 screenPosition
 The position of the top left corner of the screen in world coordinates. Modify in ModSystem.ModifyScreenPosition or ModPlayer.ModifyScreenPosition. Also consider using Main.instance.CameraModifiers.Add(CameraModifier); as shown in ExampleMods MinionBossBody for screen shakes.

When manually drawing, subtracting Main.screenPosition from the world position of the thing being drawn will result in the correct screen coordinates for use in SpriteBatch.Draw methods. When drawing tiles or walls, an additional offset calculated as Vector2 zero = Main.drawToScreen? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); needs to be added to the coordinates.
 
static Ref< Effect > ScreenShaderRef = new Ref<Effect>()
 
static RenderTarget2D screenTarget
 
static RenderTarget2D screenTargetSwap
 
static int screenWidth = 1152
 
static int[] seagullCageFrame = new int[cageFrames]
 
static int[] seagullCageFrameCounter = new int[cageFrames]
 
static int[] seahorseCageFrame = new int[cageFrames]
 
static int[] seahorseCageFrameCounter = new int[cageFrames]
 
const int sectionHeight = 150
 
static WorldSections sectionManager
 
const int sectionWidth = 200
 
static int selClothes
 
static Microsoft.Xna.Framework.Color selColor = Microsoft.Xna.Framework.Color.White
 
static int selectedPlayer = 0
 
static int selectedWorld
 
static bool ServerSideCharacter
 
static bool serverStarting = false
 
static int setKey = -1
 
static bool Setting_UseReducedMaxLiquids = false
 
static bool SettingBlockGamepadsEntirely
 
static bool SettingDontScaleMainMenuUp
 
static bool SettingMusicReplayDelayEnabled = false
 
static bool SettingsEnabled_AutoReuseAllItems = false
 
static bool SettingsEnabled_MinersWobble = true
 
static bool SettingsEnabled_OpaqueBoxBehindTooltips = true
 
static bool SettingsEnabled_TilesSwayInWind = true
 
static bool SettingsUnlock_WorldEvil
 
static ContentManager ShaderContentManager
 
static float shimmerAlpha = 0f
 
static float shimmerBrightenDelay = 0f
 
static float shimmerDarken = 0f
 
static ShopHelper ShopHelper
 
static ItemShopSellbackHelper shopSellbackHelper = new ItemShopSellbackHelper()
 
static bool shortRender = true
 
static bool shouldDrawNetDiagnosticsUI
 
static bool showFrameRate = false
 
static bool showItemOwner = false
 
static bool showItemText = true
 
static bool showServerConsole
 
static bool showSpam = false
 
static bool showSplash = true
 
static Sign[] sign = new Sign[1000]
 Contains all the signs in the world. There can be at most 1000 signs in the world.
 
static bool signBubble
 
static int signHover = -1
 
static int signX = 0
 
static int signY = 0
 
static AnchoredEntitiesCollection sittingManager
 
static bool SkipAssemblyLoad
 
static bool skipMenu = false
 
static AnchoredEntitiesCollection sleepingManager
 
static bool slimeRain
 
static int slimeRainKillCount
 
static bool[] slimeRainNPC = new bool[NPCID.Count]
 
static float slimeRainNPCSlots = 0.65f
 
static double slimeRainTime
 
static int slimeWarningDelay = 420
 
static int slimeWarningTime
 
static int[,] slugCageFrame = new int[3, cageFrames]
 
static int[,] slugCageFrameCounter = new int[3, cageFrames]
 
static bool SmartCursorShowing = false
 
static bool SmartCursorWanted_GamePad = false
 
static bool SmartCursorWanted_Mouse = false
 
static int SmartCursorX
 
static int SmartCursorY
 
static int SmartInteractNPC
 
static bool SmartInteractPotionOfReturn
 
static int SmartInteractProj
 
static bool SmartInteractShowingFake
 
static bool SmartInteractShowingGenuine
 
static List< Microsoft.Xna.Framework.Point > SmartInteractTileCoords = new List<Microsoft.Xna.Framework.Point>()
 
static List< Microsoft.Xna.Framework.Point > SmartInteractTileCoordsSelected = new List<Microsoft.Xna.Framework.Point>()
 
static int SmartInteractX
 
static int SmartInteractY
 
static float SmoothedMushroomLightInfluence
 
static int[] snail2CageFrame = new int[cageFrames]
 
static int[] snail2CageFrameCounter = new int[cageFrames]
 
static int[] snailCageFrame = new int[cageFrames]
 
static int[] snailCageFrameCounter = new int[cageFrames]
 
static int[] snowBG = new int[3]
 
static int snowDust = 0
 
static int[] snowMntBG = new int[2]
 
static bool snowMoon
 If true a Frost Moonis currently happening.
 
static int soundError
 
static float soundVolume = 1f
 
static int spamCount = 0
 
static int spawnTileX
 The x tile coordinate of the default spawn location of the world. Players without a bed spawn point (Player.SpawnX) will spawn at this location and invasions will target this location.
 
static int spawnTileY
 The y tile coordinate of the default spawn location of the world. Players without a bed spawn point (Player.SpawnY) will spawn at this location and invasions will target this location.
 
static int[] specX = new int[1000]
 
static int[] specY = new int[1000]
 
static SpriteBatch spriteBatch
 
static int[] squirrelCageFrame = new int[cageFrames]
 
static int[] squirrelCageFrameCounter = new int[cageFrames]
 
static int[] squirrelCageFrameCounterOrange = new int[cageFrames]
 
static int[] squirrelCageFrameOrange = new int[cageFrames]
 
static int stackCounter
 
static int stackDelay = 7
 
static int stackSplit
 
static Star[] star = new Star[400]
 
static bool starGame = false
 
static int starsHit = 0
 
static bool startFullscreen = false
 
static bool stopTimeOuts = false
 
static float sunCircle
 
static int sundialCooldown
 
static short sunModY
 
static bool superFast = false
 
static int superFastStack
 
static bool Support4K = true
 
static bool Support8K = true
 
static bool targetSet
 
static Microsoft.Xna.Framework.Color[] teamColor = new Microsoft.Xna.Framework.Color[6]
 
static int teamCooldown
 
static int teamCooldownLen = 300
 
static int teamNamePlateDistance = 2000
 
static float temporaryGUIScaleSlider = -1f
 
static bool temporaryGUIScaleSliderUpdate = false
 
static bool tenthAnniversaryWorld = false
 If true, the world was generated with the Celebrationmk10secret world seed. See also WorldGen.tenthAnniversaryWorldGen.
 
static bool terrariasFixedTiming = true
 
static int textureMaxHeight = 1800
 
static int textureMaxWidth = 2000
 
static int thunderDistance
 
static Tilemap tile = new((ushort)maxTilesX, (ushort)maxTilesY)
 
static bool[] tileAlch = new bool[TileID.Count]
 
static bool[] tileAxe = new bool[TileID.Count]
 If true for the given tile type, tiles of the type are mined using an axe instead of pickaxe. Defaults to false.
 
static TileBatch tileBatch
 
static bool[] tileBlendAll = new bool[TileID.Count]
 
static bool[] tileBlockLight = new bool[TileID.Count]
 If true, light is blocked by this tile and the light values will decrease as it passes through. Most Main.tileSolid tiles will set this to true. TileID.Glass is an example of a tile that is solid but doesn't block light.
 
static bool[] tileBouncy = new bool[TileID.Count]
 
static bool[] tileBrick = new bool[TileID.Count]
 
static Microsoft.Xna.Framework.Color tileColor
 
static bool[] tileContainer = new bool[TileID.Count]
 
static bool[] tileCracked = new bool[TileID.Count]
 
static bool[] tileCut = new bool[TileID.Count]
 If true, Tiles of the indexed Tile Type will be destroyed by weapons and projectiles. ModProjectile.CanCutTiles can be used to customize if a projectile should destroy tiles with this property.
 
static bool[] tileDungeon = new bool[TileID.Count]
 
static bool[] tileFlame = new bool[TileID.Count]
 If true, indicates that a tile has a flame texture that will draw over the tile. Modded tiles should not use this. ModBlockType.PostDraw(int, int, SpriteBatch) can be used to manually draw a flame texture.
 
static int[] tileFrame = new int[TileID.Count]
 Tracks the current animation frame for a specific tile type. This value is shared for all tiles of the type. The frame parameter in ModTile.AnimateTile(ref int, ref int) is equivalent to this value. Animation variation for a specific tile can be done with ModTile.AnimateIndividualTile(int, int, int, ref int, ref int).
 
static int[] tileFrameCounter = new int[TileID.Count]
 Used to time how long the current animation frame for a specific tile type has been shown. This value is shared for all tiles of the type. The frameCounter parameter in ModTile.AnimateTile(ref int, ref int) is equivalent to this value.
 
static bool[] tileFrameImportant = new bool[TileID.Count]
 Set to true if this is not a typical Terrain tile. Terrain tiles are 1x1 tiles that automatically adjust their frame values to nearby tiles. They don't have a TileObjectData.
All non-1x1 tiles should set this to true. All 1x1 tiles that have a TileObjectData or that should preserve frame data should set this to true.
 
static ulong TileFrameSeed = (ulong)Guid.NewGuid().GetHashCode()
 
static short[] tileGlowMask = new short[TileID.Count]
 
static bool[] tileHammer = new bool[TileID.Count]
 
static int TileInteractionHX = -1
 
static int TileInteractionHY = -1
 
static int TileInteractionLX = -1
 
static int TileInteractionLY = -1
 
static byte[] tileLargeFrames = new byte[TileID.Count]
 
static bool[] tileLavaDeath = new bool[TileID.Count]
 If true for the given tile type, tiles of the type will be destroyed if in contact with lava. TileObjectData.LavaDeath supersedes this if a TileObjectData is available. Use tileObsidianKill instead if the tile should only be killed by obsidian forming over it. Defaults to false.
 
static bool[] tileLighted = new bool[TileID.Count]
 Indexed by TileID. If true for a given TileID, then that tile produces light.
You can set the light color for tile using ModBlockType.ModifyLight(int, int, ref float, ref float, ref float) or GlobalBlockType.ModifyLight(int, int, int, ref float, ref float, ref float).
Defaults to false.
 
static bool[][] tileMerge = new bool[TileID.Count][]
 
static bool[] tileMergeDirt = new bool[TileID.Count]
 Indexed by TileID. If true for a given TileID, then that tile has frames for merging with TileID.Dirt.
Defaults to false.
 
static bool[] tileMoss = new bool[TileID.Count]
 
static bool[] tileNoAttach = new bool[TileID.Count]
 If true, tiles can't be attached to this tile. Furniture tiles typically set this. A good rule of thumb is to set this to true if placing a torch on this tile would look strange.
 
static bool[] tileNoFail = new bool[TileID.Count]
 
static bool[] tileNoSunLight = new bool[TileID.Count]
 
static bool[] tileObsidianKill = new bool[TileID.Count]
 If true for the given tile type, tiles of the type will be destroyed if obsidian would generate at it's location because of lava and water mixing. Automatically set to true if tileLavaDeath is true. Many tiles are immune to lava but break if obsidian kills it, such as Statues and Anvils. Defaults to false.
 
static short[] tileOreFinderPriority = new short[TileID.Count]
 The priority of this tile in relation to the Metal Detector. The tile with the highest priority in range will show the corresponding map entry. The Metal Detector wiki pagelists existing values to use as reference.
 
static bool[] tilePile = new bool[TileID.Count]
 
static bool[] tileRope = new bool[TileID.Count]
 
static bool[] tileSand = new bool[TileID.Count]
 
static Ref< Effect > TileShaderRef = new Ref<Effect>()
 
static int[] tileShine = new int[TileID.Count]
 How rarely tiny ambient dust appear from this tile. Larger values mean less frequently
 
static bool[] tileShine2 = new bool[TileID.Count]
 If true, the tile will be drawn to be slightly more bright.
 
static bool[] tileSign = new bool[TileID.Count]
 Indicates that a tile is a "sign" and will be paired with a Sign instance. Right click, hover, saving, and network syncing behaviors are all handled automatically. Note that signs are expected to be 2x2 tiles with pixel dimensions 36x36 and will likely not work correctly for other dimensions. Be sure to also set TileID.Sets.TileInteractRead. Defaults to false.
 
static bool tilesLoaded = false
 
static bool[] tileSolid = new bool[TileID.Count]
 If true, this tile will be solid (unless tileSolidTop is also true). Projectiles will collide with it and NPC and Players can stand on it and collide with it. Typical terrain tiles such as TileID.Stone and TileID.Demonite set this. Other examples include TileID.ClosedDoor and TileID.Boulder The wikirefers to tiles with tileSolid set to true as "solid" tiles and those with tileSolid set to false as "background" tiles.
 
static bool[] tileSolidTop = new bool[TileID.Count]
 If true, this tile can be stood on despite not being tileSolid. The player can pass down through the tile by pressing down. TileID.Tables, TileID.Anvils, and TileID.Platforms are some example.
 
static bool[] tileSpelunker = new bool[TileID.Count]
 If true for the given tile type, tiles will be drawn much brighter and give off additional dust if the player is under the effects of the Spelunker buff, magic lantern, or similar effect.
 
static bool[] tileStone = new bool[TileID.Count]
 
static bool[] tileTable = new bool[TileID.Count]
 If true, this tile type will be considered a table for the purposes of tile placement. Tiles such as TileID.Tables and TileID.WorkBenches set this. Some tiles such as TileID.PiggyBank, TileID.Bowls, and TileID.Candles can only be placed on tiles designated as a Table. Note that a separate system is used for counting a tile as a table for housing purposes. Use AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); in a ModTile class to designate the tile as a table.
 
static bool[] tileWaterDeath = new bool[TileID.Count]
 If true for the given tile type, tiles of the type will be destroyed if in contact with water. TileObjectData.WaterDeath supersedes this if a TileObjectData is available.
 
static double time = 13500.0
 The time that has passed since it last became day/night.
Increased by dayRate every tick.
If it is dayTime, this caps at dayLength. Otherwise, this caps at nightLength. More...
 
static double timeForVisualEffects
 
static int[] timeItemSlotCannotBeReusedFor = new int[401]
 
static int timesTriedToFastStack
 
static List< TitleLinkButtonTitleLinks = new List<TitleLinkButton>()
 
static List< TitleLinkButtontModLoaderTitleLinks = new List<TitleLinkButton>()
 
static bool toggleFullscreen
 
static Item tooltipPrefixComparisonItem = new Item()
 
static float topWorld = 0f
 
static bool[] townNPCCanSpawn = new bool[NPCID.Count]
 
static NPCHeadRenderer TownNPCHeadRenderer = null
 
static Point16 trashSlotOffset
 
static int[] travelShop = new int[40]
 
static int[] treeBGSet1 = new int[3]
 
static int[] treeBGSet2 = new int[3]
 
static int[] treeBGSet3 = new int[3]
 
static int[] treeBGSet4 = new int[3]
 
static int[] treeMntBGSet1 = new int[2]
 
static int[] treeMntBGSet2 = new int[2]
 
static int[] treeMntBGSet3 = new int[2]
 
static int[] treeMntBGSet4 = new int[2]
 
static int[] treeStyle = new int[4]
 
static int[] treeX = new int[4]
 
static int[] turtleCageFrame = new int[cageFrames]
 
static int[] turtleCageFrameCounter = new int[cageFrames]
 
static int uCount
 
static float ugBackTransition
 
static int ugMusic
 
static int undergroundBackground
 
static int[] underworldBG = new int[5]
 
static bool updateMap
 
static int updateRate
 
static int updatesCountedForFPS
 
static double UpdateTimeAccumulator
 
static float upTimer
 
static float upTimerMax
 
static float upTimerMaxDelay
 
static bool UseExperimentalFeatures
 
static bool UseHeatDistortion = true
 
static bool UseStormEffects = true
 
static bool validateSaves = true
 
static bool[] vanityPet = new bool[BuffID.Count]
 Categorizes status effects for which this is set to true as being from vanity pets, preventing them from overlapping with other vanity pet status effects.
Defaults to false; all vanilla vanity pets have their entries here set to true.

 
static bool verboseNetplay = false
 
static string versionNumber = "v1.4.4.9"
 
static string versionNumber2 = "v1.4.4.9"
 
static Ref< Effect > VertexPixelShaderRef = new Ref<Effect>()
 
static int[] wallBlend = new int[WallID.Count]
 
static bool[] wallDungeon = new bool[WallID.Count]
 
static byte[] wallFrame = new byte[WallID.Count]
 
static byte[] wallFrameCounter = new byte[WallID.Count]
 
static bool[] wallHouse = new bool[WallID.Count]
 If true, the wall is considered "safe" for enemy spawning purposes.
 
static byte[] wallLargeFrames = new byte[WallID.Count]
 
static bool[] wallLight = new bool[WallID.Count]
 
static int[] waterStriderCageFrame = new int[cageFrames]
 
static int[] waterStriderCageFrameCounter = new int[cageFrames]
 
static int waterStyle
 
static RenderTarget2D waterTarget
 
static int WaveQuality = 3
 
static int weatherCounter
 
static int weatherVaneBobframe = 0
 
static float wFrame
 
static float wFrCounter
 
static int windCounter
 
static bool windPhysics = false
 
static float windPhysicsStrength = 0.1f
 
static float windSpeedCurrent
 
static float windSpeedTarget
 
static int wofDrawAreaBottom
 
static int wofDrawAreaTop
 
static int wofDrawFrameIndex
 
static int wofNPCIndex = -1
 
static WorkshopPublishingIndicator WorkshopPublishingIndicator = new WorkshopPublishingIndicator()
 
static int worldEventUpdates
 Representation that dictates the actual amount of "world event updates" that happen in a given GAME tick. This number increases/decreases in direct tandem with

See also
desiredWorldEventsUpdateRate

.

 
static FileMetadata WorldFileMetadata
 
const ulong WorldGeneratorVersion = 1198295875585uL
 
static int worldID
 
static List< WorldFileDataWorldList = new List<WorldFileData>()
 
static string worldName = ""
 
static string WorldPath = Path.Combine(SavePath, "Worlds")
 
static int WorldRollingBackupsCountToKeep = 2
 
static double worldSurface
 The y-coordinate of the top of the dirt layer, in tile coordinates. Corresponds to 0' on the Depth Meter. More...
 
static int[] wormCageFrame = new int[cageFrames]
 
static int[] wormCageFrameCounter = new int[cageFrames]
 
static bool xMas
 If true the Christmasseasonal event is currently active.
 
static bool zenithWorld = false
 If true, the world was generated with the Get fixed boi (aka Zenith)secret world seed. This seed combines multiple secret seeds. Note that the other secret world seed bools inherited by this seed will be set as well, so there is no need to specifically check both those bools and this bool. See also WorldGen.everythingWorldGen.
 

Protected Member Functions

void CacheNPCDraws ()
 
void CacheProjDraws ()
 
void CheckBunny ()
 
bool checkMap (int i, int j)
 
void DoUpdate (ref GameTime gameTime)
 
override void Draw (GameTime gameTime)
 
void DrawBackground ()
 
void DrawBlack (bool force=false)
 
void DrawCachedNPCs (List< int > npcCache, bool behindTiles)
 
void DrawCachedProjs (List< int > projCache, bool startSpriteBatch=true)
 
void DrawClothesWindow ()
 
void DrawDust ()
 
void DrawElderEye (SpriteBatch spriteBatch, Vector2 worldPosition, float opacity, float scale, int frameNumber, Microsoft.Xna.Framework.Color passedColor)
 
void DrawFPS ()
 
void DrawGore ()
 
void DrawGoreBehind ()
 
void DrawHairWindow ()
 
void DrawInterface (GameTime gameTime)
 
void DrawInventory ()
 
void DrawItem (Item item, int whoami)
 
void DrawMap (GameTime gameTime)
 
void DrawMenu (GameTime gameTime)
 
void DrawNPCExtras (NPC n, bool beforeDraw, float addHeight, float addY, Microsoft.Xna.Framework.Color npcColor, Vector2 halfSize, SpriteEffects npcSpriteEffect, Vector2 screenPosition)
 
void DrawNPCHousesInWorld ()
 
void DrawNPCs (bool behindTiles=false)
 
void DrawPlayerChat ()
 
void DrawPlayers_AfterProjectiles ()
 
void DrawPlayers_BehindNPCs ()
 
void DrawProjectiles ()
 
void DrawRain ()
 
void DrawSplash (GameTime gameTime)
 
void DrawSuperSpecialProjectiles (List< int > projCache, bool startSpriteBatch=true)
 
void DrawSurfaceBG ()
 
void DrawTiles (bool solidLayer, bool forRenderTargets, bool intoRenderTargets, int waterStyleOverride=-1)
 
void DrawToMap ()
 
void DrawToMap_Section (int secX, int secY)
 
void DrawUnderworldBackground (bool flat)
 
void DrawWalls ()
 
void DrawWires ()
 
void DrawWoF ()
 
void EnsureRenderTargetContent ()
 
bool FullTile (int x, int y)
 
void GUIBarsDrawInner ()
 
void GUIChatDrawInner ()
 
void GUIHotbarDrawInner ()
 
override void Initialize ()
 
void InitMap ()
 
void InitTargets ()
 
void InitTargets (int width, int height)
 
override void LoadContent ()
 
IEnumerator LoadContent_Deferred ()
 
void LoadSettings ()
 
void OldDrawBackground ()
 
void OpenLegacySettings ()
 
void OpenRecent ()
 
void QuitGame ()
 
Microsoft.Xna.Framework.Color randColor ()
 
void ReleaseTargets ()
 
void RenderBackground ()
 
void RenderBlack ()
 
void RenderTiles ()
 
void RenderTiles2 ()
 
void RenderWalls ()
 
void RenderWater ()
 
void SetTitle ()
 
void SortDrawCacheWorms ()
 
override void UnloadContent ()
 
override void Update (GameTime gameTime)
 
void UpdateAudio ()
 
- Protected Member Functions inherited from Game
virtual bool BeginDraw ()
 
virtual void BeginRun ()
 
virtual void Dispose (bool disposing)
 
virtual void Draw (GameTime gameTime)
 
virtual void EndDraw ()
 
virtual void EndRun ()
 
virtual void Initialize ()
 
virtual void LoadContent ()
 
virtual void OnActivated (object sender, EventArgs args)
 
virtual void OnDeactivated (object sender, EventArgs args)
 
virtual void OnExiting (object sender, EventArgs args)
 
virtual bool ShowMissingRequirementMessage (Exception exception)
 
virtual void UnloadContent ()
 
virtual void Update (GameTime gameTime)
 

Protected Attributes

List< Tuple< int, int, ushort > > DrawWiresSpecialTiles = new List<Tuple<int, int, ushort>>()
 

Properties

static AchievementAdvisor AchievementAdvisor [get]
 
static AchievementManager Achievements [get]
 
static ActiveEntityIterator< ItemActiveItems [get]
 Use to iterate over active items. Game logic is usually only interested in Entity.active elements, this iterator facilitates that usage and allows for simpler and more readable code. Typically used in a foreach statement: More...
 
static INetDiagnosticsUI ActiveNetDiagnosticsUI [get]
 
static ActiveEntityIterator< NPCActiveNPCs [get]
 Use to iterate over active players. Game logic is usually only interested in Entity.active elements, this iterator facilitates that usage and allows for simpler and more readable code. Typically used in a foreach statement: More...
 
static ActiveEntityIterator< PlayerActivePlayers [get]
 Use to iterate over active players. Game logic is usually only interested in Entity.active elements, this iterator facilitates that usage and allows for simpler and more readable code. Typically used in a foreach statement: More...
 
static ActiveEntityIterator< ProjectileActiveProjectiles [get]
 Use to iterate over active projectiles. Game logic is usually only interested in Entity.active elements, this iterator facilitates that usage and allows for simpler and more readable code. Typically used in a foreach statement: More...
 
static bool CanShowInfoAccs [get]
 
static bool CanUpdateGameplay [get]
 
static Player CurrentPlayer [get]
 A replacement for Main.LocalPlayer which respects whichever player is currently running hooks on the main thread. This works in the player select screen, and in multiplayer (when other players are updating)
 
static Matrix CurrentWantedZoomMatrix [get]
 
static SamplerState DefaultSamplerState [get]
 
static Color DiscoColor [get]
 A color that cycles through the colors like Rainbow Brick does.
 
static bool expertMode [get]
 Returns true if the world is an Expert Mode world. Will be true even in Master Mode worlds.
 
static int GameMode [get, set]
 
static GameModeData GameModeInfo [get]
 
static bool GamepadDisableCursorItemIcon [get]
 
static uint GameUpdateCount [get]
 Counts game updates since the world was loaded. Updates even while gameplay is paused, but does not update on the main menus. Can be used to drive regular logic that doesn't need to run every update. The Modulo Timer section of the Time and Timers wiki pagehas examples. Player.miscCounter is a similar counter that should be used specifically for player effects.
 
static bool HasSmartInteractTarget [get]
 
static bool IsGraphicsDeviceAvailable [get]
 
static bool IsItAHappyWindyDay [get]
 
static bool IsItRaining [get]
 
static bool IsItStorming [get]
 
static Player LocalPlayer [get]
 Retrieves the Player object for the local user. Shorthand for player[myPlayer].
Many gameplay elements such as recipes, UI, TownNPC chat, and Biome logic are only executed locally, LocalPlayer is suitable for code relating to those situations. If the hook has a Player parameter, it is likely not suitable to use LocalPlayer in it.
 
static CreativeUnlocksTracker LocalPlayerCreativeTracker [get]
 
static bool masterMode [get]
 Returns true if the world is a Master Mode world. Note that the expertMode will also be true.
 
static Vector2 MouseScreen [get]
 Fetches the position of the mouse cursor on the screen.
Useful for making things visually happen near the cursor.

 
static Color MouseTextColorReal [get]
 The typical pulsing white color used for much of the text shown in-game.
 
static Vector2 MouseWorld [get]
 Fetches the position of the mouse cursor in the world.
Useful for making things functionally happen near the cursor, such as projectile or NPC spawns.

 
static int npcShop [get, set]
 
static Effect pixelShader [get]
 
static bool PlayerLoaded [get]
 
static string playerPathName [get]
 
static UnifiedRandom rand [get, set]
 
int RecommendedEquipmentAreaPushUp [get]
 
static bool RenderTargetsRequired [get]
 
static string SavePath [get]
 
static Effect screenShader [get]
 
static Microsoft.Xna.Framework.Point ScreenSize [get]
 
static bool ShouldDrawInfoIconsHorizontally [get]
 
static bool ShouldPVPDraw [get]
 
static bool SmartCursorIsUsed [get]
 
static bool SmartCursorWanted [get]
 
static bool specialSeedWorld [get]
 Returns true if any secret world seedis active for this world.
 
static string statusText [get, set]
 
static bool ThickMouse [get]
 
static Effect tileShader [get]
 
static Matrix Transform [get]
 
static float UIScale [get, set]
 
static Matrix UIScaleMatrix [get]
 
float UIScaleMax [get]
 
static float UIScaleWanted [get]
 
static int UnderworldLayer [get]
 The y-coordinate of the top of the underworld, in tile coordinates. More...
 
static ulong UnpausedUpdateSeed [get]
 
static Effect vertexPixelShader [get]
 
static Vector2 ViewPosition [get]
 
static Vector2 ViewSize [get]
 
static float WindForVisuals [get]
 
static bool WindyEnoughForKiteDrops [get]
 
static string worldPathName [get]
 
- Properties inherited from Game
GameComponentCollection Components [get]
 
ContentManager Content [get, set]
 
GraphicsDevice GraphicsDevice [get]
 
TimeSpan InactiveSleepTime [get, set]
 
bool IsActive [get]
 
bool IsFixedTimeStep [get, set]
 
bool IsMouseVisible [get, set]
 
LaunchParameters LaunchParameters [get]
 
GameServiceContainer Services [get]
 
TimeSpan TargetElapsedTime [get, set]
 
GameWindow Window [get]
 

Events

static Action OnEngineLoad
 
static Action OnEnginePreload
 
static Action< GameTime > OnPostDraw
 
static Action< Vector2, float > OnPostFullscreenMapDraw
 
static Action< GameTime > OnPreDraw
 
static ResolutionChangeEvent OnRenderTargetsInitialized
 
static Action OnRenderTargetsReleased
 
static Action< Vector2 > OnResolutionChanged
 
static Action OnTickForInternalCodeOnly
 
static Action OnTickForThirdPartySoftwareOnly
 
- Events inherited from Game
EventHandler< EventArgs > Activated
 
EventHandler< EventArgs > Deactivated
 
EventHandler< EventArgs > Disposed
 
EventHandler< EventArgs > Exiting
 

Member Function Documentation

◆ DamageVar()

static int Main.DamageVar ( float  dmg,
float  luck = 0f 
)
static

Multiplies the input damage by a random value between 0.85f and 1.15f.

Parameters
dmgThe damage to vary.
luckHow lucky the damager is, in the range [-1f, 1f].
If luck > 0f, there is a luck % chance that damage variation is rerolled, with the higher value being used.
If luck < 0f, there is a -luck % chance that damage variation is rerolled, with the lower value being used.
Returns
The varied damage value, rounded to the nearest integer.

◆ Draw()

override void Main.Draw ( GameTime  gameTime)
protectedvirtual

Reimplemented from Game.

◆ DrawBuffIcon()

static int Main.DrawBuffIcon ( int  drawBuffText,
int  buffSlotOnPlayer,
int  x,
int  y 
)
static

Draws the buff icon corresponding to the buff in Main.LocalPlayer.buffType[buffSlotOnPlayer ].

Calls TML hooks related to drawing and clicking.

Has two exclusive contexts: Below the accessory slots (Main.EquipPage == 2), and regular under-the-inventory.

Parameters
drawBuffTextThe return from a previous DrawBuffIcon call, -1 if first drawn buff
buffSlotOnPlayerThe index for buffType and buffTime
xTop-left draw position on the x-axis
yTop-left draw position on the y-axis
Returns
The index of the currently mouseovered buff icon, equal to buffSlotOnPlayer if it's currently mouseovered, -1 otherwise

◆ DrawHealthBar()

void Main.DrawHealthBar ( float  X,
float  Y,
int  Health,
int  MaxHealth,
float  alpha,
float  scale = 1f,
bool  noFlip = false 
)

Draws a small health bar.
spriteBatch should already be started before calling this method.

Parameters
XThe x-coordinate of the health bar in world coordinates.
YThe y-coordinate of the health bar in world coordinates.
HealthThe current health displayed. The health bar is drawn Health / MaxHealth percent full.
If Health <= 0, no health bar is drawn.
If Health > MaxHealth , the health bar will not exceed max capacity.
MaxHealthThe maximum health displayed. The health bar is drawn Health / MaxHealth percent full.
alphaThe opacity of the healthbar, where 0f is transparent and 1f is opaque.
scaleThe visual scale of the health bar.
noFlipIf true, then the health bar will not adjust its y-position for players with reversed gravity.

◆ GetItemDrawFrame()

static void Main.GetItemDrawFrame ( int  item,
out Texture2D  itemTexture,
out Microsoft.Xna.Framework.Rectangle  itemFrame 
)
static

Gets the texture and frame of the given item type (Item.type).

Parameters
itemThe item type to use.
itemTextureThe Texture2D in TextureAssets.Item of item .
itemFrameThe Rectangle covering this item's current frame on itemTexture .

◆ Initialize()

override void Main.Initialize ( )
protectedvirtual

Reimplemented from Game.

◆ LoadContent()

override void Main.LoadContent ( )
protectedvirtual

Reimplemented from Game.

◆ LoadItem()

void Main.LoadItem ( int  i)

Loads the item texture if needed. All modded item textures are already loaded during mod loading so this is only needed before accessing vanilla item textures. Use TextureAssets.Item to access the item texture: TextureAssets.Item[Type].Value

Parameters
i

◆ LoadNPC()

void Main.LoadNPC ( int  i)

Loads the NPC texture if needed. All modded NPC textures are already loaded during mod loading so this is only needed before accessing vanilla NPC textures. Use TextureAssets.Npc to access the NPC texture: TextureAssets.Npc[Type].Value

Parameters
i

◆ LoadProjectile()

void Main.LoadProjectile ( int  i)

Loads the projectile texture if needed. All modded projectile textures are already loaded during mod loading so this is only needed before accessing vanilla projectile textures. Use TextureAssets.Projectile to access the projectile texture: TextureAssets.Projectile[Type].Value

Parameters
i

◆ LoadTiles()

void Main.LoadTiles ( int  i)

Loads the tile texture if needed. All modded tile textures are already loaded during mod loading so this is only needed before accessing vanilla tile textures. Use TextureAssets.Tile to access the tile texture: TextureAssets.Tile[Type].Value

Parameters
i

◆ LoadWall()

void Main.LoadWall ( int  i)

Loads the wall texture if needed. All modded wall textures are already loaded during mod loading so this is only needed before accessing vanilla wall textures. Use TextureAssets.Wall to access the tile texture: TextureAssets.Wall[Type].Value

Parameters
i

◆ RegisterItemAnimation()

static void Main.RegisterItemAnimation ( int  index,
DrawAnimation  animation 
)
static

Registers an animation for an item type to draw inside UI (not world or held item on player). To enable its animation in the world, use ItemID.Sets.AnimatesAsSoul in conjunction with this

Parameters
indexItem type
animationDraw animation

◆ RunOnMainThread()

static Task Main.RunOnMainThread ( Action  action)
static

Wait for an action to be performed on the main thread.

Parameters
action

◆ RunOnMainThread< T >()

static Task< T > Main.RunOnMainThread< T > ( Func< T >  func)
static

Wait for an action to be performed on the main thread.

Parameters
func

◆ TryGetBuffTime()

static bool Main.TryGetBuffTime ( int  buffSlotOnPlayer,
out int  buffTimeValue 
)
static

Checks if the buff at index buffSlotOnPlayer is allowed to draw a "remaining time" text, and sets buffTimeValue to it.

Check buffTimeValue > 2 afterwards if you want to mirror text draw logic.

Parameters
buffSlotOnPlayerThe index for buffType and buffTime
buffTimeValueThe "remaining time" in ticks
Returns
true if buffTimeValue is set, otherwise false

◆ TryRemovingBuff()

static void Main.TryRemovingBuff ( int  i,
int  b 
)
static

Calls Player.DelBuff with index i after checking Main.debuff of buff type b. Will toggle Player.hideMisc for pet and light pet.

Parameters
iThe index for buffType and buffTime
bThe buff type

◆ UnloadContent()

override void Main.UnloadContent ( )
protectedvirtual

Reimplemented from Game.

◆ Update()

override void Main.Update ( GameTime  gameTime)
protectedvirtual

Reimplemented from Game.

Member Data Documentation

◆ cloudBG

int [] Main.cloudBG
static
Initial value:
= new int[2] {
112,
113
}

◆ debuff

bool [] Main.debuff = new bool[BuffID.Count]
static

Categorizes status effects for which this is set to true as being debuffs instead of buffs.
This has multiple effects on gameplay:

  • the Nurse can remove the status effect when healing the afflicted player (to prevent this, refer to BuffID.Sets.NurseCannotRemoveDebuff)
  • the status effect cannot be cleared from overflowing the status effect cap (buffs will be cleared instead)
  • the status effect cannot be cleared by right-clicking it (which can be done for all other status effect types)
    Defaults to false; all vanilla debuffs have their entries here set to true.

◆ hotbarScale

float [] Main.hotbarScale
static
Initial value:
= new float[10] {
1f,
0.75f,
0.75f,
0.75f,
0.75f,
0.75f,
0.75f,
0.75f,
0.75f,
0.75f
}

◆ OffsetsNPCOffhand

Vector2 [] Main.OffsetsNPCOffhand
static
Initial value:
= new Vector2[5] {
new Vector2(14f, 34f),
new Vector2(14f, 32f),
new Vector2(14f, 26f),
new Vector2(14f, 22f),
new Vector2(14f, 18f)
}

◆ OffsetsPlayerHeadgear

Vector2 [] Main.OffsetsPlayerHeadgear
static
Initial value:
= new Vector2[20] {
new Vector2(0f, 2f),
new Vector2(0f, 2f),
new Vector2(0f, 2f),
new Vector2(0f, 2f),
new Vector2(0f, 2f),
new Vector2(0f, 2f),
new Vector2(0f, 2f),
new Vector2(0f, 0f),
new Vector2(0f, 0f),
new Vector2(0f, 0f),
new Vector2(0f, 2f),
new Vector2(0f, 2f),
new Vector2(0f, 2f),
new Vector2(0f, 2f),
new Vector2(0f, 0f),
new Vector2(0f, 0f),
new Vector2(0f, 0f),
new Vector2(0f, 2f),
new Vector2(0f, 2f),
new Vector2(0f, 2f)
}

◆ OffsetsPlayerOffhand

Vector2 [] Main.OffsetsPlayerOffhand
static
Initial value:
= new Vector2[20] {
new Vector2(14f, 20f),
new Vector2(14f, 20f),
new Vector2(14f, 20f),
new Vector2(14f, 18f),
new Vector2(14f, 20f),
new Vector2(16f, 4f),
new Vector2(16f, 16f),
new Vector2(18f, 14f),
new Vector2(18f, 14f),
new Vector2(18f, 14f),
new Vector2(16f, 16f),
new Vector2(16f, 16f),
new Vector2(16f, 16f),
new Vector2(16f, 16f),
new Vector2(14f, 14f),
new Vector2(14f, 14f),
new Vector2(12f, 14f),
new Vector2(14f, 16f),
new Vector2(16f, 16f),
new Vector2(16f, 16f)
}

◆ OffsetsPlayerOnhand

Vector2 [] Main.OffsetsPlayerOnhand
static
Initial value:
= new Vector2[20] {
new Vector2(6f, 19f),
new Vector2(5f, 10f),
new Vector2(12f, 10f),
new Vector2(13f, 17f),
new Vector2(12f, 19f),
new Vector2(5f, 10f),
new Vector2(7f, 17f),
new Vector2(6f, 16f),
new Vector2(6f, 16f),
new Vector2(6f, 16f),
new Vector2(6f, 17f),
new Vector2(7f, 17f),
new Vector2(7f, 17f),
new Vector2(7f, 17f),
new Vector2(8f, 17f),
new Vector2(9f, 16f),
new Vector2(9f, 12f),
new Vector2(8f, 17f),
new Vector2(7f, 17f),
new Vector2(7f, 17f)
}

◆ RegisteredGameModes

Dictionary<int, GameModeData> Main.RegisteredGameModes
static
Initial value:
= new Dictionary<int, GameModeData> {
{ 0, GameModeData.NormalMode },
{ 1, GameModeData.ExpertMode },
{ 2, GameModeData.MasterMode },
{ 3, GameModeData.CreativeMode }
}

◆ rockLayer

double Main.rockLayer
static

The y-coordinate of the top of the caverns layer, in tile coordinates.

Players in this layer will have Player.ZoneRockLayerHeight set to true.

◆ time

double Main.time = 13500.0
static

The time that has passed since it last became day/night.
Increased by dayRate every tick.
If it is dayTime, this caps at dayLength. Otherwise, this caps at nightLength.

If you need 24-hour time, use Utils.GetDayTimeAs24FloatStartingFromMidnight.

◆ worldSurface

double Main.worldSurface
static

The y-coordinate of the top of the dirt layer, in tile coordinates. Corresponds to 0' on the Depth Meter.

Players under the surface will have Player.ZoneDirtLayerHeight set to true.

Property Documentation

◆ ActiveItems

ActiveEntityIterator<Item> Main.ActiveItems
staticget

Use to iterate over active items. Game logic is usually only interested in Entity.active elements, this iterator facilitates that usage and allows for simpler and more readable code. Typically used in a foreach statement:

foreach (var item in Main.ActiveItems) { // Code } This is equivalent to the less convenient approach: for (int i = 0; i < Main.maxItems; i++) { var item = Main.item[i]; if (!item.active) continue; // Code } Note that if the index of the Item in the Main.item array is needed, Entity.whoAmI can not be used. This will be fixed in 1.4.5, but for now the for loop approach would have to be used instead.

◆ ActiveNPCs

ActiveEntityIterator<NPC> Main.ActiveNPCs
staticget

Use to iterate over active players. Game logic is usually only interested in Entity.active elements, this iterator facilitates that usage and allows for simpler and more readable code. Typically used in a foreach statement:

foreach (var npc in Main.ActiveNPCs) { // Code } This is equivalent to the less convenient approach: for (int i = 0; i < Main.maxNPCs; i++) { var npc = Main.npc[i]; if (!npc.active) continue; // Code } Note that if the index of the NPC in the Main.npc array is needed, Entity.whoAmI can be used.

◆ ActivePlayers

ActiveEntityIterator<Player> Main.ActivePlayers
staticget

Use to iterate over active players. Game logic is usually only interested in Entity.active elements, this iterator facilitates that usage and allows for simpler and more readable code. Typically used in a foreach statement:

foreach (var player in Main.ActivePlayers) { // Code } This is equivalent to the less convenient approach: for (int i = 0; i < Main.maxPlayers; i++) { var player = Main.player[i]; if (!player.active) continue; // Code } Note that if the index of the Player in the Main.player array is needed, Entity.whoAmI can be used.

◆ ActiveProjectiles

ActiveEntityIterator<Projectile> Main.ActiveProjectiles
staticget

Use to iterate over active projectiles. Game logic is usually only interested in Entity.active elements, this iterator facilitates that usage and allows for simpler and more readable code. Typically used in a foreach statement:

foreach (var projectile in Main.ActiveProjectiles) { // Code } This is equivalent to the less convenient approach: for (int i = 0; i < Main.maxProjectiles; i++) { var projectile = Main.projectile[i]; if (!projectile.active) continue; // Code } Note that if the index of the Projectile in the Main.projectile array is needed, Entity.whoAmI can be used.

◆ UnderworldLayer

int Main.UnderworldLayer
staticget

The y-coordinate of the top of the underworld, in tile coordinates.

Player in this layer will have Player.ZoneUnderworldHeight set to true.