Skip to content

Conversation

@xSnowyk
Copy link
Contributor

@xSnowyk xSnowyk commented Dec 17, 2025

Currently, TemptGoal#canUse fires EntityTargetLivingEntityEvent unconditionally every time a valid target is found. Since canContinueToUse delegates to canUse to verify if the player is still valid/holding the item, this results in the event being fired every single tick for every mob being tempted. This creates significant unnecessary overhead and spams plugins that listen to target changes.

This patch adds a check to ensure EntityTargetLivingEntityEvent is only fired when the target actually changes (or is initially found), rather than on every tick of the goal execution.

@xSnowyk xSnowyk requested a review from a team as a code owner December 17, 2025 17:02
@github-project-automation github-project-automation bot moved this to Awaiting review in Paper PR Queue Dec 17, 2025
@electronicboy
Copy link
Member

it continuing to fire is somewhat of an expected thing, think a player navigating around a protected region, they shouldn't remain immune; having a timer between attempts (for the same player) might be the better idea here

@xSnowyk
Copy link
Contributor Author

xSnowyk commented Dec 18, 2025

Checking event plugins 20 times per second for a passive mob walking toward food is an unjustified waste of resources. In my view, a maximum latency of 0.5 seconds for edge cases (like region protection) is a negligible gameplay compromise compared to the performance stability gained by reducing this event spam by 90%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Awaiting review

Development

Successfully merging this pull request may close these issues.

2 participants