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

◆ GrabItems()

void Terraria.Player.GrabItems ( int i)
inlineprivate

Definition at line 33598 of file Player.cs.

33599 {
33600 //IL_0084: Unknown result type (might be due to invalid IL or missing references)
33601 //IL_0089: Unknown result type (might be due to invalid IL or missing references)
33602 //IL_008b: Unknown result type (might be due to invalid IL or missing references)
33603 //IL_0090: Unknown result type (might be due to invalid IL or missing references)
33604 //IL_0094: Unknown result type (might be due to invalid IL or missing references)
33605 //IL_0151: Unknown result type (might be due to invalid IL or missing references)
33606 //IL_0156: Unknown result type (might be due to invalid IL or missing references)
33607 //IL_015a: Unknown result type (might be due to invalid IL or missing references)
33608 for (int j = 0; j < 400; j++)
33609 {
33610 Item item = Main.item[j];
33611 if (!item.active || item.shimmerTime != 0f || item.noGrabDelay != 0 || item.playerIndexTheItemIsReservedFor != i || !CanAcceptItemIntoInventory(item) || (item.shimmered && !((double)((Vector2)(ref item.velocity)).Length() < 0.2)) || !ItemLoader.CanPickup(item, this))
33612 {
33613 continue;
33614 }
33615 int itemGrabRange = GetItemGrabRange(item);
33616 Rectangle hitbox = item.Hitbox;
33617 Rectangle val = base.Hitbox;
33618 if (((Rectangle)(ref val)).Intersects(hitbox))
33619 {
33620 if (i != Main.myPlayer || (inventory[selectedItem].type == 0 && itemAnimation > 0))
33621 {
33622 continue;
33623 }
33624 if (!CombinedHooks.OnPickup(Main.item[j], this))
33625 {
33626 Main.item[j] = new Item();
33627 if (Main.netMode == 1)
33628 {
33629 NetMessage.SendData(21, -1, -1, null, j);
33630 }
33631 }
33632 else
33633 {
33634 item = PickupItem(i, j, item);
33635 }
33636 continue;
33637 }
33638 val = new Rectangle((int)position.X - itemGrabRange, (int)position.Y - itemGrabRange, width + itemGrabRange * 2, height + itemGrabRange * 2);
33639 if (!((Rectangle)(ref val)).Intersects(hitbox))
33640 {
33641 continue;
33642 }
33643 ItemSpaceStatus status = ItemSpace(item);
33644 if (!CanPullItem(item, status))
33645 {
33646 continue;
33647 }
33648 item.shimmered = false;
33649 item.beingGrabbed = true;
33650 bool flag = false;
33652 {
33653 flag = true;
33654 }
33655 if (!ItemLoader.GrabStyle(item, this))
33656 {
33657 if (flag)
33658 {
33659 PullItem_Pickup(item, 7f, 1);
33660 }
33661 else if (manaMagnet && (item.type == 184 || item.type == 1735 || item.type == 1868))
33662 {
33663 PullItem_Pickup(item, 12f, 5);
33664 }
33665 else if (lifeMagnet && (item.type == 58 || item.type == 1734 || item.type == 1867))
33666 {
33667 PullItem_Pickup(item, 15f, 5);
33668 }
33669 else if (ItemID.Sets.NebulaPickup[item.type])
33670 {
33671 PullItem_Pickup(item, 12f, 5);
33672 }
33673 else if (status.ItemIsGoingToVoidVault)
33674 {
33676 }
33677 else if (goldRing && item.IsACoin)
33678 {
33679 PullItem_Pickup(item, 12f, 5);
33680 }
33681 else
33682 {
33683 PullItem_Common(item, 0.75f);
33684 }
33685 }
33686 }
33687 }
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
Vector2 position
The position of this Entity in world coordinates.
Definition Entity.cs:28
int width
The width of this Entity's hitbox, in pixels.
Definition Entity.cs:46
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51
static bool[] NebulaPickup
Do not add items to this set. If true for a given item type (F:Terraria.Item.type),...
Definition ItemID.cs:1380
int type
The Item ID of this item. The Item ID is a unique number assigned to each Item loaded into the game....
Definition Item.cs:345
static bool OnPickup(Item item, Player player)
static bool CanPickup(Item item, Player player)
static bool GrabStyle(Item item, Player player)
Calls all GlobalItem.GrabStyle hooks then ModItem.GrabStyle, until one of them returns true....
This serves as the central class from which item-related functions are carried out....
Definition ItemLoader.cs:26
void PullItem_ToVoidVault(Item itemToPickUp)
Definition Player.cs:33689
bool CanPullItem(Item item, ItemSpaceStatus status)
Definition Player.cs:37955
int GetItemGrabRange(Item item)
Fetches the range at which the given item begins to gravitate towards the player. This range,...
Definition Player.cs:33847
bool CanAcceptItemIntoInventory(Item item)
Definition Player.cs:33589
ItemSpaceStatus ItemSpace(Item newItem)
Definition Player.cs:37964
void PullItem_Pickup(Item itemToPickUp, float speed, int acc)
Definition Player.cs:33742
Item PickupItem(int playerIndex, int worldItemArrayIndex, Item itemToPickUp)
Definition Player.cs:33760
void PullItem_Common(Item itemToPickUp, float xPullSpeed)
Definition Player.cs:33694
Item[] inventory
The player's normal inventory. Indexes 0-9 hold the hotbar items, 10-49 the rest of the main inventor...
Definition Player.cs:1767

References Terraria.Entity.active, Terraria.Player.CanAcceptItemIntoInventory(), Terraria.ModLoader.ItemLoader.CanPickup(), Terraria.Player.CanPullItem(), Terraria.Player.difficulty, Terraria.Player.GetItemGrabRange(), Terraria.Player.goldRing, Terraria.ModLoader.ItemLoader.GrabStyle(), Terraria.Entity.height, Terraria.Entity.Hitbox, Terraria.GameContent.Creative.CreativePowerManager.Instance, Terraria.Player.inventory, Terraria.Item.IsACoin, Terraria.GameContent.Creative.CreativePowers.APerPlayerTogglePower.IsEnabledForPlayer(), Terraria.Main.item, Terraria.Player.itemAnimation, Terraria.Player.ItemSpaceStatus.ItemIsGoingToVoidVault, Terraria.Player.ItemSpace(), Terraria.Player.lifeMagnet, Terraria.Player.manaMagnet, Terraria.Main.myPlayer, Terraria.ID.ItemID.Sets.NebulaPickup, Terraria.Main.netMode, Terraria.Item.noGrabDelay, Terraria.ModLoader.CombinedHooks.OnPickup(), Terraria.Player.PickupItem(), Terraria.Item.playerIndexTheItemIsReservedFor, Terraria.Entity.position, Terraria.Player.PullItem_Common(), Terraria.Player.PullItem_Pickup(), Terraria.Player.PullItem_ToVoidVault(), Terraria.Player.selectedItem, Terraria.NetMessage.SendData(), Terraria.Item.shimmered, Terraria.Item.shimmerTime, Terraria.Item.type, Terraria.Entity.velocity, Terraria.Entity.whoAmI, and Terraria.Entity.width.

Referenced by Terraria.Player.Update().

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