Skip to content

Commit aff4e0c

Browse files
committed
Drop chunk status transition patch from paper_chunk_patches
Research by ishland suggests that vanilla already does this, at least since 1.18
1 parent 8067cb6 commit aff4e0c

File tree

3 files changed

+0
-103
lines changed

3 files changed

+0
-103
lines changed

common/src/main/java/org/embeddedt/modernfix/common/mixin/bugfix/paper_chunk_patches/ChunkHolderMixin.java

Lines changed: 0 additions & 61 deletions
This file was deleted.

common/src/main/java/org/embeddedt/modernfix/common/mixin/bugfix/paper_chunk_patches/ChunkMapMixin.java

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,24 @@
11
package org.embeddedt.modernfix.common.mixin.bugfix.paper_chunk_patches;
22

33
import com.mojang.datafixers.util.Either;
4-
import net.minecraft.server.MinecraftServer;
54
import net.minecraft.server.level.*;
65
import net.minecraft.server.level.progress.ChunkProgressListener;
76
import net.minecraft.util.thread.BlockableEventLoop;
87
import net.minecraft.world.level.ChunkPos;
98
import net.minecraft.world.level.chunk.ChunkAccess;
109
import net.minecraft.world.level.chunk.ChunkStatus;
1110
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
12-
import org.embeddedt.modernfix.duck.IPaperChunkHolder;
1311
import org.spongepowered.asm.mixin.Final;
1412
import org.spongepowered.asm.mixin.Mixin;
1513
import org.spongepowered.asm.mixin.Shadow;
1614
import org.spongepowered.asm.mixin.injection.At;
1715
import org.spongepowered.asm.mixin.injection.Inject;
1816
import org.spongepowered.asm.mixin.injection.ModifyArg;
19-
import org.spongepowered.asm.mixin.injection.Redirect;
20-
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
2117
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
2218

2319
import java.util.Optional;
2420
import java.util.concurrent.CompletableFuture;
2521
import java.util.concurrent.Executor;
26-
import java.util.function.Function;
2722

2823

2924
@Mixin(ChunkMap.class)
@@ -41,45 +36,13 @@ public abstract class ChunkMapMixin {
4136

4237
@Shadow protected abstract CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> scheduleChunkGeneration(ChunkHolder chunkHolder, ChunkStatus chunkStatus);
4338

44-
private Executor mainInvokingExecutor;
45-
46-
@Inject(method = "<init>", at = @At("RETURN"))
47-
private void setup(CallbackInfo ci) {
48-
MinecraftServer server = this.level.getServer();
49-
this.mainInvokingExecutor = (runnable) -> {
50-
if(server.isSameThread())
51-
runnable.run();
52-
else
53-
this.mainThreadExecutor.execute(runnable);
54-
};
55-
}
56-
5739

5840
/* https://github.com/PaperMC/Paper/blob/ver/1.17.1/patches/server/0752-Fix-chunks-refusing-to-unload-at-low-TPS.patch */
5941
@ModifyArg(method = "prepareAccessibleChunk", at = @At(value = "INVOKE", target = "Ljava/util/concurrent/CompletableFuture;thenApplyAsync(Ljava/util/function/Function;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;"), index = 1)
6042
private Executor useMainThreadExecutor(Executor executor) {
6143
return this.mainThreadExecutor;
6244
}
6345

64-
/* https://github.com/PaperMC/Paper/blob/master/patches/removed/1.19.2-legacy-chunksystem/0482-Improve-Chunk-Status-Transition-Speed.patch */
65-
@ModifyArg(method = "prepareEntityTickingChunk", at = @At(value = "INVOKE", target = "Ljava/util/concurrent/CompletableFuture;thenApplyAsync(Ljava/util/function/Function;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;"), index = 1)
66-
private Executor useMainInvokingExecutor(Executor executor) {
67-
return this.mainInvokingExecutor;
68-
}
69-
70-
@SuppressWarnings({"rawtypes", "unchecked"})
71-
@Redirect(method = "scheduleChunkGeneration", at = @At(value = "INVOKE", target = "Ljava/util/concurrent/CompletableFuture;thenComposeAsync(Ljava/util/function/Function;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;"))
72-
private CompletableFuture skipWorkerIfPossible(CompletableFuture inputFuture, Function function, Executor executor, ChunkHolder holder) {
73-
Executor targetExecutor = (runnable) -> {
74-
if(((IPaperChunkHolder)holder).mfix$canAdvanceStatus()) {
75-
this.mainInvokingExecutor.execute(runnable);
76-
return;
77-
}
78-
executor.execute(runnable);
79-
};
80-
return inputFuture.thenComposeAsync(function, targetExecutor);
81-
}
82-
8346
/**
8447
* @author embeddedt
8548
* @reason revert 1.17 chunk system changes, significantly reduces time and RAM needed to load chunks

common/src/main/java/org/embeddedt/modernfix/duck/IPaperChunkHolder.java

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)