Package net.minecraftforge.fml
Record Class ModLoadingState
java.lang.Object
java.lang.Record
net.minecraftforge.fml.ModLoadingState
- Record Components:
name- the name of this stateprevious- the name of the state immediately previous to this statemessage- a function returning a human-friendly message for this statephase- the mod loading phase this state belongs toinlineRunnable- an optional runnable, which runs before starting the transition from this state to the nexttransition- optional state transition information
- All Implemented Interfaces:
IModLoadingState
public record ModLoadingState(String name, String previous, Function<ModList,String> message, ModLoadingPhase phase, Optional<Consumer<ModList>> inlineRunnable, Optional<IModStateTransition> transition)
extends Record
implements IModLoadingState
Implementation of the
IModLoadingState interface.-
Field Summary
FieldsModifier and TypeFieldDescriptionThe field for theinlineRunnablerecord component.The field for themessagerecord component.private final StringThe field for thenamerecord component.private final ModLoadingPhaseThe field for thephaserecord component.private final StringThe field for thepreviousrecord component.private final Optional<IModStateTransition>The field for thetransitionrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionModLoadingState(String name, String previous, Function<ModList, String> message, ModLoadingPhase phase, Optional<Consumer<ModList>> inlineRunnable, Optional<IModStateTransition> transition) Creates an instance of aModLoadingStaterecord class. -
Method Summary
Modifier and TypeMethodDescription<T extends net.minecraftforge.eventbus.api.Event & IModBusEvent>
Optional<CompletableFuture<Void>>buildTransition(Executor syncExecutor, Executor parallelExecutor, Function<Executor, CompletableFuture<Void>> preSyncTask, Function<Executor, CompletableFuture<Void>> postSyncTask) Builds the transition task for this state.static ModLoadingStateempty(String name, String previous, ModLoadingPhase phase) Returns an empty mod loading state.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theinlineRunnablerecord component.message()Returns the value of themessagerecord component.name()Returns the value of thenamerecord component.phase()Returns the value of thephaserecord component.previous()Returns the value of thepreviousrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thetransitionrecord component.static ModLoadingStatewithInline(String name, String previous, ModLoadingPhase phase, Consumer<ModList> inline) Returns a mod loading state with an inline runnable and a default human-friendly message ofProcessing work [name].static ModLoadingStatewithTransition(String name, String previous, Function<ModList, String> message, ModLoadingPhase phase, IModStateTransition transition) Returns a mod loading state with state transition information and a custom human-friendly message function.static ModLoadingStatewithTransition(String name, String previous, ModLoadingPhase phase, IModStateTransition transition) Returns a mod loading state with state transition information and a default human-friendly message ofProcessing transition [name].Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraftforge.fml.IModLoadingState
buildTransition
-
Field Details
-
name
The field for thenamerecord component. -
previous
The field for thepreviousrecord component. -
message
The field for themessagerecord component. -
phase
The field for thephaserecord component. -
inlineRunnable
The field for theinlineRunnablerecord component. -
transition
The field for thetransitionrecord component.
-
-
Constructor Details
-
ModLoadingState
public ModLoadingState(String name, String previous, Function<ModList, String> message, ModLoadingPhase phase, Optional<Consumer<ModList>> inlineRunnable, Optional<IModStateTransition> transition) Creates an instance of aModLoadingStaterecord class.- Parameters:
name- the value for thenamerecord componentprevious- the value for thepreviousrecord componentmessage- the value for themessagerecord componentphase- the value for thephaserecord componentinlineRunnable- the value for theinlineRunnablerecord componenttransition- the value for thetransitionrecord component
-
-
Method Details
-
buildTransition
public <T extends net.minecraftforge.eventbus.api.Event & IModBusEvent> Optional<CompletableFuture<Void>> buildTransition(Executor syncExecutor, Executor parallelExecutor, Function<Executor, CompletableFuture<Void>> preSyncTask, Function<Executor, CompletableFuture<Void>> postSyncTask) Description copied from interface:IModLoadingStateBuilds the transition task for this state. The pre-sync and post-sync task functions allow the transition builder to run these tasks on the same executor as the actual event dispatch and pre/post hooks.- Specified by:
buildTransitionin interfaceIModLoadingState- Type Parameters:
T- a type of event fired on the mod-specific event bus- Parameters:
syncExecutor- a synchronous executorparallelExecutor- a parallel executorpreSyncTask- a function which returns a task to run before event pre-dispatch hookpostSyncTask- a function which returns a task to run after event post-dispatch hook- Returns:
- a transition task for this state
-
empty
Returns an empty mod loading state. The mod loading state has a blank human-readable message, no inline runnable, and no state transition information.- Parameters:
name- the name of the stateprevious- the name of the immediately previous state to this statephase- the mod loading phase the state belongs to- Returns:
- an empty mod loading state
-
withTransition
public static ModLoadingState withTransition(String name, String previous, ModLoadingPhase phase, IModStateTransition transition) Returns a mod loading state with state transition information and a default human-friendly message ofProcessing transition [name].- Parameters:
name- the name of the stateprevious- the name of the immediately previous state to this statephase- the mod loading phase the state belongs totransition- the state transition information- Returns:
- a mod loading state with state transition information and a default message
-
withTransition
public static ModLoadingState withTransition(String name, String previous, Function<ModList, String> message, ModLoadingPhase phase, IModStateTransition transition) Returns a mod loading state with state transition information and a custom human-friendly message function.- Parameters:
name- the name of the stateprevious- the name of the immediately previous state to this statemessage- a function returning a human-friendly message for this statephase- the mod loading phase the state belongs totransition- the state transition information- Returns:
- a mod loading state with state transition information and a custom message
-
withInline
public static ModLoadingState withInline(String name, String previous, ModLoadingPhase phase, Consumer<ModList> inline) Returns a mod loading state with an inline runnable and a default human-friendly message ofProcessing work [name].- Parameters:
name- the name of the stateprevious- the name of the immediately previous state to this statephase- the mod loading phase the state belongs toinline- an optional runnable, which runs before starting the transition from this state to the next- Returns:
- a mod loading state with an inline runnable and default message
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
name
Returns the value of thenamerecord component.- Specified by:
namein interfaceIModLoadingState- Returns:
- the value of the
namerecord component
-
previous
Returns the value of thepreviousrecord component.- Specified by:
previousin interfaceIModLoadingState- Returns:
- the value of the
previousrecord component
-
message
Returns the value of themessagerecord component.- Specified by:
messagein interfaceIModLoadingState- Returns:
- the value of the
messagerecord component
-
phase
Returns the value of thephaserecord component.- Specified by:
phasein interfaceIModLoadingState- Returns:
- the value of the
phaserecord component
-
inlineRunnable
Returns the value of theinlineRunnablerecord component.- Specified by:
inlineRunnablein interfaceIModLoadingState- Returns:
- the value of the
inlineRunnablerecord component - See Also:
-
transition
Returns the value of thetransitionrecord component.- Returns:
- the value of the
transitionrecord component
-