Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vastly simplify mod initialization #110

Merged
merged 7 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading