TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ ReceiveExtraAI()

static void Terraria.ModLoader.ProjectileLoader.ReceiveExtraAI ( Projectile projectile,
byte[] extraAI )
inlinestatic

Definition at line 334 of file ProjectileLoader.cs.

335 {
336 using MemoryStream stream = extraAI.ToMemoryStream();
337 using BinaryReader modReader = new BinaryReader(stream);
338 projectile.ModProjectile?.ReceiveExtraAI(modReader);
340 bool anyGlobals = false;
342 try
343 {
344 entityGlobalsEnumerator = HookReceiveExtraAI.Enumerate(projectile);
346 while (enumerator.MoveNext())
347 {
348 enumerator.Current.ReceiveExtraAI(projectile, bitReader, modReader);
349 }
350 if (bitReader.BitsRead < bitReader.MaxBits)
351 {
352 throw new IOException($"Read underflow {bitReader.MaxBits - bitReader.BitsRead} of {bitReader.MaxBits} compressed bits in ReceiveExtraAI, more info below");
353 }
354 if (stream.Position < stream.Length)
355 {
356 throw new IOException($"Read underflow {stream.Length - stream.Position} of {stream.Length} bytes in ReceiveExtraAI, more info below");
357 }
358 }
359 catch (IOException)
360 {
361 string message = "Error in ReceiveExtraAI for Projectile " + (projectile.ModProjectile?.FullName ?? projectile.Name);
362 if (anyGlobals)
363 {
364 message += ", may be caused by one of these GlobalNPCs:";
365 entityGlobalsEnumerator = HookReceiveExtraAI.Enumerate(projectile);
367 while (enumerator.MoveNext())
368 {
369 GlobalProjectile g = enumerator.Current;
370 message = message + "\n\t" + g.FullName;
371 }
372 }
373 }
374 }
static GlobalHookList< GlobalProjectile > HookReceiveExtraAI

References Terraria.ModLoader.ProjectileLoader.HookReceiveExtraAI, Terraria.Projectile.ModProjectile, and Terraria.Projectile.Name.

Referenced by Terraria.MessageBuffer.GetData().

+ Here is the caller graph for this function: