Trying to fix an advancement, works in 1.19 but not in 1.20
It works when I put a different entity but not a goat.
Linked issues
is duplicated by 2
Attachments
Comments 4
The damage dealt by the goat has a unique NO_ANGER flag, which hides the attacking entity from the attacked one. This prevents mobs from becoming aggressive in response to the attack. While this behavior works as intended for mobs, it introduces an unintended issue when the attacked entity is a player.
Players, unlike mobs, should not be subject to the NO_ANGER flag's behavior. When a player is attacked, this flag prevents the player from identifying the attacking entity, resulting in issues such as advancements and statistics triggers failing to process correctly.
To address the issue, I’ve implemented a fix that modifies the logic of the NO_ANGER flag. The fix bypasses the flag’s check when the attacked entity is a player. This change ensures that:
Players can detect the attacking entity.
Advancements and statistics triggers work as intended.
I have thoroughly tested the fix to confirm that it resolves the problem without altering the intended behavior of the goat in other scenarios. The original mechanics, such as preventing mobs from becoming aggressive due to the flag, remain unchanged.
If this is helpful, you can explore the implementation in this mixin: LivingEntityMixin.java.
I’m sharing this in case it helps guide you toward a more robust solution or sparks ideas for further improvements.
Still happens in 1.20.6