Skip to content

Commit d7a28aa

Browse files
committed
Update to Forge 47.0.14
1 parent 3e6de52 commit d7a28aa

File tree

88 files changed

+1100
-1107
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1100
-1107
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
[![](https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fci.codemc.io%2Fjob%2FMohistMC%2Fjob%2FMohist-1.20.1)](https://ci.codemc.io/job/MohistMC/job/Mohist-1.20.1)
77
[![](https://img.shields.io/github/stars/MohistMC/Mohist.svg?label=Stars&logo=github)](https://github.com/MohistMC/Mohist/stargazers)
8-
[![](https://img.shields.io/badge/Forge-1.20.1--47.0.3-brightgreen.svg?colorB=26303d&logo=Conda-Forge)](https://files.minecraftforge.net/net/minecraftforge/forge/index_1.20.1.html)
8+
[![](https://img.shields.io/badge/Forge-1.20.1--47.0.14-brightgreen.svg?colorB=26303d&logo=Conda-Forge)](https://files.minecraftforge.net/net/minecraftforge/forge/index_1.20.1.html)
99
[![](https://img.shields.io/badge/jdk-17.0.7-brightgreen.svg?colorB=469C00&logo=java)](https://adoptium.net/temurin/releases/?version=17)
1010
[![](https://img.shields.io/badge/Gradle-8.1.1-brightgreen.svg?colorB=469C00&logo=gradle)](https://docs.gradle.org/8.1.1/release-notes.html)
1111
[![](https://img.shields.io/bstats/servers/6762?label=bStats)](https://bstats.org/plugin/server-implementation/Mohist/6762)
@@ -28,7 +28,7 @@
2828
Progress
2929
------
3030

31-
- [x] Rectify Forge([**551feaf01**](https://github.com/MinecraftForge/MinecraftForge/commit/551feaf01))
31+
- [x] Rectify Forge([**d26cdf0b5**](https://github.com/MinecraftForge/MinecraftForge/commit/d26cdf0b5))
3232
- [ ] Start patch
3333
* [x] Bukkit([**0c5d8709**](https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/0c5d8709))
3434
* [ ] CraftBukkit([**b6b514b7e**](https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/b6b514b7e))

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ ext {
5858
COMMONS_IO_VERSION = '2.11.0'
5959

6060
GIT_INFO = gradleutils.gitInfo
61-
VERSION = '1.20.1-47.0.3'
62-
FORGE_VERSION = '47.0.3'
61+
VERSION = '1.20.1-47.0.14'
62+
FORGE_VERSION = '47.0.14'
6363
MOHIST_VERSION = JenkinsNumber.info()
6464

6565
SPECIAL_SOURCE = 'net.md-5:SpecialSource:1.11.0'

forge/fmlcore/src/main/java/net/minecraftforge/fml/CrashReportCallables.java

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,38 @@
1414
import java.util.function.BooleanSupplier;
1515
import java.util.function.Supplier;
1616

17-
public class CrashReportCallables {
18-
17+
public class CrashReportCallables
18+
{
1919
private static final Logger LOGGER = LogUtils.getLogger();
2020
private static final List<ISystemReportExtender> crashCallables = Collections.synchronizedList(new ArrayList<>());
2121

2222
/**
2323
* Register a custom {@link ISystemReportExtender}
2424
*/
25-
public static void registerCrashCallable(ISystemReportExtender callable) {
25+
public static void registerCrashCallable(ISystemReportExtender callable)
26+
{
2627
crashCallables.add(callable);
2728
}
2829

2930
/**
3031
* Register a {@link ISystemReportExtender system report extender} with the given header name and content
3132
* generator, which will always be appended to the system report
32-
*
33-
* @param headerName The name of the system report entry
33+
* @param headerName The name of the system report entry
3434
* @param reportGenerator The report generator to be called when a crash report is built
3535
*/
36-
public static void registerCrashCallable(String headerName, Supplier<String> reportGenerator) {
37-
registerCrashCallable(new ISystemReportExtender() {
36+
public static void registerCrashCallable(String headerName, Supplier<String> reportGenerator)
37+
{
38+
registerCrashCallable(new ISystemReportExtender()
39+
{
3840
@Override
39-
public String getLabel() {
41+
public String getLabel()
42+
{
4043
return headerName;
4144
}
4245

4346
@Override
44-
public String get() {
47+
public String get()
48+
{
4549
return reportGenerator.get();
4650
}
4751
});
@@ -50,36 +54,44 @@ public String get() {
5054
/**
5155
* Register a {@link ISystemReportExtender system report extender} with the given header name and content
5256
* generator, which will only be appended to the system report when the given {@link BooleanSupplier} returns true
53-
*
54-
* @param headerName The name of the system report entry
57+
* @param headerName The name of the system report entry
5558
* @param reportGenerator The report generator to be called when a crash report is built
56-
* @param active The supplier of the flag to be checked when a crash report is built
59+
* @param active The supplier of the flag to be checked when a crash report is built
5760
*/
58-
public static void registerCrashCallable(String headerName, Supplier<String> reportGenerator, BooleanSupplier active) {
59-
registerCrashCallable(new ISystemReportExtender() {
61+
public static void registerCrashCallable(String headerName, Supplier<String> reportGenerator, BooleanSupplier active)
62+
{
63+
registerCrashCallable(new ISystemReportExtender()
64+
{
6065
@Override
61-
public String getLabel() {
66+
public String getLabel()
67+
{
6268
return headerName;
6369
}
6470

6571
@Override
66-
public String get() {
72+
public String get()
73+
{
6774
return reportGenerator.get();
6875
}
6976

7077
@Override
71-
public boolean isActive() {
72-
try {
78+
public boolean isActive()
79+
{
80+
try
81+
{
7382
return active.getAsBoolean();
74-
} catch (Throwable t) {
83+
}
84+
catch (Throwable t)
85+
{
7586
LOGGER.warn("CrashCallable '{}' threw an exception while checking the active flag, disabling", headerName, t);
7687
return false;
7788
}
7889
}
7990
});
8091
}
8192

82-
public static List<ISystemReportExtender> allCrashCallables() {
93+
public static List<ISystemReportExtender> allCrashCallables()
94+
{
8395
return List.copyOf(crashCallables);
8496
}
8597
}

forge/fmlcore/src/main/java/net/minecraftforge/fml/IModLoadingState.java

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77

88
import net.minecraftforge.eventbus.api.Event;
99
import net.minecraftforge.fml.event.IModBusEvent;
10+
import net.minecraftforge.fml.loading.progress.ProgressMeter;
1011

1112
import java.util.Optional;
1213
import java.util.concurrent.CompletableFuture;
1314
import java.util.concurrent.Executor;
1415
import java.util.function.Consumer;
1516
import java.util.function.Function;
17+
import java.util.function.ToIntFunction;
1618

1719
/**
1820
* A mod loading state. During mod loading, the mod loader transitions between states in a defined sorted list of states,
@@ -44,25 +46,33 @@ public interface IModLoadingState {
4446
*/
4547
Function<ModList, String> message();
4648

49+
/**
50+
* @return a function that computes the size of this transition based on the size of the modlist.
51+
* Used to compute progress.
52+
*/
53+
ToIntFunction<ModList> size();
54+
4755
/**
4856
* {@return an optional runnable, which runs before starting the transition from this state to the next}
49-
* @see #buildTransition(Executor, Executor, Function, Function)
57+
* @see #buildTransition(Executor, Executor, ProgressMeter, Function, Function)
5058
*/
5159
Optional<Consumer<ModList>> inlineRunnable();
5260

5361
/**
5462
* Builds the transition task for this state with a blank pre-sync and post-sync task.
5563
*
56-
* @param syncExecutor a synchronous executor
64+
* @param <T> a type of event fired on the mod-specific event bus
65+
* @param syncExecutor a synchronous executor
5766
* @param parallelExecutor a parallel executor
58-
* @param <T> a type of event fired on the mod-specific event bus
67+
* @param progressBar a progress meter for tracking progress
5968
* @return a transition task for this state
60-
* @see #buildTransition(Executor, Executor, Function, Function)
69+
* @see #buildTransition(Executor, Executor, ProgressMeter, Function, Function)
6170
*/
6271
default <T extends Event & IModBusEvent>
6372
Optional<CompletableFuture<Void>> buildTransition(final Executor syncExecutor,
64-
final Executor parallelExecutor) {
65-
return buildTransition(syncExecutor, parallelExecutor,
73+
final Executor parallelExecutor,
74+
final ProgressMeter progressBar) {
75+
return buildTransition(syncExecutor, parallelExecutor, progressBar,
6676
e -> CompletableFuture.runAsync(() -> {}, e),
6777
e -> CompletableFuture.runAsync(() -> {}, e));
6878
}
@@ -71,16 +81,18 @@ Optional<CompletableFuture<Void>> buildTransition(final Executor syncExecutor,
7181
* Builds the transition task for this state. The pre-sync and post-sync task functions allow the transition builder
7282
* to run these tasks on the same executor as the actual event dispatch and pre/post hooks.
7383
*
74-
* @param syncExecutor a synchronous executor
84+
* @param <T> a type of event fired on the mod-specific event bus
85+
* @param syncExecutor a synchronous executor
7586
* @param parallelExecutor a parallel executor
76-
* @param preSyncTask a function which returns a task to run before event pre-dispatch hook
77-
* @param postSyncTask a function which returns a task to run after event post-dispatch hook
78-
* @param <T> a type of event fired on the mod-specific event bus
87+
* @param progressBar a progress meter for tracking progress
88+
* @param preSyncTask a function which returns a task to run before event pre-dispatch hook
89+
* @param postSyncTask a function which returns a task to run after event post-dispatch hook
7990
* @return a transition task for this state
8091
*/
8192
<T extends Event & IModBusEvent>
8293
Optional<CompletableFuture<Void>> buildTransition(final Executor syncExecutor,
8394
final Executor parallelExecutor,
95+
final ProgressMeter progressBar,
8496
final Function<Executor, CompletableFuture<Void>> preSyncTask,
8597
final Function<Executor, CompletableFuture<Void>> postSyncTask);
8698
}

forge/fmlcore/src/main/java/net/minecraftforge/fml/IModStateTransition.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import net.minecraftforge.eventbus.api.Event;
99
import net.minecraftforge.fml.event.IModBusEvent;
10+
import net.minecraftforge.fml.loading.progress.ProgressMeter;
1011

1112
import java.util.ArrayList;
1213
import java.util.List;
@@ -24,20 +25,26 @@ static IModStateTransition buildNoopTransition() {
2425
}
2526

2627
default <T extends Event & IModBusEvent>
27-
CompletableFuture<Void> build(final Executor syncExecutor,
28+
CompletableFuture<Void> build(final String name,
29+
final Executor syncExecutor,
2830
final Executor parallelExecutor,
31+
final ProgressMeter progressBar,
2932
final Function<Executor, CompletableFuture<Void>> preSyncTask,
3033
final Function<Executor, CompletableFuture<Void>> postSyncTask) {
3134
List<CompletableFuture<Void>> futures = new ArrayList<>();
3235

3336
this.eventFunctionStream().get()
3437
.map(f -> (EventGenerator<T>) f)
35-
.reduce((head, tail) -> addCompletableFutureTaskForModDispatch(syncExecutor, parallelExecutor, futures, head, ModLoadingStage::currentState, tail))
36-
.ifPresent(last -> addCompletableFutureTaskForModDispatch(syncExecutor, parallelExecutor, futures, last, nextModLoadingStage(), null));
38+
.reduce((head, tail) -> addCompletableFutureTaskForModDispatch(syncExecutor, parallelExecutor, futures, progressBar, head, ModLoadingStage::currentState, tail))
39+
.ifPresent(last -> addCompletableFutureTaskForModDispatch(syncExecutor, parallelExecutor, futures, progressBar, last, nextModLoadingStage(), null));
3740

3841
final CompletableFuture<Void> preSyncTaskCF = preSyncTask.apply(syncExecutor);
3942
final CompletableFuture<Void> eventDispatchCF = ModList.gather(futures).thenCompose(ModList::completableFutureFromExceptionList);
4043
final CompletableFuture<Void> postEventDispatchCF = preSyncTaskCF
44+
.thenApplyAsync(n -> {
45+
progressBar.label(progressBar.name() + ": dispatching "+name);
46+
return null;
47+
}, parallelExecutor)
4148
.thenComposeAsync(n -> eventDispatchCF, parallelExecutor)
4249
.thenApply(r -> {
4350
postSyncTask.apply(syncExecutor);
@@ -54,6 +61,7 @@ default BiFunction<ModLoadingStage, Throwable, ModLoadingStage> nextModLoadingSt
5461
EventGenerator<T> addCompletableFutureTaskForModDispatch(final Executor syncExecutor,
5562
final Executor parallelExecutor,
5663
final List<CompletableFuture<Void>> completableFutures,
64+
final ProgressMeter progressBar,
5765
final EventGenerator<T> eventGenerator,
5866
final BiFunction<ModLoadingStage, Throwable, ModLoadingStage> nextState,
5967
final EventGenerator<T> nextGenerator) {
@@ -62,7 +70,7 @@ EventGenerator<T> addCompletableFutureTaskForModDispatch(final Executor syncExec
6270
var preDispatchHook = (BiFunction<Executor, EventGenerator<T>, CompletableFuture<Void>>) preDispatchHook();
6371
completableFutures.add(preDispatchHook.apply(selectedExecutor, eventGenerator));
6472

65-
completableFutures.add(ModList.get().futureVisitor(eventGenerator, nextState).apply(threadSelector().apply(syncExecutor, parallelExecutor)));
73+
completableFutures.add(ModList.get().futureVisitor(eventGenerator, progressBar, nextState).apply(threadSelector().apply(syncExecutor, parallelExecutor)));
6674

6775
var postDispatchHook = (BiFunction<Executor, EventGenerator<T>, CompletableFuture<Void>>) postDispatchHook();
6876
completableFutures.add(postDispatchHook.apply(selectedExecutor, eventGenerator));

forge/fmlcore/src/main/java/net/minecraftforge/fml/ModContainer.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import net.minecraftforge.fml.config.IConfigEvent;
1010
import net.minecraftforge.fml.config.ModConfig;
1111
import net.minecraftforge.fml.event.IModBusEvent;
12+
import net.minecraftforge.fml.loading.progress.ProgressMeter;
1213
import net.minecraftforge.forgespi.language.IModInfo;
1314

1415
import java.util.EnumMap;
@@ -113,6 +114,7 @@ public ModLoadingStage getCurrentState()
113114
public static <T extends Event & IModBusEvent> CompletableFuture<Void> buildTransitionHandler(
114115
final ModContainer target,
115116
final IModStateTransition.EventGenerator<T> eventGenerator,
117+
final ProgressMeter progressBar,
116118
final BiFunction<ModLoadingStage, Throwable, ModLoadingStage> stateChangeHandler,
117119
final Executor executor) {
118120
return CompletableFuture
@@ -123,6 +125,7 @@ public static <T extends Event & IModBusEvent> CompletableFuture<Void> buildTran
123125
}, executor)
124126
.whenComplete((mc, exception) -> {
125127
target.modLoadingStage = stateChangeHandler.apply(target.modLoadingStage, exception);
128+
progressBar.increment();
126129
ModLoadingContext.get().setActiveContainer(null);
127130
});
128131
}

forge/fmlcore/src/main/java/net/minecraftforge/fml/ModList.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import net.minecraftforge.eventbus.api.Event;
99
import net.minecraftforge.fml.event.IModBusEvent;
10+
import net.minecraftforge.fml.loading.progress.ProgressMeter;
1011
import net.minecraftforge.forgespi.language.IModFileInfo;
1112
import net.minecraftforge.forgespi.language.IModInfo;
1213
import net.minecraftforge.forgespi.language.ModFileScanData;
@@ -114,10 +115,11 @@ public IModFileInfo getModFileById(String modid)
114115

115116
<T extends Event & IModBusEvent> Function<Executor, CompletableFuture<Void>> futureVisitor(
116117
final IModStateTransition.EventGenerator<T> eventGenerator,
118+
final ProgressMeter progressBar,
117119
final BiFunction<ModLoadingStage, Throwable, ModLoadingStage> stateChange) {
118120
return executor -> gather(
119121
this.mods.stream()
120-
.map(mod -> ModContainer.buildTransitionHandler(mod, eventGenerator, stateChange, executor))
122+
.map(mod -> ModContainer.buildTransitionHandler(mod, eventGenerator, progressBar, stateChange, executor))
121123
.collect(Collectors.toList()))
122124
.thenComposeAsync(ModList::completableFutureFromExceptionList, executor);
123125
}

0 commit comments

Comments
 (0)