diff --git a/patches/server/Chunk-System-Starlight-from-Moonrise.patch b/patches/server/Chunk-System-Starlight-from-Moonrise.patch index 67f5f41e46..4cc98a33f0 100644 --- a/patches/server/Chunk-System-Starlight-from-Moonrise.patch +++ b/patches/server/Chunk-System-Starlight-from-Moonrise.patch @@ -8627,12 +8627,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + final int shift = this.coordinateShift; + final int sectionX = chunkX >> shift; + final int sectionZ = chunkZ >> shift; ++ final long sectionKey = CoordinateUtils.getChunkKey(sectionX, sectionZ); + final long chunkKey = CoordinateUtils.getChunkKey(chunkX, chunkZ); + -+ UnloadSection section = this.unloadSections.get(chunkKey); ++ UnloadSection section = this.unloadSections.get(sectionKey); + if (section == null) { + section = new UnloadSection(this.orderGenerator.getAndIncrement()); -+ this.unloadSections.put(chunkKey, section); ++ this.unloadSections.put(sectionKey, section); + } + + return section.chunks.add(chunkKey); @@ -8644,9 +8645,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + final int shift = this.coordinateShift; + final int sectionX = chunkX >> shift; + final int sectionZ = chunkZ >> shift; ++ final long sectionKey = CoordinateUtils.getChunkKey(sectionX, sectionZ); + final long chunkKey = CoordinateUtils.getChunkKey(chunkX, chunkZ); + -+ final UnloadSection section = this.unloadSections.get(chunkKey); ++ final UnloadSection section = this.unloadSections.get(sectionKey); + + if (section == null) { + return false; @@ -8657,7 +8659,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + if (section.chunks.isEmpty()) { -+ this.unloadSections.remove(chunkKey); ++ this.unloadSections.remove(sectionKey); + } + + return true; @@ -8678,14 +8680,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + sectionJson.add("coordinates", coordinates); + + final UnloadSection actualSection = this.getSectionUnsynchronized(section.sectionX(), section.sectionZ()); -+ for (final LongIterator iterator = actualSection.chunks.clone().iterator(); iterator.hasNext();) { -+ final long coordinate = iterator.nextLong(); ++ if (actualSection != null) { ++ for (final LongIterator iterator = actualSection.chunks.clone().iterator(); iterator.hasNext(); ) { ++ final long coordinate = iterator.nextLong(); + -+ final JsonObject coordinateJson = new JsonObject(); -+ coordinates.add(coordinateJson); ++ final JsonObject coordinateJson = new JsonObject(); ++ coordinates.add(coordinateJson); + -+ coordinateJson.addProperty("chunkX", Integer.valueOf(CoordinateUtils.getChunkX(coordinate))); -+ coordinateJson.addProperty("chunkZ", Integer.valueOf(CoordinateUtils.getChunkZ(coordinate))); ++ coordinateJson.addProperty("chunkX", Integer.valueOf(CoordinateUtils.getChunkX(coordinate))); ++ coordinateJson.addProperty("chunkZ", Integer.valueOf(CoordinateUtils.getChunkZ(coordinate))); ++ } + } + } + @@ -22859,7 +22863,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +public class TickRegions { + + public static int getRegionChunkShift() { -+ return 2; ++ return ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ThreadedTicketLevelPropagator.SECTION_SHIFT; + } + +}