mojira.dev
MC-189162

Applying an effect with particles hidden will be unhidden by beacons, conduits and dolphins for the same effect

The bug

Potion effect shadowing is imperfect. The precise problem is rather difficult to describe and I won't attempt to do so at the current time; suffice to say, this mainly manifests as particles appearing when they should not or being opaque when they should be ambient; due to the particle changes in 24w11a, this issue can be thought of as MC-96535 on a per-effect basis.

To reproduce

  1. Build a level 1 beacon and set it to Speed, but put a solid block over it so you don't get the effect

  2. Run /effect give @s minecraft:speed infinite 0 true

  3. Unblock the beacon
    → ❌ Notice how you have opaque Speed particles emanating form you.

Thoughts on a fix

Firstly, the show_particles and ambient booleans should be condensed into a single int, particle_opacity_level; this isn't strictly necessarily but will make the rest of what I write here easier to understand. In this implementation, 2 means opaque, 1 means ambient and 0 means no particles at all.

Now, when an effect is applied to a mob which already has an active effect with the same id, the game should check if the amplifier, particle_opacity_level and show_icon fields match. If they do, setting the duration field to the longer of the two values is all that's necessary. However, if even one of these fields is different, a hidden effect instance must be created. The potion effect with the lower amplifier should be selected for storage in the hidden_effect field; if the amplifiers are the same, the one with the shorter duration should become the hidden effect. (If a hidden effect already exists, the new one should be inserted at the appropriate level.)

When it comes time to put this NBT to use by creating particles and rendering the duration in the UI, the game should do the following for each effect ID:

  • Get the amplifier of the highest-level instance and use that as the level to show in the UI.

  • Get the duration of the highest-level instance and use that as the duration to show in the UI.

  • Get the highest particle_opacity_level in the entire hierarchy and use that to render the particles.

  • Get the highest show_icon in the entire hierarchy and use that to render the icon.

Related issues

Attachments

Comments

migrated
[media]
migrated

Can you reproduce this bug in 1.15.2?

migrated

Yes, same thing for 1.15.2. I just added that, thanks!

[Mod] markderickson

Hi there!

I can confirm for 20w28a.

Avoma

Can confirm for 20w46a.

Avoma

Can confirm in 20w51a.

Avoma

Can confirm in 1.16.5.

Avoma

Can confirm in 21w08b. Video attached.

clamlol

Affects 21w37a.
So basically, the bug is that beacons and conduits seem to override the particle visibility settings of existing hidden effects when attempting to apply an effect of the same type, unless the hidden effect is of a lower amplifier than the new one, in which case it gets stored in the HiddenEffect tag as expected. This exception is also the case with MC-96535, but that bug is more of a rendering bug whereas here data is being modified improperly. (I was unable to reproduce this using ambient splash potions so the problem seems specific to beacons and conduits.)

clamlol

Requesting ownership as the current owner has been inactive since 2021.

clamlol

(Unassigned)

Confirmed

Beacon, Particles

1.15.2, 1.16 Pre-release 5, 1.16.1, 20w27a, 20w28a, ..., 24w13a, 1.20.6, 1.21, 1.21.1, 24w33a

Retrieved