Respect default effect cures and add update logic of effect cures
- Fixes #1060 by checking if cures matches default cures in
MobEffectInstance#asDetails. - Make
MobEffectInstance#update~~use the intersection of both effect's cure~~ use the cures of the effect instance of higher amplifier (or longer duration if amplifier equals), so cures always keep the same for the effect instance and its hidden effects. Might not be the best convention, and probably should be controlled byMobEffectEvent.Addedinstead, but I believe a general default implementation should be made to provide a reasonable update result.
- [ ] Publish PR to GitHub Packages
I feel like intersection is definitely not the best option, that's going to lead to a lot of incurable effects. It's probably better to just keep the old around as a hidden effect of the cures differ.
I feel like intersection is definitely not the best option, that's going to lead to a lot of incurable effects. It's probably better to just keep the old around as a hidden effect of the cures differ.
Hidden effect should always be of lower amplifier so we don't break vanilla update logic.
After reconsidering, I believe the sole purpose of the cure update logic should be keeping the active effect and its hidden effects of the same cure, so it make sense when we cure the active effect we also remove all its hidden effects. Additionally, since longer effect of the same amplifier also covers the current effect, the cures should be update to the longer effect's.
Hello! @RaymondBlaze, do you intend to update this PR to 1.21?
The PR has been updated to 1.21, and I improved the update logic by changing how cures is stored.
Now the cures of active effect and the hidden effects are backed by the exact same Set instance, and thus any modification done to the Set(backed by an AtomicReference<Set>) returned by getCures will automatically apply to the hidden effects.
This change also simplifies the process of copying cures from another effect from Set#clear and Set#addAll to AtomicReference#set.
@RaymondBlaze, this pull request has conflicts, please resolve them for this PR to move forward.
Does still make sense with the changes to effect cures in 1.21.2?
It does not, this PR is no longer needed after 1.21.2 changes, so I am closing it.