Move FixChestStacks() to utils

This commit is contained in:
Lucas Nicodemus 2017-12-04 21:45:25 -07:00
parent 9c6c450751
commit 7c47fbb3f2
2 changed files with 20 additions and 20 deletions

View file

@ -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;
}
}
}
}
}
}