Closed LakMoore closed 7 years ago
where is the guarantee that the mod will not overwrite a modifier of another mod?
That is exactly what will happen. However, if you leave the code as it is it will crash your game/server.
The other option would be to test for the presence of the modifier and then modify the value, however you would have to decide how you want the modifier value modified, which might stop making sense. (You will need to decide whether you want to add your speed boost to the speed boost that already exists, or perhaps multiply or perhaps average - I don't think any of those would be good solutions)
Or, you could not apply our random modifier if ANY modifier is already applied, I quite like that idea.
The modpack author can disable this feature globally via the config if they don't want it.
Also, you cannot protect against any other mod from modifying this modifier, or which of the above solutions they choose to implement.
Not sure what the solution is. That would be up to CoroSauce, I just wanted to patch the bug.
Thanks for the PR, sadly I failed to notice this until recently. I had noticed this issue a month ago and fixed it by using a unique UUID as well as checking if it was applied already. And will be further refining the use of speed modifiers to better avoid the hyperspeed zombie issue once CoroUtil main feature branch is ready and merged back into production 1.10.x branch.
Edit: fix https://github.com/Corosauce/ZombieAwareness/commit/adace9bb774cf27e2f78418f72b34bdd83b33f88
Issue is here: https://github.com/Corosauce/ZombieAwareness/issues/4
This tutorial advises removing the modifier before applying it: https://bukkit.org/threads/tutorial-setting-entity-attributes.158065/
I have guessed that the method name is removeModifier (sorry). Code is 100% untested.