Yeah this would fully solve the issue of chunk unloading race condition The same fix was already initially added at "Force clamp grid-exponent to 1~6"
44 lines
2.7 KiB
Diff
44 lines
2.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
|
Date: Thu, 30 Jul 2026 21:16:31 +0800
|
|
Subject: [PATCH] Reduce ticket operations in nether portal searching
|
|
|
|
|
|
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
|
index 9933e59dfebf5d731ea73585c2b08f9e4ff42d53..01a93a747d2fec6248909165bd450833e72cc231 100644
|
|
--- a/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/net/minecraft/server/level/ServerLevel.java
|
|
@@ -221,6 +221,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
|
private final StructureCheck structureCheck;
|
|
public final boolean tickTime; // Folia - region threading
|
|
private final LevelDebugSynchronizers debugSynchronizers = new LevelDebugSynchronizers(this);
|
|
+ public final io.nanachiyo0721.shiroha.utils.ReferenceCountingChunkLoader portalSearchingChunkLoader = new io.nanachiyo0721.shiroha.utils.ReferenceCountingChunkLoader(this, net.minecraft.world.level.chunk.status.ChunkStatus.EMPTY); // Shiroha - Reduce ticket operations in nether portal searching
|
|
|
|
// CraftBukkit start
|
|
private final ResourceKey<LevelStem> typeKey;
|
|
@@ -965,6 +966,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
|
|
|
|
this.debugSynchronizers.tick(this.server.debugSubscribers());
|
|
profiler.pop();
|
|
+ this.portalSearchingChunkLoader.tickChunkReferenceTTL(); // Shiroha - Reduce ticket operations in nether portal searching
|
|
}
|
|
|
|
// Folia start - region threading
|
|
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
|
index 9308201aaae9c419ed7b2edd09c334ffd8025f50..25a4ce7204c6e7f22a125b81de29be0980c258dd 100644
|
|
--- a/net/minecraft/world/entity/Entity.java
|
|
+++ b/net/minecraft/world/entity/Entity.java
|
|
@@ -4738,10 +4738,10 @@ public abstract class Entity
|
|
);
|
|
|
|
// kick off search for existing portal or creation
|
|
- destination.moonrise$loadChunksAsync(
|
|
+ destination.portalSearchingChunkLoader.loadChunksAsync( // Shiroha - Reduce ticket operations in nether portal searching
|
|
// add 32 so that the final search for a portal frame doesn't load any chunks
|
|
targetPos, portalSearchRadius + 32,
|
|
- net.minecraft.world.level.chunk.status.ChunkStatus.EMPTY,
|
|
+ //net.minecraft.world.level.chunk.status.ChunkStatus.EMPTY, // Shiroha - Reduce ticket operations in nether portal searching
|
|
ca.spottedleaf.concurrentutil.util.Priority.HIGH,
|
|
(chunks) -> {
|
|
BlockUtil.FoundRectangle portal =
|