TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches
Terraria.ModLoader.TileLoader Class Reference

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

+ Collaboration diagram for Terraria.ModLoader.TileLoader:

Static Public Member Functions

static ModTile GetTile (int type)
 Gets the ModTile instance with the given type. If no ModTile with the given type exists, returns null.
 
static void CheckModTile (int i, int j, int type)
 
static int OpenDoorID (Tile tile)
 
static int CloseDoorID (Tile tile)
 
static bool IsClosedDoor (Tile tile)
 
static bool IsClosedDoor (int type)
 Returns true if the tile is a vanilla or modded closed door.
 
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 bool IsModMusicBox (Tile tile)
 
static bool HasSmartInteract (int i, int j, int type, SmartInteractScanSettings settings)
 
static void ModifySmartInteractCoords (int type, ref int width, ref int height, ref int frameWidth, ref int frameHeight, ref int extraY)
 
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 bool KillSound (int i, int j, int type, bool fail)
 
static void NumDust (int i, int j, int type, bool fail, ref int numDust)
 
static bool CreateDust (int i, int j, int type, ref int dustType)
 
static void DropCritterChance (int i, int j, int type, ref int wormChance, ref int grassHopperChance, ref int jungleGrubChance)
 
static bool Drop (int i, int j, int type, bool includeLargeObjectDrops=true)
 
static void GetItemDrops (int x, int y, Tile tileCache, bool includeLargeObjectDrops=false, bool includeAllModdedLargeObjectDrops=false)
 
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 M:Terraria.ModLoader.ModTile.GetItemDrops(System.Int32,System.Int32) 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 M:Terraria.ModLoader.ModTile.RegisterItemDrop(System.Int32,System.Int32[]) usage.
Modders querying modded tile drops should use M:Terraria.ModLoader.ModTile.GetItemDrops(System.Int32,System.Int32) 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.
 
static bool CanKillTile (int i, int j, int type, ref bool blockDamaged)
 
static void KillTile (int i, int j, int type, ref bool fail, ref bool effectOnly, ref bool noItem)
 
static void KillMultiTile (int i, int j, int frameX, int frameY, int type)
 
static bool CanExplode (int i, int j)
 
static void NearbyEffects (int i, int j, int type, bool closer)
 
static void ModifyTorchLuck (Player player, ref float positiveLuck, ref float negativeLuck)
 
static void ModifyLight (int i, int j, int type, ref float r, ref float g, ref float b)
 
static ? bool IsTileDangerous (int i, int j, int type, Player player)
 
static ? bool IsTileBiomeSightable (int i, int j, int type, ref Color sightColor)
 
static ? bool IsTileSpelunkable (int i, int j, int type)
 
static void SetSpriteEffects (int i, int j, int type, ref SpriteEffects spriteEffects)
 
static void SetDrawPositions (int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY)
 
static void AnimateTiles ()
 
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.
 
static bool PreDraw (int i, int j, int type, SpriteBatch spriteBatch)
 
static void DrawEffects (int i, int j, int type, SpriteBatch spriteBatch, ref TileDrawInfo drawData)
 
static void PostDraw (int i, int j, int type, SpriteBatch spriteBatch)
 
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 void RandomUpdate (int i, int j, int type)
 
static bool TileFrame (int i, int j, int type, ref bool resetFrame, ref bool noBreak)
 
static void PickPowerCheck (Tile target, int pickPower, ref int damage)
 
static bool CanPlace (int i, int j, int type)
 
static bool CanReplace (int i, int j, int type, int tileTypeBeingPlaced)
 
static void AdjTiles (Player player, int type)
 
static bool RightClick (int i, int j)
 
static void MouseOver (int i, int j)
 
static void MouseOverFar (int i, int j)
 
static int AutoSelect (int i, int j, Player player)
 
static bool PreHitWire (int i, int j, int type)
 
static void HitWire (int i, int j, int type)
 
static void FloorVisuals (int type, Player player)
 
static bool Slope (int i, int j, int type)
 
static bool HasWalkDust (int type)
 
static void WalkDust (int type, ref int dustType, ref bool makeDust, ref Color color)
 
static void ChangeWaterfallStyle (int type, ref int style)
 
static bool SaplingGrowthType (int soilType, ref int saplingType, ref int style)
 
static bool CanGrowModTree (int type)
 
static void TreeDust (Tile tile, ref int dust)
 
static bool CanDropAcorn (int type)
 
static void DropTreeWood (int type, ref int wood)
 
static bool CanGrowModPalmTree (int type)
 
static void PalmTreeDust (Tile tile, ref int dust)
 
static void DropPalmTreeWood (int type, ref int wood)
 
static bool CanGrowModCactus (int type)
 
static Texture2D GetCactusTexture (int type)
 
static void PlaceInWorld (int i, int j, Item item)
 
static void PostSetupTileMerge ()
 
static bool IsLockedChest (int i, int j, int type)
 
static bool UnlockChest (int i, int j, int type, ref short frameXAdjustment, ref int dustType, ref bool manual)
 
static bool LockChest (int i, int j, int type, ref short frameXAdjustment, ref bool manual)
 
static void RecountTiles (SceneMetrics metrics)
 

Static Package Functions

static int ReserveTileID ()
 
static void ResizeArrays (bool unloading=false)
 
static void PostSetupContent ()
 
static void Unload ()
 
static void FinishSetup ()
 

Static Package Attributes

static readonly IList< ModTiletiles = new List<ModTile>()
 
static readonly IList< GlobalTileglobalTiles = new List<GlobalTile>()
 
static readonly Dictionary<(int, int), int > tileTypeAndTileStyleToItemType = new Dictionary<(int, int), int>()
 Maps Tile type and Tile style to the Item type that places the tile with the style.
 

Properties

static int TileCount [get]
 

Private Member Functions

delegate void DelegateNumDust (int i, int j, int type, bool fail, ref int num)
 
delegate bool DelegateCreateDust (int i, int j, int type, ref int dustType)
 
delegate void DelegateDropCritterChance (int i, int j, int type, ref int wormChance, ref int grassHopperChance, ref int jungleGrubChance)
 
delegate bool DelegateCanKillTile (int i, int j, int type, ref bool blockDamaged)
 
delegate void DelegateKillTile (int i, int j, int type, ref bool fail, ref bool effectOnly, ref bool noItem)
 
delegate void DelegateModifyLight (int i, int j, int type, ref float r, ref float g, ref float b)
 
delegate? bool DelegateIsTileBiomeSightable (int i, int j, int type, ref Color sightColor)
 
delegate void DelegateSetSpriteEffects (int i, int j, int type, ref SpriteEffects spriteEffects)
 
delegate void DelegateDrawEffects (int i, int j, int type, SpriteBatch spriteBatch, ref TileDrawInfo drawData)
 
delegate bool DelegateTileFrame (int i, int j, int type, ref bool resetFrame, ref bool noBreak)
 
delegate void DelegateChangeWaterfallStyle (int type, ref int style)
 

Static Private Member Functions

static void Resize2DArray< T > (ref T[,] array, int newSize)
 

Static Private Attributes

static int nextTile = TileID.Count
 
static bool loaded = false
 
static readonly int vanillaChairCount = TileID.Sets.RoomNeeds.CountsAsChair.Length
 
static readonly int vanillaTableCount = TileID.Sets.RoomNeeds.CountsAsTable.Length
 
static readonly int vanillaTorchCount = TileID.Sets.RoomNeeds.CountsAsTorch.Length
 
static readonly int vanillaDoorCount = TileID.Sets.RoomNeeds.CountsAsDoor.Length
 
static Func< int, int, int, bool, bool >[] HookKillSound
 
static DelegateNumDust[] HookNumDust
 
static DelegateCreateDust[] HookCreateDust
 
static DelegateDropCritterChance[] HookDropCritterChance
 
static Func< int, int, int, bool >[] HookCanDrop
 
static Action< int, int, int >[] HookDrop
 
static DelegateCanKillTile[] HookCanKillTile
 
static DelegateKillTile[] HookKillTile
 
static Func< int, int, int, bool >[] HookCanExplode
 
static Action< int, int, int, bool >[] HookNearbyEffects
 
static DelegateModifyLight[] HookModifyLight
 
static Func< int, int, int, Player, bool?>[] HookIsTileDangerous
 
static DelegateIsTileBiomeSightable[] HookIsTileBiomeSightable
 
static Func< int, int, int, bool?>[] HookIsTileSpelunkable
 
static DelegateSetSpriteEffects[] HookSetSpriteEffects
 
static Action[] HookAnimateTile
 
static Func< int, int, int, SpriteBatch, bool >[] HookPreDraw
 
static DelegateDrawEffects[] HookDrawEffects
 
static Action< int, int, int, SpriteBatch >[] HookPostDraw
 
static Action< int, int, int, SpriteBatch >[] HookSpecialDraw
 
static Action< int, int, int >[] HookRandomUpdate
 
static DelegateTileFrame[] HookTileFrame
 
static Func< int, int, int, bool >[] HookCanPlace
 
static Func< int, int, int, int, bool >[] HookCanReplace
 
static Func< int, int[]>[] HookAdjTiles
 
static Action< int, int, int >[] HookRightClick
 
static Action< int, int, int >[] HookMouseOver
 
static Action< int, int, int >[] HookMouseOverFar
 
static Func< int, int, int, Item, bool >[] HookAutoSelect
 
static Func< int, int, int, bool >[] HookPreHitWire
 
static Action< int, int, int >[] HookHitWire
 
static Func< int, int, int, bool >[] HookSlope
 
static Action< int, Player >[] HookFloorVisuals
 
static DelegateChangeWaterfallStyle[] HookChangeWaterfallStyle
 
static Action< int, int, int, Item >[] HookPlaceInWorld
 
static Action[] HookPostSetupTileMerge
 

Detailed Description

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

Definition at line 22 of file TileLoader.cs.


The documentation for this class was generated from the following file: