diff --git a/TShockAPI/NetItem.cs b/TShockAPI/NetItem.cs index 03596a1f..095d3f1c 100644 --- a/TShockAPI/NetItem.cs +++ b/TShockAPI/NetItem.cs @@ -162,6 +162,24 @@ namespace TShockAPI _prefixId = prefixId; } + /// + /// Creates based on data from this structure. + /// + /// A copy of the item. + /// If the item ID is 0. + public Item Build() + { + if (_netId == 0) + throw new Exception("It is impossible to create an item whose ID is 0."); + Item item = new Item(); + + item.netDefaults(_netId); + item.stack = _stack; + item.prefix = _prefixId; + + return item; + } + /// /// Converts the to a string. ///