[Incompatiblity] Removed Potion Effects can't perform their effect on last tick
Cheaterpaul opened this issue ยท 3 comments
I have encountered an issue with one of my effects and i know of at least a few other effects that have the same problem.
The problem with my effect is that it does nothing until the very end (remaining duration = 2). Unfortunately Bed Benefits simply removes all effects before they can perform their effect.
My question would be if it would be possible for Bed Benefits to not simply remove all effects, but instead setting the duration to minimum value. Or another solution.
Hello,
It would be fairly easy to set the remaining duration to 2 ticks however I think this may be working as intended. The idea behind this feature is that the player is sleeping off the effect and will not be affected by the consequences of it similar to drinking milk.
My understanding is that while sleeping the player sleeps the effect off, because the world skips the ticks from sleeping to waking up. Meaning that the EffectInstance duration is reduced by the ticks that were skipped by sleeping. Like when you get hard drunk and have a headache at the next morning.
While reducing the time by the skipped ticks is not directly possibly other than calculating them from the world time when
SleepFinishedTimeEvent is fired and the world time when PlayerWakeUpEvent is fired.
But i understand if you want it to work the same as drinking milk.
I solved my exact problem by catching PlayerWakeUpEvent with a higher priority, but there are probably other effects that do the same or have a long duration like the Hero of the Village effect that typically has a duration of 2 minecraft days