The information in this article is for Terraria v1.0.6.1. |
The chest class is responsible for handling all the chests in the game. Their contents are stored in an Item[] array, and there are a number of functions to deal with them. Interestingly, vendor inventories are considered chests, so this class also handles transactions as well. | |||
|
Properties[]
Name | Type | Description |
---|---|---|
item | Item[] |
An array of Item instances that fuctions as the contents of the chest.
|
x | int | The x-coordinate of the chest in the world. |
y | int | The y-coordinate of the chest in the world. |
Static Properties[]
Name | Type | Description |
---|---|---|
maxItems | int |
The maximum number of items all chests may hold. As this affects every chest in a profound way, changing it may produce unexpected behavior!
|
Methods[]
Method Name | Description |
---|---|
AddShop() |
public void AddShop(Item newItem) { } Adds newItem to the chest's item array. This is typically invoked when you sell an item to a store.
|
Clone() |
public object Clone() { } Returns a copy of the instance. This allows you to make changes to the object's data without affecting the original.
|
SetupShop() |
public void SetupShop(int type) { } Pre-populates the chest with buyable items. The items that appear depend on the type provided.
|
Static Methods[]
Method Name | Description |
---|---|
CreateChest() |
public static int CreateChest(int X, int Y) { } Creates a chest at the given location, and returns the chest's index value in the Main.chest[] array.
|
DestroyChest() |
public static bool DestroyChest(int X, int Y) { } Removes the chest at the given location.
|
FindChest() |
public static int FindChest(int X, int Y) { } Returns the index of Main.chest[] for the chest at the given location.
|
Unlock() |
public static void Unlock(int X, int Y) { } Unlocks the chest at the given location. Does not check the inventory for keys, so if you have any conditional statements, you should check them before calling this method.
|
UsingChest() |
public static int UsingChest(int i) { } When supplied with an index for Main.chest[], this method returns the whoAmI of the player currently using that chest.
|
Notes[]
None yet
Classes in Terraria |
---|
Chest | Cloud | Collision | Dust | Gore | Item | Lighting | Liquid | Main | NPC | Player | Projectile | Recipe | Sign | Star | WorldGen |