Skip to content

Commit

Permalink
Vastly simplify mod initialization (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
Technici4n authored Apr 16, 2024
1 parent 6a5abe8 commit ad5ed5b
Show file tree
Hide file tree
Showing 29 changed files with 162 additions and 1,025 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ public static void startupProgressBars(SimpleFont font, final SimpleBufferBuilde
final ProgressMeter pm = currentProgress.get(i);
Renderer barRenderer = barRenderer(i, alpha, font, pm, context);
acc = barRenderer.then(acc);
alpha >>= 1;
}
if (acc != null)
acc.accept(buffer, context, frameNumber);
Expand Down
19 changes: 4 additions & 15 deletions loader/src/main/java/net/neoforged/fml/DeferredWorkQueue.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
import static net.neoforged.fml.Logging.LOADING;

import com.google.common.base.Stopwatch;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.ConcurrentLinkedDeque;
Expand All @@ -35,24 +32,16 @@
public class DeferredWorkQueue {
private static final Logger LOGGER = LogManager.getLogger();

private static final Map<ModLoadingStage, DeferredWorkQueue> workQueues = new HashMap<>();

private final ConcurrentLinkedDeque<TaskInfo> tasks = new ConcurrentLinkedDeque<>();
private final ModLoadingStage modLoadingStage;

public DeferredWorkQueue(ModLoadingStage modLoadingStage) {
this.modLoadingStage = modLoadingStage;
workQueues.put(modLoadingStage, this);
}
private final String name;

@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
public static Optional<DeferredWorkQueue> lookup(Optional<ModLoadingStage> parallelClass) {
return Optional.ofNullable(workQueues.get(parallelClass.orElse(null)));
public DeferredWorkQueue(String name) {
this.name = name;
}

public void runTasks() {
if (tasks.isEmpty()) return;
LOGGER.debug(LOADING, "Dispatching synchronous work for work queue {}: {} jobs", modLoadingStage, tasks.size());
LOGGER.debug(LOADING, "Dispatching synchronous work for work queue {}: {} jobs", name, tasks.size());
RuntimeException aggregate = new RuntimeException();
Stopwatch timer = Stopwatch.createStarted();
tasks.forEach(t -> makeRunnable(t, Runnable::run, aggregate));
Expand Down
96 changes: 0 additions & 96 deletions loader/src/main/java/net/neoforged/fml/IModLoadingState.java

This file was deleted.

21 changes: 0 additions & 21 deletions loader/src/main/java/net/neoforged/fml/IModStateProvider.java

This file was deleted.

120 changes: 0 additions & 120 deletions loader/src/main/java/net/neoforged/fml/IModStateTransition.java

This file was deleted.

Loading

0 comments on commit ad5ed5b

Please sign in to comment.