The Twilight Forest

The Twilight Forest

143M Downloads

Crash when Naga Spawned w/ Dynamic Stealth

WenXin20 opened this issue ยท 10 comments

commented

Forge version: 14.23.5.2838
Twilight Forest version: 3.9.984
Link to crash log: https://gist.github.com/WenXin20/0e4c96d48529e8042a00b5716cbcf133

Steps to reproduce:

  1. Enter the Naga Arena
  2. Wait for it to spawn
  3. Immediately crash

What I expected to happen:

  • I expected the Naga to spawn in unhindered.

What happened instead:

  • The game crashed as soon as the Naga tried to spawn in.
  • No entity was visible yet when the game crashed.
  • I was standing close to the center of the arena.
  • This means I cannot progress through the mod w/o commands.
commented

Did a test, and giving the naga natural soul sight will prevent the crash (by bypassing DS sight algorithms, basically, so if you're in the arena, it DOES see you, even if you're behind something).

It won't leave the arena or anything.

It's not an actual fix technically, but it's viable workaround, and might be desired behavior depending on the user.

Going to close the corresponding issue in my tracker, but I'll get notifications for this one if anyone needs to get my attention.

how to I give it natural soul light? I want to fix it as my world is dead rn until i do

commented

Did a test, and giving the naga natural soul sight will prevent the crash (by bypassing DS sight algorithms, basically, so if you're in the arena, it DOES see you, even if you're behind something).

It won't leave the arena or anything.

It's not an actual fix technically, but it's viable workaround, and might be desired behavior depending on the user.

Going to close the corresponding issue in my tracker, but I'll get notifications for this one if anyone needs to get my attention.

commented

The attack target is null yet shouldExecute only returns true if the target is not null. Is this even possible? Though I recall seeing this same type of issue in the past.

commented

Could it be related to Dynamic Stealth or Improved Mobs?

commented

You'd have to try removing those mods and seeing if the issue persists, without knowing precisely what those mods do, I can't tell you if they'd be related or not.

In any case the crash here is similar to #791, which was definitely not a TF issue.

commented

It does seem similar, but it doesn't happen with Zombies. The Naga was the first time I saw this crash and didn't get the chance to test with the other bosses.

commented

Also got this crash with Dynamic Stealth, posting it over there as well just in case:
https://pastebin.com/5LQnVDY9

commented

So I assume you special case/wrap vanilla tasks then? Hmm.

With vanilla behavior being as so you wouldn't expect that contract to break.
But i suppose having proper null checks is better practice after all.

commented

This is a common compat issue between DS and AI tasks that don't do a null check on the attack target within the same method it is accessed, because MC runs methods of other AI tasks between eg. shouldExecute() and continueExecuting(), so checking for null only in shouldExecute() and caching the target does not work alongside DS, because DS sets the attack target to null to enforce stealth.

I have a system in DS which can be used to wrap such an AI task in my own AI task which does the proper null check and then runs the original AI if it's not null, but...

...That's just the general explanation. Specifically for the Naga, it would probably be better for it not to have limited vision as far as DS is concerned.

Try setting the Naga to have natural soulsight in the DS config and see what happens. Hopefully this won't make the Naga go beyond its arena (I don't think it will).
(server settings -> senses -> sight -> entity specific -> natural soul sight)

If you need the ID of any entity, Fantastic Lib generates a file on run with all your entities' IDs:
config/fantasticlib/reference/entities.txt

Hopefully soul sight is the answer for the Naga, but @Tamaized if could do the null checks within the same AI method that would be awesome as well

commented

Yes, many vanilla AI tasks had this issue as well. For those, I'm replacing them with edited versions (some of them needed other issues fixed anyway iirc).

My filter -> wrapper setup has gotten a lot more efficient than it used to be, but it's still not as efficient as a null check in the execution method, so for active mod developers, I try to convince them to do the null check :)