Fix Mob Effect Visibility/Attributes syncing #10139
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, Minecraft waits a tick before syncing effect visiblity/glowing. This is noticeable when adding entities into the world with effects. So, this main logic moves the dirty effect logic into the actual updating logic. This causes effect visibility to be updated correctly.
Additionally, mob effects are not correctly added when read from NBT due to their attributes not being applied. This is a problem for entities that have effects already added before being ticked for the first time. We also manually update effect visibility, causing glowing and invisibility to be correctly applied as well.
To reproduce:
Vanilla: Blink occurs when spawning
After: Blink no longer occurs when spawning
Vanilla: Speed attribute is not applied to the zombie.
After: Speed attribute correctly applied
Fixes:
https://bugs.mojang.com/browse/MC-72774
https://bugs.mojang.com/browse/MC-88181
https://bugs.mojang.com/browse/MC-257087 (technically)
https://bugs.mojang.com/browse/MC-171688
Best way to test this is with /tick freeze, place the entities, then /tick unfreeze.
Download the paperclip jar for this pull request: paper-10139.zip