MrCrayfishFurnitureMod is modifying the world off the main thread
Aaron1011 opened this issue ยท 5 comments
In MessageMineBayBuy, World#spawnEntity
is called to spawn in a new item. However, the onMessage
callback is invoked from a Netty handler thread - not the main server thread.
While this may appear to work, it can easily lead to corrupted data or other difficult-to-reproduce issues. The Minecraft server expects all modifications to the game to be done from the main thread, and has essentially no thread-safe methods.
To fix this, the body of onMessage
should be wrapped in a scheduled task (using MinecraftServer#addScheduledTask
I hate my old code ๐ I will get a fix for this soon. For the 1.13 update, I plan to rewrite the mod from scratch.
@MrCrayfish will you still update the mod for 1.12.2?
I can just about guarantee this is related to Issue #208.