-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Fix Bee anger never gets timeout #13546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
I don't think that the updateAnger check should be in there, should just not just be moved back into the block below where it sets the anger target? |
We need to handle two cases to start the timer: updateAnger is true (forced update, this will reset the timer every tick) or the target has changed. |
lynxplay
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks correct, can you tighten the diff comments a bit?
Maybe
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/NeutralMob.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/NeutralMob.java.patch
index 0442ffc8a9..9e6dfed0fc 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/NeutralMob.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/NeutralMob.java.patch
@@ -13,6 +13,18 @@
}
}
+@@ -63,9 +_,10 @@
+ if (target != null) {
+ if (persistentAngerTarget == null || !persistentAngerTarget.matches(target)) {
+ this.setPersistentAngerTarget(EntityReference.of(target));
++ this.startPersistentAngerTimer(); // Paper - Fix MC-305388 - a new target was selected, start anger timer
+ }
+
+- this.startPersistentAngerTimer();
++ else if (updateAnger) this.startPersistentAngerTimer(); // Paper - Fix MC-305388 - existing target should still be angered towards due to bool param
+ }
+
+ if (persistentAngerTarget != null && !this.isAngry() && (target == null || !isValidPlayerTarget(target) || !updateAnger)) {
@@ -120,7 +_,7 @@
default void stopBeingAngry() {
this.setLastHurtByMob(null);
Done. |
Mojang marked this ticket as Works As Intended, leaves a config option for this fix
|
Mojang marked this ticket as Works As Intended, I prefer to leave a config option for this fix. |
|
With the mojira ticket marked as WAI I am less excited about this PR, even as a config option. Tho the WAI there seems interesting. I'll throw it at some other people for follow up to make sure this is a works as intended. |
|
Yeah with Mojang marking this as working as intended, I am also in the agreement that we should probably close this-- as mojira is in general the source of truth with these behavior changes. |
This pull request closes #13482. (MC-305388)
Analysis
Mojang refactored how mob anger is stored to an absolute timestamp in 1.21.11. In previous versions, this was implemented with tick countdown. But the logic in
updatePersistentAngerwas flawed: it callsstartPersistentAngerTimer()every tick as long as a target exists, completely ignoring the updateAnger parameter.Bees specifically pass false to updatePersistentAnger inside their customServerAiStep.
The timer resets every tick even if updateAnger is false. This creates an infinite loop where isAngry() always returns true, preventing the bee from timing out its aggression.
Fix
We now call
startPersistentAngerTimer()only if:This change restores the logic parity with 1.21.10.