Creating worlds causes the server to poll scheduled tick tasks and execute all of them
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 12.7k
- Forks
- 3.5k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 11
Description
Expected behavior
I think that most developers (including me) expect that Server#createWorld just creates and loads the world, without executing any other tasks at that time.
Observed/Actual behavior
Server#createWorld calls MinecraftServer#prepareLevel, which keeps calling MinecraftServer#executeModerately while the world is being loaded. That last method polls and executes all scheduled tick tasks, causing for example players changing their position before the world is created.
Steps/models to reproduce
This is just an example, there are other things that it may affect (and I'm pretty sure it actually affects more than that):
- Add a
PlayerMoveEventlistener, I think it's a good idea to print stacktrace when the event is called to actually understand this issue. - Create a world using
Server#createWorldafter the server has been loaded, I think it's the best if you make it a command. - Join the server and execute that command.
- Move at the time the world is being created.
- Note that the
PlayerMoveEventis called while the world is being created.
Plugin and Datapack List
I don't use any datapacks or plugins, except of my own, private minigame plugin for my MC network.
Paper version
[19:54:03 INFO]: Checking version, please wait...
[19:54:03 INFO]: This server is running Paper version 1.21.11-100-main@4873e3f (2026-01-29T11:02:49Z) (Implementing API version 1.21.11-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.11-99-81b9122 (MC: 1.21.11)
Other
I think there is a reason Minecraft does that, but didn't get deep into that. This behaviour should at least be documented in javadoc of Server#createWorld, though it's still annoying to know that the server may execute other tasks while worlds are being created, I have no idea what's the best way to fix this issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing Server#createWorld into MinecraftServer#prepareLevel and MinecraftServer#executeModerately. Reproduce the issue with a PlayerMoveEvent listener while creating a world, then determine whether the intended fix is preventing unrelated scheduled tasks from running or documenting the behavior in Server#createWorld javadoc; done means the observed behavior is resolved or clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100