Fix clipping flag update ordering issue

This commit is contained in:
Player Name 2026-07-21 17:11:54 +02:00
parent 9b5ffa2255
commit 9ce45ddcc0
3 changed files with 6 additions and 6 deletions

View file

@ -635,7 +635,7 @@ public class RegionChunk {
/**
* Resets the flags.
*/
public void resetFlags() {
public void resetUpdateFlags() {
updateFlags.clear();
}
@ -658,7 +658,7 @@ public class RegionChunk {
/**
* Reinitializes the clipping flags; used when a region is copied into a new dynamic region.
*/
public void syncFlagsToRegionManager() {
public void resetClippingFlags() {
flags = new ChunkFlags(currentBase.getX(), currentBase.getY(), currentBase.getZ());
projectileFlags = new ChunkFlags(currentBase.getX(), currentBase.getY(), currentBase.getZ(), true);
}
@ -667,7 +667,7 @@ public class RegionChunk {
* Rebuilds the clipping flags based on those of a source chunk (used when a chunk is being replaced).
* @param from The region plane to get the new clipping flags from.
*/
public void rebuildFlags(RegionChunk from) {
public void rebuildClippingFlags(RegionChunk from) {
for (int x = 0; x < 8; x++) {
for (int y = 0; y < 8; y++) {
// Import the landscape flags from the template chunk to the new chunk

View file

@ -290,8 +290,8 @@ public final class DynamicRegion extends Region {
Location currentBase = getBaseLocation().transform(x << 3, y << 3, z);
replacement.setCurrentBase(currentBase);
replacement.rebaseObjects();
replacement.rebuildFlags(orig);
replacement.syncFlagsToRegionManager();
replacement.resetClippingFlags();
replacement.rebuildClippingFlags(orig);
for (NPC npc : orig.getNpcs()) {
Location newLoc = currentBase.transform(npc.getLocation().getChunkOffsetX(), npc.getLocation().getChunkOffsetY(), 0);
NPC copy = NPC.create(npc.getId(), newLoc, npc.getDirection());

View file

@ -13,7 +13,7 @@ object ChunkUpdateTracker : ChunkDirtyListener {
/** Resets flags on exactly the chunks flagged this tick. Must run after all per-player flushes. */
fun resetAll() {
dirty.forEach { it.resetFlags() }
dirty.forEach { it.resetUpdateFlags() }
dirty.clear()
}
}