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 d25b1c7d1347b2731cd12cdcea7190276913de49..878a00bb28223b2719b4ce7c5d715e0346364770 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 63c1d223d9fc16b4211e992bde3c9f08d3ed15ca..292b062f55b7f37346750ed3a59ed4fb64c92df8 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -4742,10 +4742,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 =