question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PacketSwapBlock#onMessage modifies the world asychronously

See original GitHub issue

The packet handler PacketSwapBlock#onMessage is modifying the world directly from the handler method. Since this method is called from a Netty thread, the world is being modified asynchronously, causing problems with both Vanilla and other mods.

I recommend running this handler on the main thread, using MinecraftServer#addScheduledTask

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mbaxcommented, Nov 1, 2016

If you’re modifying the world in any way, you should be doing that from the main server thread. Also if iterating collections the server uses, or making any calls that might trigger loading any entities/tileentities.

1reaction
mbaxcommented, Oct 30, 2016

Put the entire handling section, not just the spot @Aaron1011 highlighted, into a main thread handler. You have several calls in there that could result in unpleasant or unexpected behavior.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Modifying a world asynchronously - Forums - Bukkit.org
So I have made a minigame and its all working successfully, however it has to randomly generate blocks around a about 100x100 area...
Read more >
Other than modifying blocks, what can't be done ... - SpigotMC
I am well aware that blocks cannot be modified async, but is there anything else I should know about? I don't want to...
Read more >
Asynchronous programming in C# | Microsoft Learn
An overview of the C# language support for asynchronous programming using async, await, Task, and Task.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found