Skip to content
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

Fix Mob Effect Visibility/Attributes syncing #10139

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Owen1212055
Copy link
Member

@Owen1212055 Owen1212055 commented Jan 5, 2024

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:

/give @s minecraft:squid_spawn_egg{EntityTag:{Glowing:1b,NoAI:1b,CustomName:'{"text":"Invisible","color":"dark_blue","bold":true,"italic":true,"underlined":true}',active_effects:[{id:invisibility,amplifier:1b,duration:1200,show_particles:1b}]}}

Vanilla: Blink occurs when spawning
After: Blink no longer occurs when spawning

/minecraft:give @s minecraft:zombie_spawn_egg{EntityTag:{Glowing:1b,NoAI:0b,active_effects:[{id:speed,amplifier:20b,duration:60,show_particles:1b}]}}

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

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.
@Owen1212055 Owen1212055 requested a review from a team as a code owner January 5, 2024 21:57
@Owen1212055 Owen1212055 added the build-pr-jar Enables a workflow to build Paperclip jars on the pull request. label Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-pr-jar Enables a workflow to build Paperclip jars on the pull request. pre-softspoon
Projects
Status: Awaiting final testing
Development

Successfully merging this pull request may close these issues.

3 participants