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
This commit is contained in:
25
Utility.cs
Normal file
25
Utility.cs
Normal file
@ -0,0 +1,25 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user