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

◆ DropItem()

void Terraria.Player.DropItem ( IEntitySource source,
Vector2 position,
ref Item item )
inline

Drops the ref'd item from the player at the position, and than turns the ref'd Item to air.

Definition at line 58567 of file Player.cs.

58568 {
58569 //IL_000e: Unknown result type (might be due to invalid IL or missing references)
58570 //IL_0015: Unknown result type (might be due to invalid IL or missing references)
58571 if (item.stack > 0)
58572 {
58573 int itemDropId = Item.NewItem(source, (int)position.X, (int)position.Y, width, height, item);
58574 Item obj = Main.item[itemDropId];
58575 obj.velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f;
58576 obj.velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f;
58577 obj.noGrabDelay = 100;
58578 obj.newAndShiny = false;
58579 if (Main.netMode == 1)
58580 {
58581 NetMessage.SendData(21, -1, -1, null, itemDropId);
58582 }
58583 }
58584 item.TurnToAir();
58585 }
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

References Terraria.Entity.height, Terraria.Main.item, Terraria.Main.netMode, Terraria.Item.NewItem(), Terraria.Entity.position, Terraria.Main.rand, Terraria.NetMessage.SendData(), and Terraria.Entity.width.

+ Here is the call graph for this function: