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 MagicStorageVoidBag.Items;
using MagicStorage.Items;
using Terraria;
using Terraria.DataStructures;
using Terraria.Localization;
using Terraria.ModLoader;
namespace MagicStorageVoidBag.Hooks {
internal class StorageHeartRightClickHook {
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
Player player = Main.LocalPlayer;
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].TileFrameY % 36 == 18) j--;
MSVoidBag bag = (MSVoidBag)item.ModItem;
bag.location = new Point16(i, j);
locator.location = new Point16(i, j);
if (player.selectedItem == 58) {
Main.mouseItem = item.Clone();
}

View File

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

View File

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

Binary file not shown.

BIN
lib/MagicStorage_Hooks.dll Normal file

Binary file not shown.