tModLoader TileCore

Rartrin

Terrarian
Current Version: [0.0.0.4]
TileCore, as its name suggests, is a core mod.
The goal of TileCore is to give helpful standardized utilities for tile data management.
This includes TileInfo which helps to provide a means for allowing tiles to have extra data attached to them.

This mod core is downloadable via the tModLoader Mod Browser.

This mod does not constantly store info for every single tile. Instead, it only creates info for a tile that has been request with GetModInfo, but once created, it will persist until either RemModInfo is called or the world ends (unless the info needsaving).
Eventually, I hope to add a bool hook for whether to keep the info when the Tile type has changed.
That said, take care when managing data and make sure to RemModInfo for any tiles that no longer need to be there, or at least return false in NeedsSaving if your tile type differs from what it should be.

[Adding TileInfo]
Autoloading is currently not supported so to add a TileInfo, call mod.AddTileInfo(string name,TileInfo info) in your mod's Load method.

[Fields]
public Mod mod{get;internal set;}
public string Name{get;internal set;}

[Hooks]
public virtual bool NeedsSaving(int i,int j)
public virtual void SaveInfo(int i,int j,BinaryWriter writer)
public virtual void LoadInfo(int i,int j,BinaryReader reader)

[Retrieving Info from Tile]
tile.GetModInfo<TileInfo>(Mod mod)
tile.GetModInfo(Mod mod,string TileInfoName)

[Removing Info from Tile (Returns true if successful)]
tile.RemModInfo<TileInfo>(Mod mod)
tile.RemModInfo(Mod mod,string TileInfoName)

Initial release, description updates, and homepage added
 
Last edited:
Back
Top Bottom