Skip to content

Commit

Permalink
Merge branch 'ver/1.19.4' into feature/fast-chunk-serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
ishland committed May 4, 2023
2 parents b0ab4cb + c0ac08e commit 304b9d5
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.ishland.c2me.base.ModuleEntryPoint;
import com.ishland.c2me.base.common.util.C2MENormalWorkerThreadFactory;
import net.minecraft.util.thread.TaskExecutor;

import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
Expand Down Expand Up @@ -37,6 +36,6 @@ public class GlobalExecutors {
new LinkedBlockingQueue<>(),
new ThreadFactoryBuilder().setDaemon(true).setNameFormat("c2me-sched").build());

public static final TaskExecutor<Runnable> asyncSchedulerTaskExecutor = TaskExecutor.create(asyncScheduler, "c2me-sched");
// public static final TaskExecutor<Runnable> asyncSchedulerTaskExecutor = TaskExecutor.create(asyncScheduler, "c2me-sched");

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
import net.minecraft.util.math.random.LocalRandom;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(LocalRandom.class)
public interface ISimpleRandom {

@Accessor
long getSeed();

@Accessor
void setSeed(long seed);
@Invoker
void invokeSetSeed(long seed);

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@Mixin(ThreadedAnvilChunkStorage.class)
public class MixinThreadedAnvilChunkStorage implements IVanillaChunkManager {

private final SchedulingManager c2me$schedulingManager = new SchedulingManager(GlobalExecutors.asyncSchedulerTaskExecutor::send, GlobalExecutors.GLOBAL_EXECUTOR_PARALLELISM * 2);
private final SchedulingManager c2me$schedulingManager = new SchedulingManager(GlobalExecutors.asyncScheduler, GlobalExecutors.GLOBAL_EXECUTOR_PARALLELISM * 2);

@Override
public SchedulingManager c2me$getSchedulingManager() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class NoTickSystem {
final NoThreadScheduler noThreadScheduler = new NoThreadScheduler();

private final AtomicBoolean isTicking = new AtomicBoolean();
final Executor executor = GlobalExecutors.asyncSchedulerTaskExecutor::send;
final Executor executor = GlobalExecutors.asyncScheduler;
private volatile LongSet noTickOnlyChunksSnapshot = LongSets.EMPTY_SET;
private volatile boolean pendingPurge = false;
private volatile long age = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static void derive(RandomSplitter deriver, Random random, int x, int y, i
if (deriver instanceof CheckedRandom.Splitter) {
final ISimpleRandom random1 = (ISimpleRandom) random;
final IAtomicSimpleRandomDeriver deriver1 = (IAtomicSimpleRandomDeriver) deriver;
random1.setSeed(MathHelper.hashCode(x, y, z) ^ deriver1.getSeed());
random1.invokeSetSeed(MathHelper.hashCode(x, y, z) ^ deriver1.getSeed());
return;
}
throw new IllegalArgumentException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ private CompletableFuture<Optional<NbtCompound>> getUpdatedChunkNbtAtAsync(Chunk
* @reason skip datafixer if possible
*/
@Overwrite
private CompletableFuture<Optional<NbtCompound>> getUpdatedChunkNbt(ChunkPos chunkPos) {
public CompletableFuture<Optional<NbtCompound>> getUpdatedChunkNbt(ChunkPos chunkPos) {
// return this.getNbt(chunkPos).thenApplyAsync(nbt -> nbt.map(this::updateChunkNbt), Util.getMainWorkerExecutor());
return this.getNbt(chunkPos).thenCompose(nbt -> {
if (nbt.isPresent()) {
Expand Down

0 comments on commit 304b9d5

Please sign in to comment.