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

Public Member Functions

 TileDrawing (TilePaintSystemV2 paintSystem)
 
void AddSpecialLegacyPoint (int x, int y)
 
void AddSpecialLegacyPoint (Point p)
 
void ClearCachedTileDraws (bool solidLayer)
 
void Draw (bool solidLayer, bool forRenderTargets, bool intoRenderTargets, int waterStyleOverride=-1)
 
void DrawLiquidBehindTiles (int waterStyleOverride=-1)
 
void EmitLivingTreeLeaf (int i, int j, int leafGoreType)
 Emits a single living tree leaf or other gore instance directly below the target tile.
With a 50% chance, also emits a second leaf or other gore instance directly to the side of the target tile, dependent on wind direction.
Used by vanilla's two types of Living Trees, from which this method and its two submethods get their collective name.
More...
 
void EmitLivingTreeLeaf_Below (int x, int y, int leafGoreType)
 Emits a single living tree leaf or other gore instance directly below the target tile.
More...
 
void EmitLivingTreeLeaf_Sideways (int x, int y, int leafGoreType)
 Emits a single living tree leaf or other gore instance directly to the side of the target tile, dependent on wind direction.
More...
 
void GetTileDrawData (int x, int y, Tile tileCache, ushort typeCache, ref short tileFrameX, ref short tileFrameY, out int tileWidth, out int tileHeight, out int tileTop, out int halfBrickHeight, out int addFrX, out int addFrY, out SpriteEffects tileSpriteEffect, out Texture2D glowTexture, out Rectangle glowSourceRect, out Color glowColor)
 
Texture2D GetTileDrawTexture (Tile tile, int tileX, int tileY)
 
Texture2D GetTileDrawTexture (Tile tile, int tileX, int tileY, int paintOverride)
 
void GetTileOutlineInfo (int x, int y, ushort typeCache, ref Color tileLight, ref Texture2D highlightTexture, ref Color highlightColor)
 
float GetWindCycle (int x, int y, double windCounter)
 Fetches the degree to which wind would/should affect a tile at the given location. More...
 
float GetWindGridPush (int i, int j, int pushAnimationTimeTotal, float pushForcePerFrame)
 Determines how much wind should affect a theoretical tile at the target location on the current update tick. More...
 
float GetWindGridPushComplex (int i, int j, int pushAnimationTimeTotal, float totalPushForce, int loops, bool flipDirectionPerLoop)
 Determines how much wind should affect a theoretical tile at the target location on the current update tick.
More complex version of GetWindGridPush. More...
 
void PostDrawTiles (bool solidLayer, bool forRenderTargets, bool intoRenderTargets)
 
void PreDrawTiles (bool solidLayer, bool forRenderTargets, bool intoRenderTargets)
 
void PrepareForAreaDrawing (int firstTileX, int lastTileX, int firstTileY, int lastTileY, bool prepareLazily)
 
void PreparePaintForTilesOnScreen ()
 
bool ShouldSwayInWind (int x, int y, Tile tileCache)
 Determines whether or not the tile at the given location should be able to sway in the wind. More...
 
void SpecificHacksForCapture ()
 
void Update ()
 

Static Public Member Functions

static int GetBigAnimalCageFrame (int x, int y, int tileFrameX, int tileFrameY)
 
static int GetSmallAnimalCageFrame (int x, int y, int tileFrameX, int tileFrameY)
 
static int GetTreeVariant (int x, int y)
 
static int GetWaterAnimalCageFrame (int x, int y, int tileFrameX, int tileFrameY)
 
static bool IsTileDangerous (int tileX, int tileY, Player player)
 Checks if a tile at the given coordinates counts towards tile coloring from the Dangersense buff.
Vanilla only uses Main.LocalPlayer for player
 
static bool IsVisible (Tile tile)
 Returns true if the tile is visible. Tiles painted with Echo Coating as well as the Echo Platform, Echo Block, and Ghostly Stinkbug Blocker tiles will all be invisible unless the player has Echo Sight (Nearby active Echo Chamber tile or wearing Spectre Goggles) More...
 

Properties

WindGrid Wind [get]
 The wind grid used to exert wind effects on tiles.
 

Member Function Documentation

◆ EmitLivingTreeLeaf()

void TileDrawing.EmitLivingTreeLeaf ( int  i,
int  j,
int  leafGoreType 
)

Emits a single living tree leaf or other gore instance directly below the target tile.
With a 50% chance, also emits a second leaf or other gore instance directly to the side of the target tile, dependent on wind direction.
Used by vanilla's two types of Living Trees, from which this method and its two submethods get their collective name.

Parameters
iThe X coordinate of the target tile.
jThe Y coordinate of the target tile.
leafGoreTypeThe numerical ID of the leaf or other gore instance that should be spawned.

◆ EmitLivingTreeLeaf_Below()

void TileDrawing.EmitLivingTreeLeaf_Below ( int  x,
int  y,
int  leafGoreType 
)

Emits a single living tree leaf or other gore instance directly below the target tile.

Parameters
xThe X coordinate of the target tile.
yThe Y coordinate of the target tile.
leafGoreTypeThe numerical ID of the leaf or other gore instance that should be spawned.

◆ EmitLivingTreeLeaf_Sideways()

void TileDrawing.EmitLivingTreeLeaf_Sideways ( int  x,
int  y,
int  leafGoreType 
)

Emits a single living tree leaf or other gore instance directly to the side of the target tile, dependent on wind direction.

Parameters
xThe X coordinate of the target tile.
yThe Y coordinate of the target tile.
leafGoreTypeThe numerical ID of the leaf or other gore instance that should be spawned.

◆ GetWindCycle()

float TileDrawing.GetWindCycle ( int  x,
int  y,
double  windCounter 
)

Fetches the degree to which wind would/should affect a tile at the given location.

Parameters
xThe X coordinate of the theoretical target tile.
yThe Y coordinate of the theoretical target tile.
windCounter
Returns
If Main.SettingsEnabled_TilesSwayInWind is false or the tile is below surface level, 0.
Otherwise, returns a value from 0.08f to 0.18f.

◆ GetWindGridPush()

float TileDrawing.GetWindGridPush ( int  i,
int  j,
int  pushAnimationTimeTotal,
float  pushForcePerFrame 
)

Determines how much wind should affect a theoretical tile at the target location on the current update tick.

Parameters
iThe X coordinate of the theoretical target tile.
jThe Y coordinate of the theoretical target tile.
pushAnimationTimeTotalThe total amount of time, in ticks, that a wind push cycle for the theoretical target tile should last for.
pushForcePerFrameThe amount which wind should affect the theoretical target tile per frame.
Returns
The degree to which wind should affect the theoretical target tile, represented as a float.

◆ GetWindGridPushComplex()

float TileDrawing.GetWindGridPushComplex ( int  i,
int  j,
int  pushAnimationTimeTotal,
float  totalPushForce,
int  loops,
bool  flipDirectionPerLoop 
)

Determines how much wind should affect a theoretical tile at the target location on the current update tick.
More complex version of GetWindGridPush.

Parameters
iThe X coordinate of the theoretical target tile.
jThe Y coordinate of the theoretical target tile.
pushAnimationTimeTotalThe total amount of time, in ticks, that a wind push cycle for the theoretical target tile should last for.
totalPushForce
loops
flipDirectionPerLoop
Returns

◆ IsVisible()

static bool TileDrawing.IsVisible ( Tile  tile)
static

Returns true if the tile is visible. Tiles painted with Echo Coating as well as the Echo Platform, Echo Block, and Ghostly Stinkbug Blocker tiles will all be invisible unless the player has Echo Sight (Nearby active Echo Chamber tile or wearing Spectre Goggles)

Parameters
tile
Returns

◆ ShouldSwayInWind()

bool TileDrawing.ShouldSwayInWind ( int  x,
int  y,
Tile  tileCache 
)

Determines whether or not the tile at the given location should be able to sway in the wind.

Parameters
xThe X coordinate of the given tile.
yThe Y coordinate of the given tile.
tileCacheThe tile to determine the sway-in-wind-ability of.
Returns
False if something dictates that the tile should NOT be able to sway in the wind; returns true by default.
Vanilla conditions that prevent wind sway are, in this order:
  • if Main.SettingsEnabled_TilesSwayInWind is false
  • if TileID.Sets.SwaysInWindBasic is false for the tile type of tileCache
  • if the tile is an Orange Bloodroot
  • if the tile is a Pink Prickly Pear on any vanilla cactus variant