mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 19:15:32 +00:00
Forge 1.19
* Bump pack.mcmeta formats * 1.19 biome modifiers * Mark ClientPlayerNetworkEvent.LoggedOutEvent's getters as nullable * Add docs and package-info to client extension interfaces package * Move RenderBlockOverlayEvent hooks to ForgeHooksClient * Add package-infos to client events package * Rename SoundLoadEvent to SoundEngineLoadEvent This reduces confusion from consumers which may think the name SoundLoadEvent refers to an individual sound being loaded rather than the sound engine. * Document and change SoundLoadEvent to fire on mod bus Previously, it fired on both the mod bus and the Forge bus, which is confusing for consumers. * Delete SoundSetupEvent Looking at its original implementation shows that there isn't an appropriate place in the new sound code to reinsert the event, and the place of 'sound engine/manager initialization event' is taken already by SoundLoadEvent. * Perform some cleanup on client events - Removed nullable annotations from ClientPlayerNetworkEvent - Renamed #getPartialTicks methods to #getPartialTick, to be consistent with vanilla's naming of the partial tick - Cleanup documentation to remove line breaks, use the spelling 'cancelled' over 'canceled', and improve docs on existing and new methods. * Remove EntityEvent.CanUpdate Closes MinecraftForge/MinecraftForge#6394 * Switch to Jetbrains nullability annotations * New PlayLevelSoundEvent; replaces old PlaySoundAtEntityEvent * Remove ForgeWorldPresetScreens * Remove IForgeRegistryEntry * Remove use of List<Throwable> in FML's CompletableFutures * Add docs to mod loading stages, stages, and phases * Gradle 7.4.2 * Use SLF4J in FMLLoader and other subprojects * Switch dynamic versions in subprojects to pinned ones * Switch ForgeRoot and MDK to FG plugin markers * Configure Forge javadoc task The task now uses a custom stylesheet with MCForge elements, and configured to combine the generation from the four FML subprojects (fmlloader, fmlcore, javafmllanguage, mclanguage) and the Forge project into the javadoc output. * Update docs/md files, for 1.19 update and the move away from IRC to Discord. * Make "Potentially dangerous alternative prefix" a debug warning, not info. Co-authored-by: Curle <[email protected]> Co-authored-by: sciwhiz12 <[email protected]> Signed-off-by: SizableShrimp <[email protected]>
This commit is contained in:
1 parent
270e778ac5
commit
4ed9117799
1485 files changed
+14960
-15446
No files matched your search
@@ -25,20 +25,114 @@ import net.minecraftforge.fml.loading.FMLPaths;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Provider for the core FML mod loading states.
|
||||
*/
|
||||
public class ModStateProvider implements IModStateProvider {
|
||||
final ModLoadingState ERROR = ModLoadingState.empty("ERROR", "", ModLoadingPhase.ERROR);
|
||||
private final ModLoadingState VALIDATE = ModLoadingState.empty("VALIDATE", "", ModLoadingPhase.GATHER);
|
||||
final ModLoadingState CONSTRUCT = ModLoadingState.withTransition("CONSTRUCT", "VALIDATE", ml->"Constructing %d mods".formatted(ml.size()), ModLoadingPhase.GATHER, new ParallelTransition(ModLoadingStage.CONSTRUCT, FMLConstructModEvent.class));
|
||||
private final ModLoadingState CONFIG_LOAD = ModLoadingState.withInline("CONFIG_LOAD", "", ModLoadingPhase.LOAD, ml->{
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, ()->()-> ConfigTracker.INSTANCE.loadConfigs(ModConfig.Type.CLIENT, FMLPaths.CONFIGDIR.get()));
|
||||
ConfigTracker.INSTANCE.loadConfigs(ModConfig.Type.COMMON, FMLPaths.CONFIGDIR.get());
|
||||
});
|
||||
private final ModLoadingState COMMON_SETUP = ModLoadingState.withTransition("COMMON_SETUP", "CONFIG_LOAD", ModLoadingPhase.LOAD, new ParallelTransition(ModLoadingStage.COMMON_SETUP, FMLCommonSetupEvent.class));
|
||||
private final ModLoadingState SIDED_SETUP = ModLoadingState.withTransition("SIDED_SETUP", "COMMON_SETUP", ModLoadingPhase.LOAD, new ParallelTransition(ModLoadingStage.SIDED_SETUP, DistExecutor.unsafeRunForDist(()->()-> FMLClientSetupEvent.class, ()->()-> FMLDedicatedServerSetupEvent.class)));
|
||||
private final ModLoadingState ENQUEUE_IMC = ModLoadingState.withTransition("ENQUEUE_IMC", "", ModLoadingPhase.COMPLETE, new ParallelTransition(ModLoadingStage.ENQUEUE_IMC, InterModEnqueueEvent.class));
|
||||
private final ModLoadingState PROCESS_IMC = ModLoadingState.withTransition("PROCESS_IMC", "ENQUEUE_IMC",ModLoadingPhase.COMPLETE, new ParallelTransition(ModLoadingStage.PROCESS_IMC, InterModProcessEvent.class));
|
||||
private final ModLoadingState COMPLETE = ModLoadingState.withTransition("COMPLETE", "PROCESS_IMC", ml->"completing load of %d mods".formatted(ml.size()), ModLoadingPhase.COMPLETE, new ParallelTransition(ModLoadingStage.COMPLETE, FMLLoadCompleteEvent.class));
|
||||
private final ModLoadingState DONE = ModLoadingState.empty("DONE", "", ModLoadingPhase.DONE);
|
||||
/**
|
||||
* The special mod loading state for exceptional situations and error handling.
|
||||
*
|
||||
* @see ModLoadingPhase#ERROR
|
||||
*/
|
||||
final ModLoadingState ERROR = ModLoadingState.empty("ERROR", "",
|
||||
ModLoadingPhase.ERROR);
|
||||
|
||||
/**
|
||||
* First {@linkplain ModLoadingPhase#GATHER gathering state}, for the validation of the mod list.
|
||||
* TODO: figure out where this is used and why this exists instead of CONSTRUCT being the first state
|
||||
*/
|
||||
private final ModLoadingState VALIDATE = ModLoadingState.empty("VALIDATE", "",
|
||||
ModLoadingPhase.GATHER);
|
||||
|
||||
/**
|
||||
* {@linkplain ModLoadingPhase#GATHER Gathering state} after {@linkplain #VALIDATE validation}, for the construction
|
||||
* of mod containers and their backing mod instances.
|
||||
*
|
||||
* @see FMLConstructModEvent
|
||||
* @see ModLoadingStage#CONSTRUCT
|
||||
*/
|
||||
final ModLoadingState CONSTRUCT = ModLoadingState.withTransition("CONSTRUCT", "VALIDATE",
|
||||
ml -> "Constructing %d mods".formatted(ml.size()),
|
||||
ModLoadingPhase.GATHER,
|
||||
new ParallelTransition(ModLoadingStage.CONSTRUCT, FMLConstructModEvent.class));
|
||||
|
||||
/**
|
||||
* First {@linkplain ModLoadingPhase#LOAD loading state}, for loading of the common and (if applicable)
|
||||
* {@linkplain Dist#CLIENT client-side} mod configurations.
|
||||
*/
|
||||
private final ModLoadingState CONFIG_LOAD = ModLoadingState.withInline("CONFIG_LOAD", "",
|
||||
ModLoadingPhase.LOAD,
|
||||
ml -> {
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT,
|
||||
() -> () -> ConfigTracker.INSTANCE.loadConfigs(ModConfig.Type.CLIENT, FMLPaths.CONFIGDIR.get()));
|
||||
ConfigTracker.INSTANCE.loadConfigs(ModConfig.Type.COMMON, FMLPaths.CONFIGDIR.get());
|
||||
});
|
||||
|
||||
/**
|
||||
* {@linkplain ModLoadingPhase#LOAD Loading state} after {@linkplain #CONFIG_LOAD configuration loading}, for
|
||||
* common (non-side-specific) setup and initialization.
|
||||
*
|
||||
* @see FMLCommonSetupEvent
|
||||
* @see ModLoadingStage#COMMON_SETUP
|
||||
*/
|
||||
private final ModLoadingState COMMON_SETUP = ModLoadingState.withTransition("COMMON_SETUP", "CONFIG_LOAD",
|
||||
ModLoadingPhase.LOAD,
|
||||
new ParallelTransition(ModLoadingStage.COMMON_SETUP, FMLCommonSetupEvent.class));
|
||||
|
||||
/**
|
||||
* {@linkplain ModLoadingPhase#LOAD Loading state} after {@linkplain #COMMON_SETUP common setup}, for side-specific
|
||||
* setup and initialization.
|
||||
*
|
||||
* @see FMLClientSetupEvent
|
||||
* @see FMLDedicatedServerSetupEvent
|
||||
* @see ModLoadingStage#SIDED_SETUP
|
||||
*/
|
||||
private final ModLoadingState SIDED_SETUP = ModLoadingState.withTransition("SIDED_SETUP", "COMMON_SETUP",
|
||||
ModLoadingPhase.LOAD,
|
||||
new ParallelTransition(ModLoadingStage.SIDED_SETUP,
|
||||
DistExecutor.unsafeRunForDist(()->()-> FMLClientSetupEvent.class, ()->()-> FMLDedicatedServerSetupEvent.class)));
|
||||
|
||||
/**
|
||||
* First {@linkplain ModLoadingPhase#COMPLETE completion state}, for enqueuing {@link net.minecraftforge.fml.InterModComms}
|
||||
* messages.
|
||||
*
|
||||
* @see InterModEnqueueEvent
|
||||
* @see ModLoadingStage#ENQUEUE_IMC
|
||||
*/
|
||||
private final ModLoadingState ENQUEUE_IMC = ModLoadingState.withTransition("ENQUEUE_IMC", "",
|
||||
ModLoadingPhase.COMPLETE,
|
||||
new ParallelTransition(ModLoadingStage.ENQUEUE_IMC, InterModEnqueueEvent.class));
|
||||
|
||||
/**
|
||||
* {@linkplain ModLoadingPhase#COMPLETE Completion state} after {@linkplain #ENQUEUE_IMC}, for processing of messages
|
||||
* received through {@link net.minecraftforge.fml.InterModComms}.
|
||||
*
|
||||
* @see InterModProcessEvent
|
||||
* @see ModLoadingStage#PROCESS_IMC
|
||||
*/
|
||||
private final ModLoadingState PROCESS_IMC = ModLoadingState.withTransition("PROCESS_IMC", "ENQUEUE_IMC",
|
||||
ModLoadingPhase.COMPLETE,
|
||||
new ParallelTransition(ModLoadingStage.PROCESS_IMC, InterModProcessEvent.class));
|
||||
|
||||
/**
|
||||
* {@linkplain ModLoadingPhase#COMPLETE Completion state} after {@linkplain #PROCESS_IMC}, marking the completion
|
||||
* of the basic mod loading process; however, additional completion states may be present after this.
|
||||
*
|
||||
* @see FMLLoadCompleteEvent
|
||||
* @see ModLoadingStage#COMPLETE
|
||||
*/
|
||||
private final ModLoadingState COMPLETE = ModLoadingState.withTransition("COMPLETE", "PROCESS_IMC",
|
||||
ml -> "completing load of %d mods".formatted(ml.size()),
|
||||
ModLoadingPhase.COMPLETE,
|
||||
new ParallelTransition(ModLoadingStage.COMPLETE, FMLLoadCompleteEvent.class));
|
||||
|
||||
/**
|
||||
* The marker state for the completion of the full mod loading process.
|
||||
*
|
||||
* @see ModLoadingStage#DONE
|
||||
*/
|
||||
private final ModLoadingState DONE = ModLoadingState.empty("DONE", "",
|
||||
ModLoadingPhase.DONE);
|
||||
|
||||
@Override
|
||||
public List<IModLoadingState> getAllStates() {
|
||||
|
||||
@@ -12,8 +12,6 @@ import net.minecraftforge.fml.ModLoadingStage;
|
||||
import net.minecraftforge.fml.ThreadSelector;
|
||||
import net.minecraftforge.fml.event.lifecycle.ParallelDispatchEvent;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.function.BiFunction;
|
||||
@@ -32,7 +30,7 @@ record ParallelTransition(ModLoadingStage stage, Class<? extends ParallelDispatc
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiFunction<Executor, CompletableFuture<List<Throwable>>, CompletableFuture<List<Throwable>>> finalActivityGenerator() {
|
||||
public BiFunction<Executor, CompletableFuture<Void>, CompletableFuture<Void>> finalActivityGenerator() {
|
||||
return (e, prev) -> prev.thenApplyAsync(t -> {
|
||||
stage.getDeferredWorkQueue().runTasks();
|
||||
return t;
|
||||
@@ -40,12 +38,12 @@ record ParallelTransition(ModLoadingStage stage, Class<? extends ParallelDispatc
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiFunction<Executor, ? extends EventGenerator<?>, CompletableFuture<List<Throwable>>> preDispatchHook() {
|
||||
return (t, f) -> CompletableFuture.completedFuture(Collections.emptyList());
|
||||
public BiFunction<Executor, ? extends EventGenerator<?>, CompletableFuture<Void>> preDispatchHook() {
|
||||
return (t, f) -> CompletableFuture.completedFuture(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiFunction<Executor, ? extends EventGenerator<?>, CompletableFuture<List<Throwable>>> postDispatchHook() {
|
||||
return (t, f) -> CompletableFuture.completedFuture(Collections.emptyList());
|
||||
public BiFunction<Executor, ? extends EventGenerator<?>, CompletableFuture<Void>> postDispatchHook() {
|
||||
return (t, f) -> CompletableFuture.completedFuture(null);
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,8 @@ import java.util.function.Consumer;
|
||||
/**
|
||||
* This is the first of four commonly called events during mod initialization.
|
||||
*
|
||||
* Called before {@link FMLClientSetupEvent} or {@link FMLDedicatedServerSetupEvent} during mod startup.
|
||||
*
|
||||
* Called after {@link net.minecraftforge.event.RegistryEvent.Register} events have been fired.
|
||||
* Called after {@link net.minecraftforge.registries.RegisterEvent} events have been fired and before
|
||||
* {@link FMLClientSetupEvent} or {@link FMLDedicatedServerSetupEvent} during mod startup.
|
||||
*
|
||||
* Either register your listener using {@link net.minecraftforge.fml.javafmlmod.AutomaticEventSubscriber} and
|
||||
* {@link net.minecraftforge.eventbus.api.SubscribeEvent} or
|
||||
|
||||
Reference in new issue
Block a user