Skip to content
Success

Changes

Summary

  1. #971: Remove strong chunk reference in PDC (details)
Commit f49e9d1932ece8e5a5aaf259d7221e6f99647721 by md_5
#971: Remove strong chunk reference in PDC

A previous fix for SPIGOT-6814 implemented a callback function for the
PDC implementation that could be set to actively define a chunk as
unsaved, allowing chunks that have not been mutated through block
changes to still require saving if the chunks pdc was mutated.

This implementation however would pass a callback that references the
chunk access internally, meaning the PDC now actively holds onto a
callback that holds a reference to the entire chunk.

Aditionally, this change also impacted the pdc for item metas and
entities for really no reason whatsoever.

This commit re-implements the fix by introducing a new child of the pdc
implementation that the chunk now uses as its pdc. This specific
implementation maintains a dirty flag that is set to `true` on any form
of mutation and set back to false by the chunk that owns the PDC
whenever the chunk itself is flag as no longer dirty.
The file was addedsrc/main/java/org/bukkit/craftbukkit/persistence/DirtyCraftPersistentDataContainer.java
The file was modifiednms-patches/net/minecraft/world/level/chunk/Chunk.patch
The file was modifiednms-patches/net/minecraft/world/level/chunk/IChunkAccess.patch
The file was modifiedsrc/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java