Skip to content

Commit d33bd29

Browse files
committed
Revert "fix: ghost mushroom attempt 1"
This reverts commit 5054bef.
1 parent 50710be commit d33bd29

File tree

7 files changed

+28
-70
lines changed

7 files changed

+28
-70
lines changed

c2me-notickvd/src/main/java/com/ishland/c2me/notickvd/common/Config.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ public class Config {
1313
" Lower this for a better latency and higher this for a faster loading")
1414
.getLong(GlobalExecutors.GLOBAL_EXECUTOR_PARALLELISM * 2L, GlobalExecutors.GLOBAL_EXECUTOR_PARALLELISM * 2L, ConfigSystem.LongChecks.POSITIVE_VALUES_ONLY);
1515

16+
public static final boolean compatibilityMode = new ConfigSystem.ConfigAccessor()
17+
.key("noTickViewDistance.compatibilityMode")
18+
.comment("Whether to use compatibility mode to send chunks \n" +
19+
" This may fix some mod compatibility issues")
20+
.getBoolean(true, true);
21+
1622
public static final boolean enableExtRenderDistanceProtocol = new ConfigSystem.ConfigAccessor()
1723
.key("noTickViewDistance.enableExtRenderDistanceProtocol")
1824
.comment("""

c2me-notickvd/src/main/java/com/ishland/c2me/notickvd/mixin/MixinServerAccessible.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,14 @@ private static boolean needSendChunks() {
2727
return true;
2828
}
2929

30+
@Dynamic
31+
@WrapOperation(method = "lambda$upgradeToThis$0", at = @At(value = "INVOKE", target = "Lcom/ishland/c2me/rewrites/chunksystem/common/statuses/ServerAccessible;sendChunkToPlayer(Lnet/minecraft/server/world/ServerChunkLoadingManager;Lcom/ishland/flowsched/scheduler/ItemHolder;)V", remap = true), remap = false)
32+
private static void wrapSendChunks(ServerChunkLoadingManager tacs, ItemHolder<?, ?, ?, ?> holder, Operation<Void> original) {
33+
if (Config.compatibilityMode) {
34+
((IThreadedAnvilChunkStorage) tacs).getMainThreadExecutor().submit(() -> original.call(tacs, holder));
35+
} else {
36+
original.call(tacs, holder);
37+
}
38+
}
39+
3040
}

c2me-notickvd/src/main/java/com/ishland/c2me/notickvd/mixin/MixinThreadedAnvilChunkStorage.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ private WorldChunk redirectSendWatchPacketsGetWorldChunk(ChunkHolder chunkHolder
5353
@Inject(method = "makeChunkAccessible", at = @At("RETURN"))
5454
private void onMakeChunkAccessible(ChunkHolder chunkHolder, CallbackInfoReturnable<CompletableFuture<OptionalChunk<WorldChunk>>> cir) {
5555
cir.getReturnValue().thenAccept(either -> either.ifPresent(worldChunk -> {
56-
this.mainThreadExecutor.send(() -> this.sendToPlayers(worldChunk));
56+
if (Config.compatibilityMode) {
57+
this.mainThreadExecutor.send(() -> this.sendToPlayers(worldChunk));
58+
} else {
59+
this.sendToPlayers(worldChunk);
60+
}
5761
}));
5862
}
5963

c2me-rewrites-chunk-system/src/main/java/com/ishland/c2me/rewrites/chunksystem/common/ducks/IPartialPostProcessing.java

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

c2me-rewrites-chunk-system/src/main/java/com/ishland/c2me/rewrites/chunksystem/common/statuses/ServerAccessible.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import com.ishland.c2me.rewrites.chunksystem.common.Config;
1010
import com.ishland.c2me.rewrites.chunksystem.common.NewChunkHolderVanillaInterface;
1111
import com.ishland.c2me.rewrites.chunksystem.common.NewChunkStatus;
12-
import com.ishland.c2me.rewrites.chunksystem.common.ducks.IPartialPostProcessing;
1312
import com.ishland.c2me.rewrites.chunksystem.common.fapi.LifecycleEventInvoker;
1413
import com.ishland.flowsched.scheduler.ItemHolder;
1514
import com.ishland.flowsched.scheduler.KeyStatusPair;
@@ -86,13 +85,15 @@ private static boolean needSendChunks() {
8685
}
8786

8887
private static void sendChunkToPlayer(ServerChunkLoadingManager tacs, ItemHolder<ChunkPos, ChunkState, ChunkLoadingContext, NewChunkHolderVanillaInterface> holder) {
89-
holder.submitOp(CompletableFuture.runAsync(() -> {
90-
final Chunk chunk = holder.getItem().get().chunk();
91-
if (chunk instanceof WorldChunk worldChunk) {
92-
((IPartialPostProcessing) worldChunk).c2me$runBorderPostProcessing();
88+
final Chunk chunk = holder.getItem().get().chunk();
89+
if (chunk instanceof WorldChunk worldChunk) {
90+
CompletableFuture<?> completableFuturexx = holder.getUserData().get().getPostProcessingFuture();
91+
if (completableFuturexx.isDone()) {
9392
((IThreadedAnvilChunkStorage) tacs).invokeSendToPlayers(worldChunk);
93+
} else {
94+
completableFuturexx.thenAcceptAsync(v -> ((IThreadedAnvilChunkStorage) tacs).invokeSendToPlayers(worldChunk), ((IThreadedAnvilChunkStorage) tacs).getMainThreadExecutor());
9495
}
95-
}, ((IThreadedAnvilChunkStorage) tacs).getMainThreadExecutor()::submit));
96+
}
9697
}
9798

9899
private static WorldChunk toFullChunk(ProtoChunk protoChunk, ServerWorld serverWorld) {

c2me-rewrites-chunk-system/src/main/java/com/ishland/c2me/rewrites/chunksystem/mixin/MixinWorldChunk.java

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

c2me-rewrites-chunk-system/src/main/resources/c2me-rewrites-chunk-system.mixins.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"MixinNoiseChunkGenerator",
1313
"MixinServerChunkManager",
1414
"MixinThreadedAnvilChunkStorage",
15-
"MixinWorldChunk",
1615
"async_serialization.MixinBlender",
1716
"async_serialization.MixinChunkRegion",
1817
"async_serialization.MixinChunkSerializer",

0 commit comments

Comments
 (0)