![]() |
tModLoader v2025.03
A mod to make and play Terraria mods
|
Inherits ModTileEntity.
Public Member Functions | |
override bool | IsTileValidForEntity (int i, int j) |
Whether or not this tile entity is allowed to survive at the given coordinates. You should check whether the tile is active, as well as the tile's type and optionally the frame: More... | |
override void | LoadData (TagCompound tag) |
Allows you to load custom data that you have saved for this tile entity. Try to write defensive loading code that won't crash if something's missing. More... | |
override void | SaveData (TagCompound tag) |
Allows you to save custom data for this tile entity. NOTE: The provided tag is always empty by default, and is provided as an argument only for the sake of convenience and optimization. NOTE: Try to only save data that isn't default values. More... | |
![]() | |
int | Find (int i, int j) |
Returns the entity ID of this kind of tile entity at the given coordinates for you. | |
sealed override TileEntity | GenerateInstance () |
int | Generic_Hook_AfterPlacement (int i, int j, int type, int style, int direction, int alternate) |
A generic implementation of Hook_AfterPlacement(int, int, int, int, int, int) that should work for the TileObjectData.HookPostPlaceMyPlayer of any typical ModTileEntity. Will result in this ModTileEntity being placed in the top left corner of the multitile. Use Generic_HookPostPlaceMyPlayer directly or pair this with -1, 0, true as the remaining parameters of PlacementHook. | |
virtual int | Hook_AfterPlacement (int i, int j, int type, int style, int direction, int alternate) |
This method does not get called by tModLoader, and is only included for you convenience so you do not have to cast the result of Mod.GetTileEntity. More... | |
virtual bool | IsLoadingEnabled (Mod mod) |
Whether or not this type should be loaded when it's told to. Returning false disables Mod.AddContent from actually loading this type. More... | |
abstract override bool | IsTileValidForEntity (int x, int y) |
Whether or not this tile entity is allowed to survive at the given coordinates. You should check whether the tile is active, as well as the tile's type and optionally the frame: More... | |
void | Kill (int i, int j) |
A helper method that removes this kind of tile entity from the given coordinates for you. This is typically used in ModTile.KillMultiTile(int, int, int, int). | |
virtual void | Load () |
virtual void | Load (Mod mod) |
Called when loading the type. More... | |
override void | NetPlaceEntityAttempt (int i, int j) |
You should never use this. It is only included here for completion's sake. More... | |
override void | NetReceive (BinaryReader reader) |
Receives custom data sent in the NetSend hook. Called while receiving tile data (!lightReceive) and when MessageID.TileEntitySharing is received (lightReceive). Note that this is called on a new instance that will replace the existing instance at the Position, if any. ID is not necessarily assigned yet when this is called. Only called on the client. More... | |
override void | NetSend (BinaryWriter writer) |
Allows you to send custom data for this tile entity between client and server, which will be handled in NetReceive. Called while sending tile data (!lightSend) and when MessageID.TileEntitySharing is sent (lightSend). Only called on the server. More... | |
virtual void | OnKill () |
This method only gets called in the Kill method. If you plan to use that, you can put code here to make things happen when it is called. | |
virtual void | OnNetPlace () |
Code that should be run when this tile entity is placed by means of server-syncing. Called on Server only. | |
int | Place (int i, int j) |
A helper method that places this kind of tile entity in the given coordinates for you. | |
virtual void | PostGlobalUpdate () |
Code that should be run after all tile entities in the world update. | |
virtual void | PreGlobalUpdate () |
Code that should be run before all tile entities in the world update. | |
sealed override void | ReadExtraData (BinaryReader reader, bool networkSend) |
Should never be called on ModTileEntity. Replaced by NetReceive and LoadData Would make the base method internal if not for patch size More... | |
sealed override void | RegisterTileEntityID (int assignedID) |
virtual void | Unload () |
Called during unloading when needed. More... | |
sealed override void | WriteExtraData (BinaryWriter writer, bool networkSend) |
Should never be called on ModTileEntity. Replaced by NetSend and SaveData. Would make the base method internal if not for patch size More... | |
![]() | |
virtual TileEntity | GenerateInstance () |
virtual string | GetItemGamepadInstructions (int slot=0) |
virtual bool | IsTileValidForEntity (int x, int y) |
virtual void | LoadData (TagCompound tag) |
Allows you to load custom data that you have saved for this tile entity. Try to write defensive loading code that won't crash if something's missing. More... | |
virtual void | NetPlaceEntityAttempt (int x, int y) |
virtual void | NetReceive (BinaryReader reader) |
Receives custom data sent in the NetSend hook. Called while receiving tile data (!lightReceive) and when MessageID.TileEntitySharing is received (lightReceive). Note that this is called on a new instance that will replace the existing instance at the Position, if any. ID is not necessarily assigned yet when this is called. Only called on the client. More... | |
virtual void | NetSend (BinaryWriter writer) |
Allows you to send custom data for this tile entity between client and server, which will be handled in NetReceive. Called while sending tile data (!lightSend) and when MessageID.TileEntitySharing is sent (lightSend). Only called on the server. More... | |
virtual void | OnInventoryDraw (Player player, SpriteBatch spriteBatch) |
virtual void | OnPlayerUpdate (Player player) |
virtual bool | OverrideItemSlotHover (Item[] inv, int context=0, int slot=0) |
virtual bool | OverrideItemSlotLeftClick (Item[] inv, int context=0, int slot=0) |
virtual void | ReadExtraData (BinaryReader reader, bool networkSend) |
virtual void | RegisterTileEntityID (int assignedID) |
virtual void | SaveData (TagCompound tag) |
Allows you to save custom data for this tile entity. NOTE: The provided tag is always empty by default, and is provided as an argument only for the sake of convenience and optimization. NOTE: Try to only save data that isn't default values. More... | |
virtual bool | TryGetItemGamepadOverrideInstructions (Item[] inv, int context, int slot, out string instruction) |
virtual void | Update () |
Allows logic to execute every game update for this placed Tile Entity. Called on each placed Tile Entity. This hook is not called for multiplayer clients. The ID.MessageID.TileEntitySharing network message will need be used to keep clients in sync if necessary. More... | |
virtual void | WriteExtraData (BinaryWriter writer, bool networkSend) |
virtual bool | IsLoadingEnabled (Mod mod) |
Whether or not this type should be loaded when it's told to. Returning false disables Mod.AddContent from actually loading this type. More... | |
abstract void | Load (Mod mod) |
Called when loading the type. More... | |
abstract void | Unload () |
Called during unloading when needed. More... | |
Additional Inherited Members | |
![]() | |
static ModTileEntity | ConstructFromBase (ModTileEntity tileEntity) |
Returns a new ModTileEntity with the same class, mod, name, and type as the parameter. It is very rare that you should have to use this. | |
static ModTileEntity | ConstructFromType (int type) |
Returns a new ModTileEntity with the same class, mod, name, and type as the ModTileEntity with the given type. It is very rare that you should have to use this. | |
static int | CountInWorld () |
Returns the number of modded tile entities that exist in the world currently being played. | |
![]() | |
static int | AssignNewID () |
static void | BasicOpenCloseInteraction (Player player, int x, int y, int id) |
static void | Clear () |
static void | InitializeAll () |
static bool | IsOccupied (int id, out int interactingPlayer) |
static void | PlaceEntityNet (int x, int y, int type) |
static TileEntity | Read (BinaryReader reader, bool networkSend=false, bool lightSend=false) |
static void | SetInteractionAnchor (Player player, int x, int y, int id) |
static bool | TryGet< T > (int i, int j, out T entity) |
Attempts to retrieve the TileEntity at the given coordinates of the specified Type (T ). Works with any provided coordinate belonging to the multitile. Note that this method assumes the TileEntity is placed in the top left corner of the multitile. More... | |
static bool | TryGet< T > (Point16 point, out T entity) |
static void | UpdateEnd () |
static void | UpdateStart () |
static void | Write (BinaryWriter writer, TileEntity ent, bool networkSend=false, bool lightSend=false) |
![]() | |
int | ID |
A unique ID for each TileEntity instance in the world. This ID is consistent in multiplayer. | |
Point16 | Position |
The tile coordinate location of this TileEntity. Will typically be the top left corner of the corresponding multitile, but not necessarily. | |
byte | type |
![]() | |
static readonly int | NumVanilla |
![]() | |
static Dictionary< int, TileEntity > | ByID = new Dictionary<int, TileEntity>() |
Maps ID to TileEntity instances. | |
static Dictionary< Point16, TileEntity > | ByPosition = new Dictionary<Point16, TileEntity>() |
Maps tile coordinate locations to the TileEntity at that location. | |
static object | EntityCreationLock = new object() |
static TileEntitiesManager | manager |
const int | MaxEntitiesPerChunk = 1000 |
static int | TileEntitiesNextID |
![]() | |
string | FullName [get] |
=> $"{Mod.Name}/{Name}" More... | |
PlacementHook | Generic_HookPostPlaceMyPlayer [get] |
A generic PlacementHook that should work for the TileObjectData.HookPostPlaceMyPlayer of any typical ModTileEntity. Will result in this ModTileEntity being placed in the top left corner of the multitile. | |
Mod | Mod [get, set] |
The mod that added this ModTileEntity. More... | |
virtual string | Name [get] |
The internal name of this ModTileEntity. More... | |
int | Type [get, set] |
The numeric type used to identify this kind of tile entity. | |
![]() | |
string | FullName [get] |
=> $"{Mod.Name}/{Name}" More... | |
Mod | Mod [get] |
The mod this belongs to. More... | |
string | Name [get] |
The internal name of this instance. More... | |
![]() | |
static Action | _UpdateEnd |
static Action | _UpdateStart |
|
virtual |
Whether or not this tile entity is allowed to survive at the given coordinates. You should check whether the tile is active, as well as the tile's type and optionally the frame:
Tile tile = Main.tile[x, y]; return tile.HasTile && tile.TileType == ModContent.TileType<BasicTileEntityTile>();
This will be called during world loading and placing the entity on the server. It will not be automatically called when the host tile is killed, so using ModTile.KillMultiTile to Kill(int, int) this entity is necessary to ensure the tile entity doesn't mistakenly persist without the host tile.
Implements ModTileEntity.
|
virtual |
Allows you to load custom data that you have saved for this tile entity.
Try to write defensive loading code that won't crash if something's missing.
tag | The TagCompound to load data from. |
Reimplemented from TileEntity.
|
virtual |
Allows you to save custom data for this tile entity.
NOTE: The provided tag is always empty by default, and is provided as an argument only for the sake of convenience and optimization.
NOTE: Try to only save data that isn't default values.
tag | The TagCompound to save data into. Note that this is always empty by default, and is provided as an argument only for the sake of convenience and optimization. |
Reimplemented from TileEntity.