TheGreyGhost Posted August 20, 2016 Posted August 20, 2016 Howdy After suffering a few sessions of debugging pain due to wrong side / wrong thread, I think it would be very helpful to add some sort of side / thread correctness checking to Forge - something that checks whether a method is being called from an unexpected thread, or at least gives an explicit cue. Accessing client-side objects from the server side (or vica versa) Calling methods from a side which is not used (for example - Item.onUpdate) Rendering thread calling client thread code Network thread calling client thread code or server thread code The @SideOnly annotation in Forge helps a bit but isn't checked automatically (except by running the DedicatedServer and manually testing all code branches again), and it's also not suitable for decorating your own code with. Some sort of static analysis with annotations would be best (during build, or during mod loading), but even a forge-provided assert method for coders would be very helpful. If there is broad interest I can have a go at trying to produce something (advice on where to start would be very helpful since I don't have much experience with annotations) -TGG Quote
LexManos Posted August 20, 2016 Posted August 20, 2016 Not really possible, and would be performance nightmares. Also 90% of everything is called from both threads depending on what objects you are on. @SideOnly has nothing to do with threads, its the environment. Quote I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.