fix: fix issue with orig() call not working by doing it ourselves

This commit is contained in:
Jack Bond-Preston 2022-07-10 01:16:06 +01:00
parent 9c3c2e8ea4
commit 5694035da3
Signed by: jack
GPG Key ID: 010071F1482BA852
5 changed files with 11 additions and 10 deletions

View File

@ -1,24 +1,25 @@
using MagicStorage.Components; using MagicStorage.Components;
using MagicStorageVoidBag.Items; using MagicStorage.Items;
using Terraria; using Terraria;
using Terraria.DataStructures; using Terraria.DataStructures;
using Terraria.Localization; using Terraria.Localization;
using Terraria.ModLoader;
namespace MagicStorageVoidBag.Hooks { namespace MagicStorageVoidBag.Hooks {
internal class StorageHeartRightClickHook { internal class StorageHeartRightClickHook {
private static readonly log4net.ILog Logger = MagicStorageVoidBag.Instance.Logger; private static readonly log4net.ILog Logger = MagicStorageVoidBag.Instance.Logger;
public static bool Hook(On.MagicStorage.Components.StorageHeart.orig_RightClick orig, StorageHeart heart, int i, int j) { public static bool Hook(On.MagicStorage.Components.StorageHeart.orig_RightClick orig, MagicStorage.Components.StorageHeart heart, int i, int j) {
// https://github.com/blushiemagic/MagicStorage/blob/1.4-stable/Components/StorageHeart.cs#L23 // https://github.com/blushiemagic/MagicStorage/blob/1.4-stable/Components/StorageHeart.cs#L23
Player player = Main.LocalPlayer; Player player = Main.LocalPlayer;
Item item = player.HeldItem; Item item = player.HeldItem;
if (item.type == ModContent.ItemType<MSVoidBag>()) {
if (item.ModItem == null) return false;
if (item.ModItem is Locator locator) {
if (Main.tile[i, j].TileFrameX % 36 == 18) i--; if (Main.tile[i, j].TileFrameX % 36 == 18) i--;
if (Main.tile[i, j].TileFrameY % 36 == 18) j--; if (Main.tile[i, j].TileFrameY % 36 == 18) j--;
MSVoidBag bag = (MSVoidBag)item.ModItem; locator.location = new Point16(i, j);
bag.location = new Point16(i, j);
if (player.selectedItem == 58) { if (player.selectedItem == 58) {
Main.mouseItem = item.Clone(); Main.mouseItem = item.Clone();
} }

View File

@ -12,10 +12,10 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="MagicStorage"> <Reference Include="MagicStorage">
<HintPath>../MagicStorage/MagicStorage.dll</HintPath> <HintPath>..\MagicStorage\MagicStorage.dll</HintPath>
</Reference> </Reference>
<Reference Include="MagicStorageHooks"> <Reference Include="MagicStorageHooks">
<HintPath>lib/MagicStorageHooks.dll</HintPath> <HintPath>lib\MagicStorage_Hooks.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,8 +1,8 @@
displayName = MagicStorage Void Bag displayName = MagicStorage Void Bag
author = jack author = jack
version = 1.1 version = 1.2
modReferences = MagicStorage modReferences = MagicStorage
dllReferences = MagicStorageHooks dllReferences = MagicStorage_Hooks
sortAfter = MagicStorage sortAfter = MagicStorage
includeSource = true includeSource = true
homepage = https://github.com/jackbondpreston/MagicStorageVoidBag homepage = https://github.com/jackbondpreston/MagicStorageVoidBag

Binary file not shown.

BIN
lib/MagicStorage_Hooks.dll Normal file

Binary file not shown.