Entity Data Accessors should only be ever set by the creator of the entity. Never added to by other mods.
The reason for this is because Entity Data Accessors are order dependent so if multiple mods tries to add these entity data accessors to mobs and on client, they run in a different order than the server did (because mod load order is not guaranteed), the client will get forcibly disconnected from server when the entity spawns.
Instead, this mixin part needs to be removed and migrated properly to a Forge Capability because capabilities were designed specifically for this use case of attaching data to arbitrary entities. It is safer for mods as the vanilla system is designed specifically only for vanilla and unsafe for mods. Then you would use your own packet to send the data to client when needed.
This is especially a problem in large modpacks where many mods are doing this. Example is TNPLimitless 7 where there's many mods injecting SynchedEntityData onto entities and are getting out of order due to mod load order. Which is causes a lot of reports of people getting disconnected from server due to:
Minecraft version information
1.20.1
Mod loader information
Forge
The issue
Entity Data Accessors should only be ever set by the creator of the entity. Never added to by other mods.
The reason for this is because Entity Data Accessors are order dependent so if multiple mods tries to add these entity data accessors to mobs and on client, they run in a different order than the server did (because mod load order is not guaranteed), the client will get forcibly disconnected from server when the entity spawns.
Instead, this mixin part needs to be removed and migrated properly to a Forge Capability because capabilities were designed specifically for this use case of attaching data to arbitrary entities. It is safer for mods as the vanilla system is designed specifically only for vanilla and unsafe for mods. Then you would use your own packet to send the data to client when needed.
https://github.com/Faboslav/friends-and-foes/blob/09f2cec27eff310087a7b6562b174eb9efe93bc1/common/src/main/java/com/faboslav/friendsandfoes/mixin/BlazeEntityMixin.java#L28-L45
https://github.com/Faboslav/friends-and-foes/blob/09f2cec27eff310087a7b6562b174eb9efe93bc1/common/src/main/java/com/faboslav/friendsandfoes/mixin/IllusionerEntityMixin.java#L56-L89
This is especially a problem in large modpacks where many mods are doing this. Example is TNPLimitless 7 where there's many mods injecting SynchedEntityData onto entities and are getting out of order due to mod load order. Which is causes a lot of reports of people getting disconnected from server due to:![image](https://github.com/Faboslav/friends-and-foes/assets/40846040/98f141f8-02fb-44b9-80f1-514c7d28e8bc)