From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Helvetica Volubi Date: Mon, 17 Nov 2025 18:41:08 +0800 Subject: [PATCH] Instant Block Updater diff --git a/io/papermc/paper/threadedregions/RegionizedWorldData.java b/io/papermc/paper/threadedregions/RegionizedWorldData.java index fd9a69e3ca28923d6fd75f6fc819c7952a0474ea..b758dddb768adde0f22d043b42cbd1094dbdf994 100644 --- a/io/papermc/paper/threadedregions/RegionizedWorldData.java +++ b/io/papermc/paper/threadedregions/RegionizedWorldData.java @@ -506,7 +506,7 @@ public final class RegionizedWorldData { public long lastMidTickExecuteFailure; // From Level public boolean populating; - public final CollectingNeighborUpdater neighborUpdater; + public final net.minecraft.world.level.redstone.NeighborUpdater neighborUpdater; // Lophine - Instant Block Updater public boolean captureBlockStates = false; public boolean captureTreeGeneration = false; public final Map capturedBlockStates = new java.util.LinkedHashMap<>(); // Paper @@ -567,7 +567,11 @@ public final class RegionizedWorldData { this.world = world; this.blockLevelTicks = new LevelTicks<>(world::isPositionTickingWithEntitiesLoaded, world, true); this.fluidLevelTicks = new LevelTicks<>(world::isPositionTickingWithEntitiesLoaded, world, false); - this.neighborUpdater = new CollectingNeighborUpdater(world, world.neighbourUpdateMax); + // Lophine start - Instant Block Updater + this.neighborUpdater = fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.instantBlockUpdaterReintroduced + ? new net.minecraft.world.level.redstone.InstantNeighborUpdater(world) + : new CollectingNeighborUpdater(world, world.neighbourUpdateMax); + // Lophine end - Instant Block Updater this.nearbyPlayers = new NearbyPlayers(world); this.wireHandler = new alternate.current.wire.WireHandler(world); this.turbo = new io.papermc.paper.redstone.RedstoneWireTurbo((RedStoneWireBlock)Blocks.REDSTONE_WIRE); @@ -896,4 +900,4 @@ public final class RegionizedWorldData { public int getChunkCount() { return this.chunks.size(); } -} \ No newline at end of file +} diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java index 68d65784cfa9c6d19447bbaaa15220f5656a385a..45e00cf1f069d15b13331323c33c7622ee651ddd 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java @@ -1016,11 +1016,15 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet // Paper - rewrite chunk system profiler.pop(); profiler.push("debugSynchronizers"); - if (this.debugSynchronizers.hasAnySubscriberFor(DebugSubscriptions.NEIGHBOR_UPDATES)) { - regionizedWorldData.neighborUpdater // Folia - region threading - .setDebugListener(blockPos -> this.debugSynchronizers.broadcastEventToTracking(blockPos, DebugSubscriptions.NEIGHBOR_UPDATES, blockPos)); - } else { - regionizedWorldData.neighborUpdater.setDebugListener(null); // Folia - region threading + // Lophine start - Instant Block Updater + if (regionizedWorldData.neighborUpdater instanceof net.minecraft.world.level.redstone.CollectingNeighborUpdater neighborUpdater) { + if (this.debugSynchronizers.hasAnySubscriberFor(DebugSubscriptions.NEIGHBOR_UPDATES)) { + neighborUpdater // Folia - region threading + .setDebugListener(blockPos -> this.debugSynchronizers.broadcastEventToTracking(blockPos, DebugSubscriptions.NEIGHBOR_UPDATES, blockPos)); + } else { + neighborUpdater.setDebugListener(null); // Folia - region threading + } + // Lophine end - Instant Block Updater } this.debugSynchronizers.tick(this.server.debugSubscribers());