TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ TryOpenContainer()

static void Terraria.UI.ItemSlot.TryOpenContainer ( Item item,
Player player )
inlinestaticprivate

Definition at line 1502 of file ItemSlot.cs.

1503 {
1504 if (ItemID.Sets.BossBag[item.type])
1505 {
1506 player.OpenBossBag(item.type);
1507 }
1508 else if (ItemID.Sets.IsFishingCrate[item.type])
1509 {
1510 player.OpenFishingCrate(item.type);
1511 }
1512 else if (item.type == 3093)
1513 {
1514 player.OpenHerbBag(3093);
1515 }
1516 else if (item.type == 4345)
1517 {
1518 player.OpenCanofWorms(item.type);
1519 }
1520 else if (item.type == 4410)
1521 {
1522 player.OpenOyster(item.type);
1523 }
1524 else if (item.type == 1774)
1525 {
1526 player.OpenGoodieBag(1774);
1527 }
1528 else if (item.type == 3085)
1529 {
1530 if (!player.ConsumeItem(327, reverseOrder: false, includeVoidBag: true))
1531 {
1532 return;
1533 }
1534 player.OpenLockBox(3085);
1535 }
1536 else if (item.type == 4879)
1537 {
1538 if (!player.HasItemInInventoryOrOpenVoidBag(329))
1539 {
1540 return;
1541 }
1542 player.OpenShadowLockbox(4879);
1543 }
1544 else if (item.type == 1869)
1545 {
1546 player.OpenPresent(1869);
1547 }
1548 else if (item.type == 599 && item.type == 600 && item.type == 601)
1549 {
1550 player.OpenLegacyPresent(item.type);
1551 }
1552 else
1553 {
1554 player.DropFromItem(item.type);
1555 }
1556 ItemLoader.RightClickCallHooks(item, player);
1557 if (ItemLoader.ConsumeItem(item, player))
1558 {
1559 item.stack--;
1560 }
1561 if (item.stack == 0)
1562 {
1563 item.SetDefaults();
1564 }
1566 Main.stackSplit = 30;
1567 Main.mouseRightRelease = false;
1568 Recipe.FindRecipes();
1569 }
static SlotId PlaySound(in SoundStyle? style, Vector2? position=null, SoundUpdateCallback? updateCallback=null)
Attempts to play a sound style with the provided sound style (if it's not null), and returns a valid ...
static bool[] BossBag
Set for all boss bags. Causes bags to drop dev armor and creates a glow around the item when dropped ...
Definition ItemID.cs:1565
static bool[] IsFishingCrate
Only checked for vanilla IDs, but encouraged to set it on your modded crates for potential cross-mod ...
Definition ItemID.cs:1288
static void RightClickCallHooks(Item item, Player player)
static bool ConsumeItem(Item item, Player player)
If ModItem.ConsumeItem or any of the GlobalItem.ConsumeItem hooks returns false, sets consume to fals...
This serves as the central class from which item-related functions are carried out....
Definition ItemLoader.cs:26

References Terraria.ID.ItemID.Sets.BossBag, Terraria.Player.ConsumeItem(), Terraria.ModLoader.ItemLoader.ConsumeItem(), Terraria.Player.DropFromItem(), Terraria.Recipe.FindRecipes(), Terraria.Player.HasItemInInventoryOrOpenVoidBag(), Terraria.ID.ItemID.Sets.IsFishingCrate, Terraria.Player.OpenBossBag(), Terraria.Player.OpenCanofWorms(), Terraria.Player.OpenFishingCrate(), Terraria.Player.OpenGoodieBag(), Terraria.Player.OpenHerbBag(), Terraria.Player.OpenLegacyPresent(), Terraria.Player.OpenLockBox(), Terraria.Player.OpenOyster(), Terraria.Player.OpenPresent(), Terraria.Player.OpenShadowLockbox(), Terraria.Audio.SoundEngine.PlaySound(), Terraria.ModLoader.ItemLoader.RightClickCallHooks(), Terraria.Item.SetDefaults(), Terraria.Item.stack, and Terraria.Item.type.

Referenced by Terraria.UI.ItemSlot.RightClick().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: