Skip to content

fix PigZombieAngerEvent cancellation (fixes #5319)#5329

Merged
aurorasmiles merged 1 commit into
PaperMC:masterfrom
Trigary:issue-5319
Apr 23, 2021
Merged

fix PigZombieAngerEvent cancellation (fixes #5319)#5329
aurorasmiles merged 1 commit into
PaperMC:masterfrom
Trigary:issue-5319

Conversation

@Trigary
Copy link
Copy Markdown
Contributor

@Trigary Trigary commented Mar 9, 2021

Fixes #5319 (PigZombieAngerEvent cancellation) by setting the PathfinderGoalHurtByTarget's goalTarget to null.

Setting just EntityPigZombie's goalTarget to null (eg. by calling pacify) is not enough: while the zombified piglin doesn't make other piglins angry, (and the piglin itself doesn't become angry either) it still attacks the player who attacked it. A piglin that attacks the player but isn't angry seems weird, so I decided not to do that. I also believe that canceling the event should mean that the piglin won't attack the player, that's another reason not to go down this route.

So instead of just clearing EntityPigZombie's goalTarget, I also cleared PathfinderGoalHurtByTarget's goalTarget. The method I added an obfhelper sets both fields to null internally. This pathfinder goal is the culprit for the weird behavior explained in the previous paragraph: even though EntityPigZombie's goalTarget was set to null, the pathfinder goal kept setting it to the value it had internally cached. So the solution is to clear that internal cache.

@Trigary
Copy link
Copy Markdown
Contributor Author

Trigary commented Mar 18, 2021

"rebased" and retested

@Trigary Trigary requested a review from a team as a code owner April 23, 2021 13:02
@aurorasmiles aurorasmiles enabled auto-merge (squash) April 23, 2021 13:05
@aurorasmiles aurorasmiles merged commit 14de2b7 into PaperMC:master Apr 23, 2021
ExcessiveAmountsOfZombies pushed a commit to ExcessiveAmountsOfZombies/Paper that referenced this pull request May 14, 2021
LeonTG pushed a commit to LeonTG/Paper that referenced this pull request May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PigZombieAngerEvent is completely borked

5 participants