Move FixChestStacks() to utils
This commit is contained in:
parent
9c6c450751
commit
7c47fbb3f2
2 changed files with 20 additions and 20 deletions
|
|
@ -1427,5 +1427,24 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>FixChestStacks - Verifies that each stack in each chest is valid and not over the max stack count.</summary>
|
||||
public void FixChestStacks()
|
||||
{
|
||||
if (TShock.Config.IgnoreChestStacksOnLoad)
|
||||
return;
|
||||
|
||||
foreach (Chest chest in Main.chest)
|
||||
{
|
||||
if (chest != null)
|
||||
{
|
||||
foreach (Item item in chest.item)
|
||||
{
|
||||
if (item != null && item.stack > item.maxStack)
|
||||
item.stack = item.maxStack;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue