dev: more 1.4.4 fixes, fix CRLF -> LF
This commit is contained in:
parent
278a0d9278
commit
0c6328b39d
@ -33,7 +33,7 @@ namespace MagicStorageVoidBag.Hooks {
|
|||||||
|
|
||||||
heart.TryDeposit(returnItem);
|
heart.TryDeposit(returnItem);
|
||||||
heart.ResetCompactStage();
|
heart.ResetCompactStage();
|
||||||
StorageGUI.needRefresh = true;
|
StorageGUI.SetRefresh();
|
||||||
|
|
||||||
if (returnItem.stack != newItem.stack) {
|
if (returnItem.stack != newItem.stack) {
|
||||||
if (newItem.IsACoin) {
|
if (newItem.IsACoin) {
|
||||||
|
@ -13,27 +13,35 @@ namespace MagicStorageVoidBag.ILPatches {
|
|||||||
internal class PlayerUpdatePatch : ILPatch {
|
internal class PlayerUpdatePatch : ILPatch {
|
||||||
private static readonly log4net.ILog Logger = MagicStorageVoidBag.Instance.Logger;
|
private static readonly log4net.ILog Logger = MagicStorageVoidBag.Instance.Logger;
|
||||||
public void Patch(ILContext il) {
|
public void Patch(ILContext il) {
|
||||||
if (il == null) {
|
try {
|
||||||
Logger.Error("ILContext null!");
|
if (il == null) {
|
||||||
return;
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
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.Warn("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));
|
|
||||||
c.Emit(OpCodes.Call, hasItemMethod);
|
|
||||||
c.Emit(OpCodes.Or);
|
|
||||||
|
|
||||||
Logger.Debug("...Complete!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
Mods: {
|
Mods: {
|
||||||
MagicStorageVoidBag: {
|
MagicStorageVoidBag: {
|
||||||
ItemName: {
|
ItemName.MSVoidBag: Magic Void Bag
|
||||||
MSVoidBag: Magic Void Bag
|
ItemTooltip.MSVoidBag:
|
||||||
}
|
|
||||||
ItemTooltip: {
|
|
||||||
MSVoidBag:
|
|
||||||
'''
|
'''
|
||||||
<right> Storage Heart to store location
|
<right> Storage Heart to store location
|
||||||
Currently not set to any location
|
Currently not set to any location
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
Items: {
|
||||||
|
MSVoidBag: {
|
||||||
|
DisplayName: M S Void Bag
|
||||||
|
Tooltip: ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user