MCPcopy Create free account
hub / github.com/Teneted/Tenet / futureVisitor

Method futureVisitor

src/main/java/net/minecraftforge/fml/ModList.java:124–132  ·  view source on GitHub ↗
(
            final ModLoadingStage.EventGenerator<T> eventGenerator,
            final BiFunction<ModLoadingStage, Throwable, ModLoadingStage> stateChange)

Source from the content-addressed store, hash-verified

122 }
123
124 <T extends Event & IModBusEvent> Function<Executor, CompletableFuture<List<Throwable>>> futureVisitor(
125 final ModLoadingStage.EventGenerator<T> eventGenerator,
126 final BiFunction<ModLoadingStage, Throwable, ModLoadingStage> stateChange) {
127 return executor -> gather(
128 this.mods.stream()
129 .map(mod -> ModContainer.buildTransitionHandler(mod, eventGenerator, stateChange, executor))
130 .collect(Collectors.toList()))
131 .thenComposeAsync(ModList::completableFutureFromExceptionList, executor);
132 }
133 static CompletionStage<List<Throwable>> completableFutureFromExceptionList(List<? extends Map.Entry<?, Throwable>> t) {
134 if (t.stream().noneMatch(e->e.getValue()!=null)) {
135 return CompletableFuture.completedFuture(Collections.emptyList());

Calls 4

gatherMethod · 0.95
streamMethod · 0.80
mapMethod · 0.45

Tested by

no test coverage detected