@@ -28,6 +28,7 @@ internal class HEROsMod : Mod
2828 {
2929 public static HEROsMod instance ;
3030 internal static Dictionary < string , ModTranslation > translations ; // reference to private field.
31+ internal List < UIKit . UIComponents . ModCategory > modCategories ;
3132 internal Dictionary < string , Action < bool > > crossModGroupUpdated = new Dictionary < string , Action < bool > > ( ) ;
3233
3334 public override void Load ( )
@@ -40,6 +41,8 @@ public override void Load()
4041 translations = ( Dictionary < string , ModTranslation > ) translationsField . GetValue ( null ) ;
4142 //LoadTranslations();
4243
44+ modCategories = new List < UIKit . UIComponents . ModCategory > ( ) ;
45+
4346 // AddGlobalItem("HEROsModGlobalItem", new HEROsModGlobalItem());
4447 // AddPlayer("HEROsModModPlayer", new HEROsModModPlayer());
4548 //if (ModUtils.NetworkMode != NetworkMode.Server)
@@ -125,6 +128,7 @@ public override void Unload()
125128 ServiceController = null ;
126129 TimeWeatherControlHotbar . Unload ( ) ;
127130 ModUtils . previousInventoryItems = null ;
131+ modCategories = null ;
128132 translations = null ;
129133 instance = null ;
130134 NetTextModule . DeserializeAsServer -= NetTextModule_DeserializeAsServer ;
@@ -300,6 +304,16 @@ args[3] as Action<bool>
300304 ) ;
301305 ModUtils . DebugText ( "...Permission Added" ) ;
302306 }
307+ else if ( message == "AddItemCategory" )
308+ {
309+ ModUtils . DebugText ( "Item Category Adding..." ) ;
310+ string sortName = args [ 1 ] as string ;
311+ string parentName = args [ 2 ] as string ;
312+ Predicate < Item > belongs = args [ 3 ] as Predicate < Item > ;
313+ if ( ! Main . dedServ )
314+ modCategories . Add ( new UIKit . UIComponents . ModCategory ( sortName , parentName , belongs ) ) ;
315+ ModUtils . DebugText ( "...Item Category Added" ) ;
316+ }
303317 else if ( message == "HasPermission" )
304318 {
305319 if ( /*Main.netMode != Terraria.ID.NetmodeID.Server ||*/ argsLength != 3 ) // for now, only allow this call on Server (2) --> why??
0 commit comments