-
Notifications
You must be signed in to change notification settings - Fork 101
/
MagicKeys.cs
45 lines (35 loc) · 1.05 KB
/
MagicKeys.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using MagicStorage.Common.Global;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using System.Linq;
using Terraria;
using Terraria.GameInput;
using Terraria.ModLoader;
namespace MagicStorage {
internal class MagicKeys : ModPlayer {
public static ModKeybind PrintBase64Data;
public override void Load() {
if (Main.dedServ)
return;
PrintBase64Data = KeybindLoader.RegisterKeybind(Mod, "PrintItemData", Keys.I);
}
public override void ProcessTriggers(TriggersSet triggersSet) {
if (!MagicStorageConfig.ItemDataDebug)
return;
if (Main.HoverItem?.IsAir ?? true)
return;
if (!GUITooltips.CanAddTooltips())
return;
if (PrintBase64Data.JustPressed) {
Item item = Main.HoverItem;
var sources = GUITooltips.Sources(item);
string sourceText = sources.Any()
? string.Join('\n', sources.Select(t => t.Item1 + "\n " + t.Item2))
: "None";
Main.NewTextMultiline($"TagCompound data for item \"{Lang.GetItemNameValue(item.type)}\":\n"
+ sourceText,
c: Color.Orange);
}
}
}
}