Minecraftforge: setRevengeTarget should not fire LivingSetAttackEvent

Created on 9 Nov 2017  路  5Comments  路  Source: MinecraftForge/MinecraftForge

The AI entities generally have two methods:
setAttackTarget representing the entity the owner is actively trying to get to and injure.

setRevengeTarget representing an entity that has recently injured the owner. This set on damage and cleared after 5 seconds. It is not used by any active attack tasks, but rather is used to hint to AI tasks that maybe the owner should turn its attention on it. We see this in action in EntityAIHurtByTarget.startExecuting, which does owner.setAttackTarget(owner.getRevengeTarget()). A given revenge target might never become the main target if EntityAIHurtByTarget doesn't get to execute.

What this means is that a revenged entity ends up having this event fired twice for it, once on setRevengeTarget, and once when (and if) it becomes the real attack target.

Either a new event should be created or the firing in setRevengeTarget eliminated, because just because an entity is the revenge target doesn't mean it will ever become the real target.

Most helpful comment

I will make a PR for this by the end of the week

All 5 comments

This issue has been automatically marked as stale because it has not had activity in a long time. If this issue is still relevant and should remain open, please reply with a short explanation (e.g. "I have checked the code and this issue is still relevant because ___." or "Here's a screenshot of this issue on the latest version"). Thank you for your contributions!

I will make a PR for this by the end of the week

This issue has been automatically marked as stale because it has not had activity in a long time. If this issue is still relevant and should remain open, please reply with a short explanation (e.g. "I have checked the code and this issue is still relevant because ___." or "Here's a screenshot of this issue on the latest version"). Thank you for your contributions!

unstale: made the pr finally

Was this page helpful?
0 / 5 - 0 ratings