|
TModLoader v1.4.4.9
TModLoader source code documentation
|
|
inlinestatic |
Spawns an item into the game world with the given type and stack size. The X, Y, Width, and Height parameters dictate a rectangle, the item will be spawned centered within that rectangle. Other overloads support passing in a position directly, or just use 0 for Width and Height if the center is passed in a X and Y.
This method should not be called on multiplayer clients. If you need to spawn items from client code, use M:Terraria.Player.QuickSpawnItem(Terraria.DataStructures.IEntitySource,System.Int32,System.Int32) instead, it handles the multiplayer syncing code needed.
See the noBroadcast documentation if you need to customize attached ModItem or GlobalItem data prior to syncing.
The source represents the entity causing this item to spawn. The return value is the index of the spawned Item within the F:Terraria.Main.item array.
| source | |
| X | |
| Y | |
| Width | |
| Height | |
| Type | Either an T:Terraria.ID.ItemID entry or M:Terraria.ModLoader.ModContent.ItemType``1, for example F:Terraria.ID.ItemID.IronskinPotion or ModContent.ItemType<MyModItem>() |
| Stack | Item stack |
| noBroadcast | Controls whether an item spawned on a server is synced using M:Terraria.NetMessage.SendData(System.Int32,System.Int32,System.Int32,Terraria.Localization.NetworkText,System.Int32,System.Single,System.Single,System.Single,System.Int32,System.Int32,System.Int32) and F:Terraria.ID.MessageID.SyncItem. If false, the item will be synced. If true, the calling code can modify the item instance and then sync the item with F:Terraria.ID.MessageID.SyncItem. Has no effect except on server. NewItem running on multiplayer clients always needs to manually sync, see M:Terraria.Player.QuickSpawnItem(Terraria.DataStructures.IEntitySource,System.Int32,System.Int32) source code for an example. |
| pfix | |
| noGrabDelay | |
| reverseLookup |
Definition at line 51517 of file Item.cs.
References Terraria.Item.NewItem_Inner(), and Terraria.Item.noGrabDelay.
Here is the call graph for this function: