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

◆ QuickSpawnItem() [1/2]

int Terraria.Player.QuickSpawnItem ( IEntitySource source,
int item,
int stack = 1 )
inline

Spawns an item into the world at this players position. This is a simpler alternative to M:Terraria.Item.NewItem(Terraria.DataStructures.IEntitySource,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Boolean,System.Int32,System.Boolean,System.Boolean). This method can be called from multiplayer client code without necessitating manually syncing the item.
Use M:Terraria.Player.QuickSpawnItem(Terraria.DataStructures.IEntitySource,Terraria.Item,System.Int32) if a specific instance of an Item needs to be spawned into the world to preserve modded data.

Parameters
source
item
stack
Returns
The index of the item within F:Terraria.Main.item

Definition at line 7384 of file Player.cs.

7385 {
7386 int number = Item.NewItem(source, (int)position.X, (int)position.Y, width, height, item, stack, noBroadcast: false, -1);
7387 if (Main.netMode == 1)
7388 {
7389 NetMessage.SendData(21, -1, -1, null, number, 1f);
7390 }
7391 return number;
7392 }
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.netMode, Terraria.Item.NewItem(), Terraria.Entity.position, Terraria.NetMessage.SendData(), and Terraria.Entity.width.

Referenced by Terraria.Player.ItemCheck_UseMinecartPowerUp(), Terraria.Player.QuickSpawnItemDirect(), Terraria.Player.TryGettingDevArmor(), and Terraria.ModLoader.Default.ModLoaderMod.TryGettingPatreonOrDevArmor().

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