Skip to content

Queue chunk unloads until next move for 1.13.2 - #1349

Open
roccodev wants to merge 1 commit into
ViaVersion:masterfrom
roccodev:feature/queue-chunk-unloads
Open

roccodev wants to merge 1 commit into
ViaVersion:masterfrom
roccodev:feature/queue-chunk-unloads

Conversation

@roccodev

@roccodev roccodev commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Previously, teleporting a player on 1.13.2 and below would sometimes cause this stuttering:

out.mp4

There are a few things at play here:

  • 1.8 servers normally send the chunk unloads/loads upon reception of the next flying/position packet from the client, which regularly occurs on the next client tick (on 1.8 clients)
  • This is the same in 1.9-1.13, except:
    • 1.9+ clients send a position packet immediately after accepting the teleport
    • 1.9 servers send the newly loaded chunks before unloading the old ones. This is trickier to do but the current solution still works, albeit with a minor delay caused by 1.9 no longer sending position packets every tick (max delay is 1000ms if the player is not moving)
  • I think the underlying issue is caused by chunk unloads forcing a reset of the blocks in the view frustum, which probably still has the old chunk positions until the end of the tick

The issue can seemingly also be fixed by sending proto chunks (full chunk set to true, but zero bitmask) before each unload, however this leads to a chunk leak in 1.9.2 and below (the second value of MultiplayerChunkCache in F3 does not reset because values are being replaced in a hash map without cleaning up the old ones). So I think this is the cleanest way for all client versions.

This only delays chunk unloads, and only when it is safe to do so. I made it configurable cause it is a bit of a hack/tries to replicate old server behavior. Though if you guys are happy with the design I wouldn't mind having it enabled by default.

1.8 POV with the issue fixed:

out.mp4

@roccodev
roccodev force-pushed the feature/queue-chunk-unloads branch from 779ed31 to 36edee3 Compare October 8, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant