Ranged entities continue to attack after their target is dead.

Published by Scootied on
Status
Fixed
Issue description

The mod Im making includes plenty of friendly ranged entities attacking other large groups of entities. But what I have learned is that the ranged entities when there are multiple, attacking 1 or more targets, creates a chance where they will continue to fire infinitely until the world has been exited and reentered. Due to this, on servers or even single player worlds it is a huge inconvenience and can drive down performance. It also hurts the player still causing possible deaths to occur. Please fix this in 2020.4. This problem almost ruins the mod for single player worlds. And I know a similar post has been made but the answer they got had nothing to do with the title. Even if you guys can't fix it, maybe a way to check if an entities there and then stop firing if it isn't? Anything would be better than it is currently.

Issue comments

Ranged AI is used from vanilla MC and ranged entites shoot as long as they have targets. Check your AI tasks to see what targets they define.

For example, fight back targets will make ranged entites fight each other if they shoot each other.

The define only zombies but I have tried everything. Skeleton AI, target every mob specifically, target them all, watch closest entity, nothing ever works. And it happens with every ranged entity. I dont think this is a targeting error anymore. I can send screenshots if you wish I just want some way for this to be fixed.

Hmm if this is the case, please make a minimal reproducible example workspace with one demo entity demonstrating the problem. Make sure you don't use mob bases in the demo as they are not supported.

Then provide me steps to replicate this and I will try to isolate the problem.

Alright I just did so and I can send the workspace if you wish. Basically, make a creature entity that can not move and has no collision box. Apply any ranged item (they all caused this effect) and attach this to the entity. For the one I used here it has ranged attacks checked on and the AI tasks have the attack entities of type (whatever mod Im killing) and then look around beneath it. My other mob is simply a hostile who attacks the shooting entity. It doesnt matter that much though as the ranged entity is the important part. When in large groups, there is a chance for them to never stop shooting. This usually happens when they are not all facing the same direction. If this didn't help you replicate the problem, then just ask me for the demo workspace.

Also I apologize, this is with forge not datapack. I read the issue tracker list wrong, I apologize

Vanilla AI shooting does not only check for target live status but is also navigator dependent. I will remove the latter requirement in 2020.4 to fix this problem.

Thank you so much. This evil bug will finally be squashed

You are welcome! I am glad I could help :) If you like what we do, consider donating to us to help us keep this project up.