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

Represents a non-T:Terraria.Player inventory, such as chests, portable storage, or NPC shops. More...

+ Inheritance diagram for Terraria.Chest:
+ Collaboration diagram for Terraria.Chest:

Public Member Functions

 Chest (bool bank=false)
 Create a new T:Terraria.Chest with no name.
 
override string ToString ()
 
object Clone ()
 
int AddItemToShop (Item newItem)
 Adds an item to the first empty slot in this shop.
 
void SetupShop (int type)
 
void SetupShop (string shopName, NPC npc)
 
void FixLoadedData ()
 Calls M:Terraria.Item.FixAgainstExploit on all of this chest's items.
 

Static Public Member Functions

static void Initialize ()
 
static List< int > GetCurrentlyOpenChests ()
 Gets a list of currently-open chests in the world.
Never called on F:Terraria.ID.NetmodeID.MultiplayerClient.
 
static bool IsLocked (int x, int y)
 Determines if the chest at F:Terraria.Main.tile[x , y ] is locked.
 
static bool IsLocked (int x, int y, Tile t)
 
static void ServerPlaceItem (int plr, int slot)
 Attempts to move the item in plr 's inventory or Void Vault into nearby chests.
Only called on F:Terraria.ID.NetmodeID.Server.
 
static Item PutItemInNearbyChest (Item item, Vector2 position)
 Attempts to move the given item into any chests near the given position. Cannot place items into a chest if M:Terraria.Chest.IsPlayerInChest(System.Int32) or if that chest M:Terraria.Chest.IsLocked(System.Int32,System.Int32)
 
static void VisualizeChestTransfer (Vector2 position, Vector2 chestPosition, Item item, int amountMoved)
 Visually moves item from position to chestPosition .
If called on F:Terraria.ID.NetmodeID.MultiplayerClient, sync the transfer to all clients.
 
static void VisualizeChestTransfer_CoinsBatch (Vector2 position, Vector2 chestPosition, long coinsMoved)
 Visually moves coinsMoved worth of coins from position to chestPosition .
If called on F:Terraria.ID.NetmodeID.MultiplayerClient, sync the transfer to all clients.
 
static bool Unlock (int X, int Y)
 Unlocks a locked chest.
 
static bool Lock (int X, int Y)
 Locks an unlocked chest.
 
static int UsingChest (int i)
 Gets the T:Terraria.Player currently using the given chest, if any.
 
static int FindChest (int X, int Y)
 Tries to find a T:Terraria.Chest located at (X , Y ) (tile coordinates).
 
static int FindChestByGuessing (int X, int Y)
 Tries to find the T:Terraria.Chest associated with the tile at (X , Y ) (tile coordinates).
 
static int FindEmptyChest (int x, int y, int type=21, int style=0, int direction=1, int alternate=0)
 Determines if a new chest can exist at tile coordinates (x , y ).
 
static bool NearOtherChests (int x, int y)
 Determines if there are any chests near the tile coordinates (x , y ).
 
static int AfterPlacement_Hook (int x, int y, int type=21, int style=0, int direction=1, int alternate=0)
 Registers a placed chest into the world.
 
static int CreateChest (int X, int Y, int id=-1)
 Creates and registers a new chest into the world.
 
static bool CanDestroyChest (int X, int Y)
 Determines if the chest at (X , Y ) can be destroyed.
 
static bool DestroyChest (int X, int Y)
 Attempts to destroy the chest at (X , Y ).
 
static void DestroyChestDirect (int X, int Y, int id)
 Forcibly destroys the chest at (X , Y ) with ID id if it exists.
Warning: This will destroy any items contained within the chest.
 
static void SetupTravelShop_AddToShop (int it, ref int added, ref int count)
 
static bool SetupTravelShop_CanAddItemToShop (int it)
 
static void SetupTravelShop_GetPainting (Player playerWithHighestLuck, int[] rarity, ref int it, int minimumRarity=0)
 
static void SetupTravelShop_AdjustSlotRarities (int slotItemAttempts, ref int[] rarity)
 
static void SetupTravelShop_GetItem (Player playerWithHighestLuck, int[] rarity, ref int it, int minimumRarity=0)
 
static void SetupTravelShop ()
 Sets up the F:Terraria.ID.NPCID.TravellingMerchant's shop.
 
static void AskForChestToEatItem (Vector2 worldPosition, int duration)
 Visually opens the chest at worldPosition for duration ticks.
 
static void UpdateChestFrames ()
 Visually updates all chests' frames.
Chests that are being used (M:Terraria.Chest.GetCurrentlyOpenChests) or eating an item (F:Terraria.Chest.eatingAnimationTime) will not be opened.
 

Public Attributes

Item[] item
 The items this chest contains.
F:Terraria.Chest.maxItems elements long.
 
int x
 The x-coordinate of this chest in the world, in tile coordinates. (Top left corner tile)
 
int y
 The y-coordinate of this chest in the world, in tile coordinates. (Top left corner tile)
 
bool bankChest
 Unused.
If true, this chest is a portable storage (such as F:Terraria.ID.ItemID.PiggyBank) linked to a player.
 
string name
 The player-assigned name of this chest. May not exceed F:Terraria.Chest.MaxNameLength characters in length.
 
int frameCounter
 The number of ticks this chest has been on its current F:Terraria.Chest.frame value.
 
int frame
 The current frame of this chest's animation.
 
int eatingAnimationTime
 The duration of this chest's eating animation in ticks.
The eating animation plays when an item is quick-stacked into this chest.
 

Static Public Attributes

const float chestStackRange = 600f
 The maximum distance, in world coordinates, that a player can quick-stack items into chests.
 
const int maxChestTypes = 52
 The number of vanilla chest styles contained in F:Terraria.ID.TileID.Containers.
 
static int[] chestTypeToIcon = new int[52]
 Associates a F:Terraria.ID.TileID.Containers style with the item type (F:Terraria.Item.type) that is shown when the chest is moused over. Differs from F:Terraria.Chest.chestItemSpawn to show key items for locked chest styles.
F:Terraria.Chest.maxChestTypes elements long.
 
static int[] chestItemSpawn = new int[52]
 Associates a F:Terraria.ID.TileID.Containers style with the item type (F:Terraria.Item.type) that is dropped when the chest is destroyed.
F:Terraria.Chest.maxChestTypes elements long.
 
const int maxChestTypes2 = 17
 The number of vanilla chest styles contained in F:Terraria.ID.TileID.Containers2.
 
static int[] chestTypeToIcon2 = new int[17]
 Associates a F:Terraria.ID.TileID.Containers2 style with the item type (F:Terraria.Item.type) that is shown when the chest is moused over.
F:Terraria.Chest.maxChestTypes2 elements long. Differs from F:Terraria.Chest.chestItemSpawn2 to show key items for locked chest styles.
 
static int[] chestItemSpawn2 = new int[17]
 Associates a F:Terraria.ID.TileID.Containers2 style with the item type (F:Terraria.Item.type) that is dropped when the chest is destroyed.
F:Terraria.Chest.maxChestTypes2 elements long.
 
const int maxDresserTypes = 43
 The number of vanilla dresser styles contained in F:Terraria.ID.TileID.Dressers.
 
static int[] dresserTypeToIcon = new int[43]
 Associates a F:Terraria.ID.TileID.Dressers style with the item type (F:Terraria.Item.type) that is shown when the dresser is moused over.
F:Terraria.Chest.maxDresserTypes elements long.
 
static int[] dresserItemSpawn = new int[43]
 Associates a F:Terraria.ID.TileID.Dressers style with the item type (F:Terraria.Item.type) that is dropped when the dresser is destroyed.
F:Terraria.Chest.maxDresserTypes elements long.
 
const int maxItems = 40
 The maximum number of items chests can contain.
 
const int MaxNameLength = 20
 The maximum length that F:Terraria.Chest.name is allowed to be.
 

Package Functions

void VanillaSetupShop (int type)
 

Static Package Functions

static bool BestiaryGirl_IsFairyTorchAvailable ()
 

Static Private Member Functions

static bool IsPlayerInChest (int i)
 
static bool DidDiscoverBestiaryEntry (int npcId)
 

Static Private Attributes

static HashSet< int > _chestInUse = new HashSet<int>()
 

Detailed Description

Represents a non-T:Terraria.Player inventory, such as chests, portable storage, or NPC shops.

Definition at line 21 of file Chest.cs.


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