Compare commits

...

30 Commits
v0.3 ... main

Author SHA1 Message Date
a3473a002d
ci: fix ci 2023-08-17 18:16:45 +01:00
48b51324fb
v1.7 for 1.4.4 2023-08-17 17:53:02 +01:00
0c6328b39d
dev: more 1.4.4 fixes, fix CRLF -> LF 2023-08-17 17:44:55 +01:00
278a0d9278
dev: tmodporter changes 2023-08-17 16:37:16 +01:00
d8c4649f92
ci: fix CI again 2023-02-04 13:13:29 +00:00
dd5f7256fc
fix: Use new Locator property 2023-02-04 12:52:55 +00:00
5b1a55973b
Revert "fix: work around magic storage locator sync bug"
This fix is now part of mainline Magic Storage
2023-02-04 12:47:38 +00:00
d3e63ccfcf
ci: try to fix CI 2022-12-03 14:59:08 +00:00
0e4aa1caa5
fix: work around magic storage locator sync bug 2022-11-30 23:50:31 +00:00
87378aeb00
ci: remove broken github-release step 2022-08-14 15:31:04 +01:00
01fb135385
fix: update for new Magic Storage version 2022-08-14 15:23:54 +01:00
28ba14cb94
doc: add license 2022-07-28 18:46:28 +01:00
d001727c2d
fix: storage hearts now work while holding vanilla items 2022-07-10 13:00:02 +01:00
5694035da3
fix: fix issue with orig() call not working by doing it ourselves 2022-07-10 01:31:53 +01:00
9c3c2e8ea4
ci: add github release 2022-07-07 23:27:43 +01:00
5f9037251a
ci: delete .git dir before packaging 2022-07-07 22:55:07 +01:00
b62d537f4e
ci: mostly complete woodpecker CI 2022-07-07 22:51:23 +01:00
02be4b41cc
ci: only run on tags 2022-07-07 22:43:08 +01:00
68033424ec
ci: release things 2022-07-07 22:37:13 +01:00
13e8f9a8b8
ci: build things 2022-07-07 22:35:04 +01:00
ed4ab8f07d
ci: fix some dll references 2022-07-07 17:50:27 +01:00
547993ad50
ci: fetch some deps 2022-07-07 17:47:22 +01:00
d270574e26
ci: fix? 2022-07-07 16:45:32 +01:00
4ab4a8bb38
ci: fix? 2022-07-07 15:18:57 +01:00
3474cbca99
ci: add "when" clauses 2022-07-07 14:43:18 +01:00
b014280413
ci: clone in subdir 2022-07-07 14:34:42 +01:00
09d97d4949
ci: initial woodpecker config 2022-07-07 13:44:56 +01:00
994a5095ca
doc: update descriptions 2022-07-04 16:38:22 +01:00
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
2c54d4575c
doc: update readme 2022-07-03 08:26:53 +01:00
21 changed files with 363 additions and 197 deletions

View File

@ -1,30 +0,0 @@
name: Create Release
on:
push:
tags:
- '*'
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Create changelog text
id: changelog
uses: loopwerk/tag-changelog@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
config_file: .github/workflows/tag_changelog_config.js
- name: Create release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: ${{ steps.changelog.outputs.changes }}

View File

@ -1,15 +0,0 @@
module.exports = {
types: [
{ types: ["feat", "feature"], label: "🎉 New Features" },
{ types: ["fix", "bugfix"], label: "🐛 Bugfixes" },
{ types: ["improvements", "enhancement"], label: "🔨 Improvements" },
{ types: ["perf"], label: "🏎️ Performance Improvements" },
{ types: ["build", "ci"], label: "🏗️ Build System" },
{ types: ["refactor"], label: "🪚 Refactors" },
{ types: ["doc", "docs"], label: "📚 Documentation Changes" },
{ types: ["test", "tests"], label: "🔍 Tests" },
{ types: ["style"], label: "💅 Code Style Changes" },
{ types: ["chore"], label: "🧹 Chores" },
{ types: ["other"], label: "Other Changes" },
],
};

64
.woodpecker.yml Normal file
View File

@ -0,0 +1,64 @@
clone:
git:
image: woodpeckerci/plugin-git:latest
settings:
path: MagicStorageVoidBag
when:
event: tag
pipeline:
fetch-deps:
image: jackbondpreston/msvb-build-env
commands:
- steamcmd "+login anonymous" "+workshop_download_item 1281930 2563309347" "+quit"
- wget https://github.com/tModLoader/tModLoader/releases/latest/download/tModLoader.zip
- unzip -q tModLoader.zip -d tModLoader
- rm tModLoader.zip
- ln -sf $CI_WORKSPACE/tModLoader/Libraries/Native/Linux/libSDL2-2.0.so.0 $CI_WORKSPACE/tModLoader/Libraries/Native/Linux/libSDL2.so
- >
echo "<Project ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">
<Import Project=\"$CI_WORKSPACE/tModLoader/tMLMod.targets\" />
</Project>" > tModLoader.targets
- |
wget https://github.com/steviegt6/tml-patcher/releases/latest/download/TML.Patcher.zip
unzip -q TML.Patcher.zip -d TMLPatcher
- |
rm -f /root/.steam/SteamApps/workshop/content/1281930/2563309347/workshop.json
YEAR=$(ls /root/.steam/SteamApps/workshop/content/1281930/2563309347 | cut -c -4 | sort -nr | head -n 1)
VER=$(find /root/.steam/SteamApps/workshop/content/1281930/2563309347/ -type d -name "$YEAR.*" -printf "%f\n" | cut -c 6- | sort -nr | head -n 1)
cp /root/.steam/SteamApps/workshop/content/1281930/2563309347/$YEAR.$VER/MagicStorage.tmod ./
- dotnet TMLPatcher/TML.Patcher.dll extract MagicStorage.tmod
- cp MagicStorage/MagicStorage.dll $CI_WORKSPACE/
when:
event: tag
build:
image: jackbondpreston/msvb-build-env
commands:
- |
echo "Shell: $SHELL"
echo "CI_WORKSPACE: $CI_WORKSPACE"
- cat tModLoader.targets
- cd $CI_WORKSPACE
- cd MagicStorageVoidBag
- rm -rf .git
- dotnet build -c Release || true
- cp bin/Release/net6.0/MagicStorageVoidBag.dll .
- cd $CI_WORKSPACE
- mkdir release
- cp ~/.local/share/Terraria/tModLoader/Mods/MagicStorageVoidBag.tmod release/
- cp MagicStorageVoidBag/MagicStorageVoidBag.dll release/
- ls release
when:
event: tag
gitea-release:
image: plugins/gitea-release
settings:
api_key:
from_secret: gitea-api-key
base_url: https://git.jackbondpreston.me
files: release/*
when:
event: tag

View File

@ -0,0 +1,62 @@
using MagicStorage;
using MagicStorage.Components;
using MagicStorageVoidBag.Items;
using System.Linq;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.GameContent.Achievements;
using Terraria.ID;
using Terraria.ModLoader;
namespace MagicStorageVoidBag.Hooks {
internal class GetItemVoidVaultHook {
private static readonly log4net.ILog Logger = MagicStorageVoidBag.Instance.Logger;
public static bool Hook(Terraria.On_Player.orig_GetItem_VoidVault orig, Player player, int plr, Item[] inventory, Item newItem, GetItemSettings settings, Item returnItem) {
var i = player.inventory.FirstOrDefault(i => i.type == ModContent.ItemType<MSVoidBag>(), null);
newItem = newItem.Clone();
if (i == null) goto original;
var bag = (MSVoidBag)i.ModItem;
if (bag.Location.X < 0 || bag.Location.Y < 0) goto original;
Tile tile = Main.tile[bag.Location.X, bag.Location.Y];
if (!tile.HasTile || tile.TileType != ModContent.TileType<StorageHeart>() || tile.TileFrameX != 0 || tile.TileFrameY != 0) goto original;
if (!TileEntity.ByPosition.TryGetValue(bag.Location, out TileEntity te)) goto original;
if (te.type != ModContent.TileEntityType<TEStorageHeart>()) goto original;
TEStorageHeart heart = (TEStorageHeart)te;
heart.TryDeposit(returnItem);
heart.ResetCompactStage();
StorageGUI.SetRefresh();
if (returnItem.stack != newItem.stack) {
if (newItem.IsACoin) {
SoundEngine.PlaySound(SoundID.CoinPickup, player.position);
} else {
SoundEngine.PlaySound(SoundID.Grab, player.position);
}
if (!settings.NoText) {
PopupText.NewText(PopupTextContext.ItemPickupToVoidContainer, newItem, returnItem.stack, noStack: false, settings.LongText);
}
AchievementsHelper.NotifyItemPickup(player, returnItem);
}
if (returnItem.stack == 0) return true;
original:
if (player.HasItem(ItemID.VoidLens)) {
return orig(player, plr, inventory, newItem, settings, returnItem);
} else {
return false;
}
}
}
}

View File

@ -0,0 +1,45 @@
using MagicStorage.Components;
using MagicStorageVoidBag.Items;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
using Terraria.DataStructures;
using Terraria.ModLoader;
using MagicStorage;
using Terraria.ID;
namespace MagicStorageVoidBag.Hooks {
internal class ItemSpaceForCofveveHook {
private static readonly log4net.ILog Logger = MagicStorageVoidBag.Instance.Logger;
// Despite the constant negative press cofveve
public static bool Hook(Terraria.On_Player.orig_ItemSpaceForCofveve orig, Player player, Item newItem) {
var i = player.inventory.FirstOrDefault(i => i.type == ModContent.ItemType<MSVoidBag>(), null);
if (i == null) goto original;
newItem = newItem.Clone();
var bag = (MSVoidBag)i.ModItem;
if (bag.Location.X < 0 || bag.Location.Y < 0) goto original;
Tile tile = Main.tile[bag.Location.X, bag.Location.Y];
if (!tile.HasTile || tile.TileType != ModContent.TileType<StorageHeart>() || tile.TileFrameX != 0 || tile.TileFrameY != 0) goto original;
if (!TileEntity.ByPosition.TryGetValue(bag.Location, out TileEntity te)) goto original;
if (te.type != ModContent.TileEntityType<TEStorageHeart>()) goto original;
if (Utility.HeartHasSpaceFor(newItem, (TEStorageHeart)te)) return true;
original:
if (player.HasItem(ItemID.VoidLens)) {
return orig(player, newItem);
} else {
return false;
}
}
}
}

12
ILPatches/ILPatch.cs Normal file
View File

@ -0,0 +1,12 @@
using MonoMod.Cil;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagicStorageVoidBag.ILPatches {
internal interface ILPatch {
public abstract void Patch(ILContext il);
}
}

View File

@ -0,0 +1,47 @@
using MagicStorageVoidBag.Items;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
using Terraria.ModLoader;
namespace MagicStorageVoidBag.ILPatches {
internal class PlayerUpdatePatch : ILPatch {
private static readonly log4net.ILog Logger = MagicStorageVoidBag.Instance.Logger;
public void Patch(ILContext il) {
try {
if (il == null) {
Logger.Error("ILContext null!");
return;
}
Logger.Debug("Patching Terraria.Player.Update IL...");
var c = new ILCursor(il);
var setterMethod = typeof(Player).GetProperty(nameof(Player.IsVoidVaultEnabled)).GetSetMethod();
if (!c.TryGotoNext(i => i.MatchCallOrCallvirt(setterMethod))) {
Logger.Error("Failed to go to next call or callvirt! :(");
return;
}
c.Emit(OpCodes.Ldarg_0);
c.Emit(OpCodes.Ldc_I4, ModContent.ItemType<MSVoidBag>());
var hasItemMethod = typeof(Player).GetMethod(nameof(Player.HasItem), new[] { typeof(int) });
if (hasItemMethod == null) {
Logger.Error("Failed to reflect Player.HasItem(int)! :(");
return;
}
c.Emit(OpCodes.Call, hasItemMethod);
c.Emit(OpCodes.Or);
Logger.Debug("...Complete!");
} catch (Exception e) {
throw new ILPatchFailureException(MagicStorageVoidBag.Instance, il, e);
}
}
}
}

View File

@ -1,38 +0,0 @@
using MagicStorage.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
using Terraria.DataStructures;
using Terraria.Localization;
using Terraria.ModLoader;
namespace MagicStorageVoidBag.Items {
internal class GlobalItem : Terraria.ModLoader.GlobalItem {
public override bool OnPickup(Item item, Player player) {
var i = player.inventory.Where(i => i.type == ModContent.ItemType<MSVoidBag>()).DefaultIfEmpty(null).First();
if (i != null && !player.ItemSpace(item).CanTakeItem) {
var bag = (MSVoidBag)i.ModItem;
if (bag.location.X < 0 || bag.location.Y < 0) return false;
Tile tile = Main.tile[bag.location.X, bag.location.Y];
if (!tile.HasTile || tile.TileType != ModContent.TileType<StorageHeart>() || tile.TileFrameX != 0 || tile.TileFrameY != 0) return false;
if (!TileEntity.ByPosition.TryGetValue(bag.location, out TileEntity te)) return false;
if (te.type != ModContent.TileEntityType<TEStorageHeart>()) return false;
TEStorageHeart heart = (TEStorageHeart)te;
int oldStack = item.stack;
heart.TryDeposit(item);
if (item.stack == 0) return true;
}
return base.OnPickup(item, player);
}
}
}

View File

@ -11,33 +11,6 @@ namespace MagicStorageVoidBag.Items {
[ExtendsFromMod("MagicStorage")]
public class MSVoidBag : PortableAccess {
/*
Code here largely thanks to original MagicStorage source, which can be found at
https://github.com/blushiemagic/MagicStorage/
License:
MIT License
Copyright(c) 2017 Kaylee Minsuh Kim
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
public override void SetStaticDefaults() {
CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1;
}
@ -54,10 +27,10 @@ namespace MagicStorageVoidBag.Items {
}
public override void ModifyTooltips(List<TooltipLine> lines) {
bool isSet = location.X >= 0 && location.Y >= 0;
bool isSet = Location.X >= 0 && Location.Y >= 0;
for (int k = 0; k < lines.Count; k++)
if (isSet && lines[k].Mod == "Terraria" && lines[k].Name == "Tooltip1") {
lines[k].Text = Language.GetTextValue("Mods.MagicStorage.SetTo", location.X, location.Y);
lines[k].Text = Language.GetTextValue("Mods.MagicStorage.SetTo", Location.X, Location.Y);
} else if (!isSet && lines[k].Mod == "Terraria" && lines[k].Name == "Tooltip2") {
lines.RemoveAt(k);
k--;

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Jack Bond-Preston
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,15 +1,17 @@
Mods: {
Mods: {
MagicStorageVoidBag: {
ItemName: {
MSVoidBag: Magic Void Bag
}
ItemTooltip: {
MSVoidBag:
ItemName.MSVoidBag: Magic Void Bag
ItemTooltip.MSVoidBag:
'''
<right> Storage Heart to store location
Currently not set to any location
'''
Items: {
MSVoidBag: {
DisplayName: M S Void Bag
Tooltip: ""
}
}
}
}

23
MagicStorage-LICENSE.txt Normal file
View File

@ -0,0 +1,23 @@
This mod uses various pieces of code from the original MagicStorage mod, the license for which is below:
MIT License
Copyright (c) 2017 Kaylee Minsuh Kim
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,57 +1,29 @@
using Mono.Cecil.Cil;
using Mono.Cecil;
using MonoMod.Cil;
using Terraria.ModLoader;
using MagicStorageVoidBag.Items;
using MagicStorageVoidBag.ILPatches;
using MagicStorageVoidBag.Hooks;
namespace MagicStorageVoidBag {
public class MagicStorageVoidBag : Mod {
public override void Load() {
IL.MagicStorage.Components.StorageHeart.RightClick += HeartRightClickPatch;
public static MagicStorageVoidBag Instance => ModContent.GetInstance<MagicStorageVoidBag>();
// IL Patches
private PlayerUpdatePatch playerUpdatePatch = new();
public override void Load() {
Terraria.IL_Player.Update += playerUpdatePatch.Patch;
Terraria.On_Player.GetItem_VoidVault += GetItemVoidVaultHook.Hook;
Terraria.On_Player.ItemSpaceForCofveve += ItemSpaceForCofveveHook.Hook;
}
public override void Unload() {
Terraria.IL_Player.Update -= playerUpdatePatch.Patch;
Terraria.On_Player.GetItem_VoidVault -= GetItemVoidVaultHook.Hook;
Terraria.On_Player.ItemSpaceForCofveve -= ItemSpaceForCofveveHook.Hook;
base.Unload();
}
// Patch MagicStorage IL to change the Storage Heart right click handler to also work with
// MSVoidBag.
private void HeartRightClickPatch(ILContext il) {
if (il == null) {
Logger.Error("ILContext null!");
return;
}
Logger.Debug("Patching MagicStorage IL...");
var c = new ILCursor(il);
if (!c.TryGotoNext(i => i.MatchCallOrCallvirt("Terraria.ModLoader.ModContent", "ItemType"))) {
Logger.Warn("IL patching failed! :(");
}
c = c.GotoPrev().GotoPrev();
var c2 = c.Clone();
// copy IL up to call
while (c2.Next.OpCode != OpCodes.Call) {
if (c2.Next.Operand != null) {
c.Emit(c2.Next.OpCode, c2.Next.Operand);
} else {
c.Emit(c2.Next.OpCode);
}
c2 = c2.GotoNext();
}
var method = typeof(ModContent).GetMethod("ItemType").MakeGenericMethod(typeof(MSVoidBag));
c.Emit(c2.Next.OpCode, method);
c2.GotoNext();
c.Emit(c2.Next.OpCode, c2.Next.Operand);
Logger.Debug("...MagicStorage IL patching complete!");
}
}
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\tModLoader.targets" />
<Import Project="../tModLoader.targets" />
<PropertyGroup>
<AssemblyName>MagicStorageVoidBag</AssemblyName>
<TargetFramework>net6.0</TargetFramework>
@ -12,10 +12,7 @@
</ItemGroup>
<ItemGroup>
<Reference Include="MagicStorage">
<HintPath>..\Mod Libraries\MagicStorage.dll</HintPath>
</Reference>
<Reference Include="MMHOOK_MagicStorage">
<HintPath>lib\MMHOOK_MagicStorage.dll</HintPath>
<HintPath>..\MagicStorage\MagicStorage.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View File

@ -1,16 +1,16 @@
{
"profiles": {
"Terraria": {
"commandName": "Executable",
"executablePath": "dotnet",
"commandLineArgs": "$(tMLPath)",
"workingDirectory": "$(tMLSteamPath)"
},
"TerrariaServer": {
"commandName": "Executable",
"executablePath": "dotnet",
"commandLineArgs": "$(tMLServerPath)",
"workingDirectory": "$(tMLSteamPath)"
}
}
{
"profiles": {
"Terraria": {
"commandName": "Executable",
"executablePath": "dotnet",
"commandLineArgs": "$(tMLPath)",
"workingDirectory": "$(tMLSteamPath)"
},
"TerrariaServer": {
"commandName": "Executable",
"executablePath": "dotnet",
"commandLineArgs": "$(tMLServerPath)",
"workingDirectory": "$(tMLSteamPath)"
}
}
}

View File

@ -1,7 +1,7 @@
# MagicStorageVoidBag
# MagicStorage Void Bag
A mod that extends [Magic Storage](https://github.com/blushiemagic/MagicStorage).
Adds an upgraded void bag that combines functionality of the Void Bag and Portable Remote Storage Access, by putting items into a magic storage system when your inventory is full (and allowing remote access as usual).
This item is crafted by combining a Void Bag with a Portable Remote Storage Access. To link it with your storage system, right click the Storage Heart with the bag equipped.
This item is crafted by combining a Void Bag with a Portable Remote Storage Access. To link it with your storage system, right click the Storage Heart with the bag equipped.

25
Utility.cs Normal file
View 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;
}
}
}

View File

@ -1,8 +1,7 @@
displayName = MagicStorage Void Bag
author = jack
version = 0.3
modReferences = MagicStorage
dllReferences = MMHOOK_MagicStorage
sortAfter = MagicStorage
includeSource = true
homepage = https://github.com/jackbondpreston/MagicStorageVoidBag
displayName = MagicStorage Void Bag
author = jack
version = 1.7
modReferences = MagicStorage
sortAfter = MagicStorage
includeSource = true
homepage = https://git.jackbondpreston.me/jack/MagicStorageVoidBag

View File

@ -1,2 +1,4 @@
Adds an upgraded void bag that combines functionality of the Void Bag and Portable Remote Storage Access, by putting items into a magic storage system when your inventory is full (and allowing remote access as usual).
This item is crafted by combining a Void Bag with a Portable Remote Storage Access. To link it with your storage system, right click the Storage Heart with the bag equipped.
This item is crafted by combining a Void Bag with a Portable Remote Storage Access. To link it with your storage system, right click the Storage Heart with the bag equipped.
Thanks to the original MagicStorage mod for some code and of course the functionality of the original mod!

View File

@ -1,2 +1,7 @@
Adds an upgraded void bag that combines functionality of the Void Bag and Portable Remote Storage Access, by putting items into a magic storage system when your inventory is full (and allowing remote access as usual).
This item is crafted by combining a Void Bag with a Portable Remote Storage Access. To link it with your storage system, right click the Storage Heart with the bag equipped.
This item is crafted by combining a Void Bag with a Portable Remote Storage Access. To link it with your storage system, right click the Storage Heart with the bag equipped.
GitHub: https://github.com/jackbondpreston/MagicStorageVoidBag
Discord server if you need support/don't want to report bugs on GitHub: https://discord.gg/Z6V77mbtZQ
Thanks to the original MagicStorage mod for some code and of course the functionality of the original mod!

Binary file not shown.