-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCustomUtils.cs
35 lines (30 loc) · 903 Bytes
/
CustomUtils.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
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Steamworks;
using Terraria;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
namespace ItemCustomizer
{
public static class CustomUtils
{
// Run this if net mode does NOT match
public static void NetExclude(int mode, Action action) {
if(Main.netMode != mode) action();
}
public static void SafeNameOverride(this Item item, string name) {
if(name != "") item.SetNameOverride(name);
}
public static CustomizerItem Customizer(this Item item) {
return item.GetGlobalItem<CustomizerItem>();
}
public static CustomizerProjInfo Customizer(this Projectile proj) {
return proj.GetGlobalProjectile<CustomizerProjInfo>();
}
public static CustomizerNPCInfo Customizer(this NPC npc) {
return npc.GetGlobalNPC<CustomizerNPCInfo>();
}
}
}