tModLoader v2022.09
A mod to make and play Terraria mods
Terraria.GameContent.Drawing.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 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 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 Update ()
 

Static Public Member Functions

static int GetTreeVariant (int x, int y)
 
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
 

Properties

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

Member Function Documentation

◆ EmitLivingTreeLeaf()

void Terraria.GameContent.Drawing.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.

◆ GetWindCycle()

float Terraria.GameContent.Drawing.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 Terraria.GameContent.Drawing.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 Terraria.GameContent.Drawing.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

◆ ShouldSwayInWind()

bool Terraria.GameContent.Drawing.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