Skip to content

Don't save entities when a chunk's save is cancelled#11336

Closed
NewwindServer wants to merge 1 commit into
PaperMC:masterfrom
NewwindServer:chunk-unload-fix
Closed

Don't save entities when a chunk's save is cancelled#11336
NewwindServer wants to merge 1 commit into
PaperMC:masterfrom
NewwindServer:chunk-unload-fix

Conversation

@NewwindServer
Copy link
Copy Markdown
Contributor

From searching code across GitHub, the primary use case for ChunkUnloadEvent.setSaveChunk(false) seems to be preventing certain worlds, like minigame worlds, from being saved.

In most cases, if you're not saving a chunk, it also makes sense not to save the entities within that chunk.
Before version 1.17, this was the default behavior, as entities were saved within chunks.

However, in the current system, even when chunk saving is canceled, entities like shot arrows or unexploded TNT are still saved, which can cause leftover items in minigame worlds.

@NewwindServer NewwindServer requested a review from a team as a code owner August 28, 2024 14:40
Copy link
Copy Markdown
Contributor

@lynxplay lynxplay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mojang disconnected chunk and entity saving a while ago.
Hence why spigot introduced the EntitiesUnloadEvent.

The fact that they save in the same logic again is entire an implementation detail of the chunk rewrite. Having the chunk event be responsible for disabling the entity saving hence becomes rough if this impl ever changes.

I think it would be better to have such a setting on the respective EntitiesUnloadEvent.

@NewwindServer NewwindServer closed this by deleting the head repository Sep 20, 2024
@Warriorrrr Warriorrrr moved this from Changes required to Closed in Paper PR Queue Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

3 participants