From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: NanaChiyo0721 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 e541189887f446844ffd77ff099d1f4dba556fe9..dfe1ebb4e016ef1c8c8bb47973b93834be707921 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 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 216c7a6c9a139c998809b98134706a52ad271518..27a29be1be014bee576d64ff198d394a08f0601b 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -4765,10 +4765,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 =