Hi there, using the Baubles API I have made my custom mod item compatible with the extra slots that Baubles adds. I have an EventHandler that adds a constant Potion Effect to the player if a given Item is equipped in the Baubles Slot.
Whilst playing on a private multiplayer server with friends, I noticed a bug; When any one player on the server equipped the item and received the bonus potion effect, every other player (regardless of in-game distance) on the server also received the same bonus - whether they had the item equipped or not.
I'm like 90% sure the issue is in how I've coded for the effect to be added in the onWornTick method, cause I know the bug doesn't occur when the item is coded to give the potion effect whilst just in the player inventory (Baubles slots don't count as the player inventory).
Here's the code:
The Item class
Pretty sure this (above) is where the bug is happening - when it's referencing EntityLivingBase it's referencing every player on the map or something. Not specifically the individual player like most things would. (Right??)
The EventHandler class
Also, I've noticed that Baubleicious do something weird and get a unique player ID from every player or something? I'm not sure if that helps.
Just to reiterate - I'm sure the issue is within that little bit of code (or lack thereof) in the Item class, as anything I put in there seems to affect every player regardless of circumstance (help idk how else to reference individual EntityPlayers lol). I've looked in the 1.7.10 Baubleicious Github repository and they reference a class that I happen to know is not part of the API but the Baubles mod itself and was not even listed in their github.
No worries I figured it out! If anyone was curious, I didn't even need an event to add constant potion effects and the bug was actually to do with the interaction between the EntityUpdateLivingEvent and the slots in Baubles; i.e. if Zombies had bauble slots the bug would have been effecting them too. The solution was simple to invoke getActivePotionEffect.