Replaced a while(true);

This commit is contained in:
霧雨烨 2024-06-16 17:22:43 +08:00
parent 2d3fa08d0d
commit 2484bff229

View File

@ -67,16 +67,16 @@ public class UniversalItemContainer : IItemContainer
public bool AddItemStack(IItemStack itemStack) public bool AddItemStack(IItemStack itemStack)
{ {
while (true) ItemSlotNode? itemSlotNode = Match(itemStack);
while (itemSlotNode is not null)
{ {
var itemSlotNode = Match(itemStack);
if (itemSlotNode == null)
return false;
if (itemSlotNode.AddItemStack(itemStack)) if (itemSlotNode.AddItemStack(itemStack))
return true; return true;
itemSlotNode = Match(itemStack);
} }
return false;
} }
public int GetSelectIndex() public int GetSelectIndex()