tModLoader v2024.10
A mod to make and play Terraria mods
TileLoader Class Reference

This serves as the central class from which tile-related functions are supported and carried out. More...

Static Public Member Functions

static void AdjTiles (Player player, int type)
 
static void AnimateTiles ()
 
static int AutoSelect (int i, int j, Player player)
 
static bool CanDropAcorn (int type)
 
static bool CanExplode (int i, int j)
 
static bool CanGrowModCactus (int type)
 
static bool CanGrowModPalmTree (int type)
 
static bool CanGrowModTree (int type)
 
static bool CanKillTile (int i, int j, int type, ref bool blockDamaged)
 
static bool CanPlace (int i, int j, int type)
 
static bool CanReplace (int i, int j, int type, int tileTypeBeingPlaced)
 
static void ChangeWaterfallStyle (int type, ref int style)
 
static void CheckModTile (int i, int j, int type)
 
static int CloseDoorID (Tile tile)
 
static bool CreateDust (int i, int j, int type, ref int dustType)
 
static string DefaultContainerName (int type, int frameX, int frameY)
 Returns the default name for a modded chest or dresser with the provided FrameX and FrameY values.
 
static void DrawEffects (int i, int j, int type, SpriteBatch spriteBatch, ref TileDrawInfo drawData)
 
static bool Drop (int i, int j, int type, bool includeLargeObjectDrops=true)
 
static void DropCritterChance (int i, int j, int type, ref int wormChance, ref int grassHopperChance, ref int jungleGrubChance)
 
static void DropPalmTreeWood (int type, ref int wood)
 
static void DropTreeWood (int type, ref int wood)
 
static void FloorVisuals (int type, Player player)
 
static Texture2D GetCactusTexture (int type)
 
static int GetItemDropFromTypeAndStyle (int type, int style=0)
 Retrieves the item type that would drop from a tile of the specified type and style. This method is only reliable for modded tile types. This method can be used in ModTile.GetItemDrops(int, int) for tiles that have custom tile style logic. If the specified style is not found, a fallback item will be returned if one has been registered through ModTile.RegisterItemDrop(int, int[]) usage.
Modders querying modded tile drops should use ModTile.GetItemDrops(int, int) directly rather that use this method so that custom drop logic is accounted for.
A return of 0 indicates that no item would drop from the tile. More...
 
static void GetItemDrops (int x, int y, Tile tileCache, bool includeLargeObjectDrops=false, bool includeAllModdedLargeObjectDrops=false)
 
static ModTile GetTile (int type)
 Gets the ModTile instance with the given type. If no ModTile with the given type exists, returns null. More...
 
static bool HasSmartInteract (int i, int j, int type, SmartInteractScanSettings settings)
 
static bool HasWalkDust (int type)
 
static void HitWire (int i, int j, int type)
 
static bool IsClosedDoor (int type)
 Returns true if the tile is a vanilla or modded closed door.
 
static bool IsClosedDoor (Tile tile)
 
static bool IsLockedChest (int i, int j, int type)
 
static bool IsModMusicBox (Tile tile)
 
static ? bool IsTileBiomeSightable (int i, int j, int type, ref Color sightColor)
 
static ? bool IsTileDangerous (int i, int j, int type, Player player)
 
static ? bool IsTileSpelunkable (int i, int j, int type)
 
static void KillMultiTile (int i, int j, int frameX, int frameY, int type)
 
static bool KillSound (int i, int j, int type, bool fail)
 
static void KillTile (int i, int j, int type, ref bool fail, ref bool effectOnly, ref bool noItem)
 
static bool LockChest (int i, int j, int type, ref short frameXAdjustment, ref bool manual)
 
static void ModifyFrameMerge (int type, int i, int j, ref int up, ref int down, ref int left, ref int right, ref int upLeft, ref int upRight, ref int downLeft, ref int downRight)
 
static void ModifyLight (int i, int j, int type, ref float r, ref float g, ref float b)
 
static void ModifySittingTargetInfo (int i, int j, int type, ref TileRestingInfo info)
 
static void ModifySleepingTargetInfo (int i, int j, int type, ref TileRestingInfo info)
 
static void ModifySmartInteractCoords (int type, ref int width, ref int height, ref int frameWidth, ref int frameHeight, ref int extraY)
 
static void ModifyTorchLuck (Player player, ref float positiveLuck, ref float negativeLuck)
 
static void MouseOver (int i, int j)
 
static void MouseOverFar (int i, int j)
 
static void NearbyEffects (int i, int j, int type, bool closer)
 
static void NumDust (int i, int j, int type, bool fail, ref int numDust)
 
static int OpenDoorID (Tile tile)
 
static void PalmTreeDust (Tile tile, ref int dust)
 
static void PickPowerCheck (Tile target, int pickPower, ref int damage)
 
static void PlaceInWorld (int i, int j, Item item)
 
static void PostDraw (int i, int j, int type, SpriteBatch spriteBatch)
 
static void PostSetupTileMerge ()
 
static void PostTileFrame (int type, int i, int j, int up, int down, int left, int right, int upLeft, int upRight, int downLeft, int downRight)
 
static bool PreDraw (int i, int j, int type, SpriteBatch spriteBatch)
 
static bool PreHitWire (int i, int j, int type)
 
static void RandomUpdate (int i, int j, int type)
 
static void RecountTiles (SceneMetrics metrics)
 
static bool RightClick (int i, int j)
 
static bool SaplingGrowthType (int soilType, ref int saplingType, ref int style)
 
static void SetAnimationFrame (int type, int i, int j, ref int frameXOffset, ref int frameYOffset)
 Sets the animation frame. Sets frameYOffset = modTile.animationFrameHeight * Main.tileFrame[type]; and then calls ModTile.AnimateIndividualTile More...
 
static void SetDrawPositions (int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY)
 
static void SetSpriteEffects (int i, int j, int type, ref SpriteEffects spriteEffects)
 
static bool Slope (int i, int j, int type)
 
static void SpecialDraw (int type, int specialTileX, int specialTileY, SpriteBatch spriteBatch)
 Special Draw calls ModTile and GlobalTile SpecialDraw methods. Special Draw is called at the end of the DrawSpecialTilesLegacy loop, allowing for basically another layer above tiles. Use DrawEffects hook to queue for SpecialDraw.
 
static bool TileFrame (int i, int j, int type, ref bool resetFrame, ref bool noBreak)
 
static void TreeDust (Tile tile, ref int dust)
 
static bool UnlockChest (int i, int j, int type, ref short frameXAdjustment, ref int dustType, ref bool manual)
 
static void WalkDust (int type, ref int dustType, ref bool makeDust, ref Color color)
 

Properties

static int TileCount [get]
 

Detailed Description

This serves as the central class from which tile-related functions are supported and carried out.

Member Function Documentation

◆ GetItemDropFromTypeAndStyle()

static int TileLoader.GetItemDropFromTypeAndStyle ( int  type,
int  style = 0 
)
static

Retrieves the item type that would drop from a tile of the specified type and style. This method is only reliable for modded tile types. This method can be used in ModTile.GetItemDrops(int, int) for tiles that have custom tile style logic. If the specified style is not found, a fallback item will be returned if one has been registered through ModTile.RegisterItemDrop(int, int[]) usage.
Modders querying modded tile drops should use ModTile.GetItemDrops(int, int) directly rather that use this method so that custom drop logic is accounted for.
A return of 0 indicates that no item would drop from the tile.

Parameters
type
style
Returns

◆ GetTile()

static ModTile TileLoader.GetTile ( int  type)
static

Gets the ModTile instance with the given type. If no ModTile with the given type exists, returns null.

Parameters
typeThe type of the ModTile
Returns
The ModTile instance in the tiles array, null if not found.

◆ SetAnimationFrame()

static void TileLoader.SetAnimationFrame ( int  type,
int  i,
int  j,
ref int  frameXOffset,
ref int  frameYOffset 
)
static

Sets the animation frame. Sets frameYOffset = modTile.animationFrameHeight * Main.tileFrame[type]; and then calls ModTile.AnimateIndividualTile

Parameters
typeThe tile type.
iThe x position in tile coordinates.
jThe y position in tile coordinates.
frameXOffsetThe offset to frameX.
frameYOffsetThe offset to frameY.