Draconic Evolution

Draconic Evolution

77M Downloads

PlaceItem events being called on network thread

Sir-Will opened this issue ยท 4 comments

commented

hey, can the events here: https://github.com/brandon3055/Draconic-Evolution/blob/master/src/main/java/com/brandon3055/draconicevolution/network/PacketPlaceItem.java be called on the server thread as it's causing issues when it is being called on the network thread.
(SpongePowered/SpongeForge#2294 (comment))

Draconic-Evolution-1.12-2.3.11.290-universal

commented

mm yeah, can't do this. Block/World changes always need to be done on the main thread. FIFO or server goes to pieces.

commented

See comment Here.

commented

After taking a look at the sponge issue you linked it is clear they simply assumed that my network handler was running code on the incorrect thread and completely missed my wrapper. As far as i can tell there isn't actually an issue here.

commented

This should not be an issue as all of my packets (including that one) use my message handler wrapper that ensures that code runs on the main server thread not the network thread. I tested and can confirm that in dev at least it is working as intended.

The only way i see this breaking is if sponge is screwing with MinecraftServer#callFromMainThread (Would not surprise me one bit if they are.)

https://github.com/brandon3055/BrandonsCore/blob/e6364e5b8945ca244341c81d50aec45ea1b58f82/src/main/java/com/brandon3055/brandonscore/network/MessageHandlerWrapper.java
https://github.com/brandon3055/BrandonsCore/blob/f1384cd545b4d73d0c2d0001c530e57b77912adf/src/main/java/com/brandon3055/brandonscore/network/PacketSyncObject.java