Updated the PlayerData.StoreSlot method
Removed the ability to call a method when a slot less than 0 is specified. Added an overload that takes `NetItem` in parameters.
This commit is contained in:
parent
2e8823434c
commit
763519150a
1 changed files with 12 additions and 2 deletions
|
|
@ -96,12 +96,22 @@ namespace TShockAPI
|
||||||
/// <param name="stack"></param>
|
/// <param name="stack"></param>
|
||||||
public void StoreSlot(int slot, int netID, byte prefix, int stack)
|
public void StoreSlot(int slot, int netID, byte prefix, int stack)
|
||||||
{
|
{
|
||||||
if (slot > (this.inventory.Length - 1)) //if the slot is out of range then dont save
|
StoreSlot(slot, new NetItem(netID, stack, prefix));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stores an item at the specific storage slot
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="slot"></param>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
public void StoreSlot(int slot, NetItem item)
|
||||||
|
{
|
||||||
|
if (slot > (this.inventory.Length - 1) || slot < 0) //if the slot is out of range then dont save
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.inventory[slot] = new NetItem(netID, stack, prefix);
|
this.inventory[slot] = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue