MagicStorageVoidBag/Utility.cs
Jack Bond-Preston ff2bf51bc0
fix: hook vanilla void bag logic to fix various issues
- rewrite most logic
- remove GlobalItem
- use a hook for changing StorageHeart.RightClick instead of manual IL edit
2022-07-04 12:01:09 +01:00

26 lines
743 B
C#

using MagicStorage;
using MagicStorage.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
namespace MagicStorageVoidBag {
internal static class Utility {
internal static bool HeartHasSpaceFor(Item newItem, TEStorageHeart heart) {
foreach (TEAbstractStorageUnit storageUnit in heart.GetStorageUnits()) {
if (!storageUnit.Inactive) {
var unitItems = storageUnit.GetItems();
if (!storageUnit.IsFull) return true;
if (storageUnit.HasSpaceInStackFor(newItem)) return true;
}
}
return false;
}
}
}