9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-19 14:59:32 +00:00
Files
LeavesMC/leaves-server/minecraft-patches/features/0025-InstantBlockUpdater-Reintroduced.patch
MC_XiaoHei 90080d238e 1.21.10 (#752)
---------

Co-authored-by: Lumine1909 <133463833+Lumine1909@users.noreply.github.com>
Co-authored-by: violetc <58360096+s-yh-china@users.noreply.github.com>
Co-authored-by: Helvetica Volubi <88063803+Suisuroru@users.noreply.github.com>
2025-11-28 03:15:54 +08:00

61 lines
3.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Tue, 29 Nov 2022 14:54:56 +0800
Subject: [PATCH] InstantBlockUpdater Reintroduced
This patch is Powered by Carpet-TIS-Addition(https://github.com/plusls/Carpet-TIS-Addition)
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 145c8e1791638c78b81222181e9f3679a33795a9..015c49c8170ba8d73b2bc9386192681a8ececb3f 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -871,12 +871,14 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
// Paper - rewrite chunk system
profilerFiller.pop();
profilerFiller.push("debugSynchronizers");
- if (this.debugSynchronizers.hasAnySubscriberFor(DebugSubscriptions.NEIGHBOR_UPDATES)) {
- this.neighborUpdater
- .setDebugListener(blockPos -> this.debugSynchronizers.broadcastEventToTracking(blockPos, DebugSubscriptions.NEIGHBOR_UPDATES, blockPos));
- } else {
- this.neighborUpdater.setDebugListener(null);
- }
+ if (this.neighborUpdater instanceof net.minecraft.world.level.redstone.CollectingNeighborUpdater cnu) { // Leaves start - instantBlockUpdaterReintroduced
+ if (this.debugSynchronizers.hasAnySubscriberFor(DebugSubscriptions.NEIGHBOR_UPDATES)) {
+ cnu.setDebugListener(blockPos -> this.debugSynchronizers.broadcastEventToTracking(blockPos, DebugSubscriptions.NEIGHBOR_UPDATES, blockPos));
+ } else {
+ cnu.setDebugListener(null);
+ }
+ } // Leaves end - instantBlockUpdaterReintroduced
+
this.debugSynchronizers.tick(this.server.debugSubscribers());
profilerFiller.pop();
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index 01e0dc28ef63456a45b800e72d76180b40811a72..feafaaeca7ffa6fda5af9897c448b61ee1760290 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -113,7 +113,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
.add(new ExplosionParticleInfo(ParticleTypes.SMOKE, 1.0F, 1.0F))
.build();
public final List<TickingBlockEntity> blockEntityTickers = Lists.newArrayList();
- protected final CollectingNeighborUpdater neighborUpdater;
+ protected final net.minecraft.world.level.redstone.NeighborUpdater neighborUpdater; // Leaves - instantBlockUpdaterReintroduced
private final List<TickingBlockEntity> pendingBlockEntityTickers = Lists.newArrayList();
private boolean tickingBlockEntities;
public final Thread thread;
@@ -863,7 +863,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
this.thread = Thread.currentThread();
this.biomeManager = new BiomeManager(this, biomeZoomSeed);
this.isDebug = isDebug;
- this.neighborUpdater = new CollectingNeighborUpdater(this, maxChainedNeighborUpdates);
+ // Leaves start - instantBlockUpdaterReintroduced
+ if (org.leavesmc.leaves.LeavesConfig.modify.oldMC.updater.instantBlockUpdaterReintroduced) {
+ this.neighborUpdater = new net.minecraft.world.level.redstone.InstantNeighborUpdater(this);
+ } else {
+ this.neighborUpdater = new CollectingNeighborUpdater(this, maxChainedNeighborUpdates);
+ }
+ // Leaves end - instantBlockUpdaterReintroduced
this.registryAccess = registryAccess;
this.palettedContainerFactory = PalettedContainerFactory.create(registryAccess);
this.damageSources = new DamageSources(registryAccess);