VVV101 / AlchemistNPCLite

Lite version of AlchemistNPC mod
7 stars 9 forks source link

Remove Obsolete Census Support #35

Open Rijam opened 1 month ago

Rijam commented 1 month ago

As of 1.4.4, Mod Calls to Census are no longer necessary. Instead, Census will automatically get the spawn condition for the Town NPC by a localization key.

Including the old Mod Calls to Census will produce a warning and error in the client.log for each call.

[23:01:47.925] [.NET TP Worker/WARN] [tML]: Silently Caught Exception: 
System.Exception: Call Error: The 2nd parameter of TownNPCCondition is now LocalizedText and is optional. Also, localization is now automatic, keys will appear in your hjson files. This TownNPCCondition Mod.Call is only needed if using LocalizedText.WithFormatArgs
   at Census.CensusSystem.Call(Object[] args) in CensusSystem.cs:line 520
   at AlchemistNPCLite.AlchemistNPCLite.PostSetupContent() in AlchemistNPCLite.cs:line 76
   at Terraria.ModLoader.ModContent.<>c.<Load>b__44_2(Mod mod) in tModLoader\Terraria\ModLoader\ModContent.cs:line 333
   at Terraria.ModLoader.ModContent.LoadModContent(CancellationToken token, Action`1 loadAction) in tModLoader\Terraria\ModLoader\ModContent.cs:line 408
   at Terraria.ModLoader.ModContent.Load(CancellationToken token) in tModLoader\Terraria\ModLoader\ModContent.cs:line 332
   at Terraria.ModLoader.ModLoader.Load(CancellationToken token) in tModLoader\Terraria\ModLoader\ModLoader.cs:line 131
   at Terraria.ModLoader.ModLoader.<>c__DisplayClass46_0.<BeginLoad>b__0() in tModLoader\Terraria\ModLoader\ModLoader.cs:line 109
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()

[23:01:47.936] [.NET TP Worker/ERROR] [Census]: Census Call Error:    at Census.CensusSystem.Call(Object[] args) in CensusSystem.cs:line 520Call Error: The 2nd parameter of TownNPCCondition is now LocalizedText and is optional. Also, localization is now automatic, keys will appear in your hjson files. This TownNPCCondition Mod.Call is only needed if using LocalizedText.WithFormatArgs

The localization keys for Census are already included in this mod https://github.com/VVV101/AlchemistNPCLite/blob/0dc12155ecd2bddb2ed330e1f92845b0d2c32055/Localization/en-US.hjson#L793 So, all that needs to be done is to remove the Mod Calls from PostSetupContent https://github.com/VVV101/AlchemistNPCLite/blob/0dc12155ecd2bddb2ed330e1f92845b0d2c32055/AlchemistNPCLite.cs#L71

(Double check that the spawn conditions in the localization are up to date, because I noticed some of them differ from what's written in the mod calls.)

VVV101 commented 1 month ago

OK, will recheck that. Thanks!