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, ToIntFunction<ModList> size, ModLoadingPhase phase, Optional<Consumer<ModList>> inlineRunnable, Optional<IModStateTransition> transition)
extends Record
implements IModLoadingState
Implementation of the
IModLoadingState
interface.-
Field Summary
Modifier and TypeFieldDescriptionThe field for theinlineRunnable
record component.The field for themessage
record component.private final String
The field for thename
record component.private final ModLoadingPhase
The field for thephase
record component.private final String
The field for theprevious
record component.private final ToIntFunction
<ModList> The field for thesize
record component.private final Optional
<IModStateTransition> The field for thetransition
record component. -
Constructor Summary
ConstructorDescriptionModLoadingState
(String name, String previous, Function<ModList, String> message, ToIntFunction<ModList> size, ModLoadingPhase phase, Optional<Consumer<ModList>> inlineRunnable, Optional<IModStateTransition> transition) Creates an instance of aModLoadingState
record class. -
Method Summary
Modifier and TypeMethodDescription<T extends net.minecraftforge.eventbus.api.Event & IModBusEvent>
Optional<CompletableFuture<Void>> buildTransition
(Executor syncExecutor, Executor parallelExecutor, ProgressMeter progressBar, Function<Executor, CompletableFuture<Void>> preSyncTask, Function<Executor, CompletableFuture<Void>> postSyncTask) Builds the transition task for this state.static ModLoadingState
empty
(String name, String previous, ModLoadingPhase phase) Returns an empty mod loading state.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.Returns the value of theinlineRunnable
record component.message()
Returns the value of themessage
record component.name()
Returns the value of thename
record component.phase()
Returns the value of thephase
record component.previous()
Returns the value of theprevious
record component.size()
Returns the value of thesize
record component.final String
toString()
Returns a string representation of this record class.Returns the value of thetransition
record component.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]
.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.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]
.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraftforge.fml.IModLoadingState
buildTransition
-
Field Details
-
name
The field for thename
record component. -
previous
The field for theprevious
record component. -
message
The field for themessage
record component. -
size
The field for thesize
record component. -
phase
The field for thephase
record component. -
inlineRunnable
The field for theinlineRunnable
record component. -
transition
The field for thetransition
record component.
-
-
Constructor Details
-
ModLoadingState
public ModLoadingState(String name, String previous, Function<ModList, String> message, ToIntFunction<ModList> size, ModLoadingPhase phase, Optional<Consumer<ModList>> inlineRunnable, Optional<IModStateTransition> transition) Creates an instance of aModLoadingState
record class.- Parameters:
name
- the value for thename
record componentprevious
- the value for theprevious
record componentmessage
- the value for themessage
record componentsize
- the value for thesize
record componentphase
- the value for thephase
record componentinlineRunnable
- the value for theinlineRunnable
record componenttransition
- the value for thetransition
record component
-
-
Method Details
-
buildTransition
public <T extends net.minecraftforge.eventbus.api.Event & IModBusEvent> Optional<CompletableFuture<Void>> buildTransition(Executor syncExecutor, Executor parallelExecutor, ProgressMeter progressBar, Function<Executor, CompletableFuture<Void>> preSyncTask, Function<Executor, CompletableFuture<Void>> postSyncTask) Description copied from interface:IModLoadingState
Builds 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:
buildTransition
in interfaceIModLoadingState
- Type Parameters:
T
- a type of event fired on the mod-specific event bus- Parameters:
syncExecutor
- a synchronous executorparallelExecutor
- a parallel executorprogressBar
- a progress meter for tracking progresspreSyncTask
- 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 thename
record component.- Specified by:
name
in interfaceIModLoadingState
- Returns:
- the value of the
name
record component
-
previous
Returns the value of theprevious
record component.- Specified by:
previous
in interfaceIModLoadingState
- Returns:
- the value of the
previous
record component
-
message
Returns the value of themessage
record component.- Specified by:
message
in interfaceIModLoadingState
- Returns:
- the value of the
message
record component
-
size
Returns the value of thesize
record component.- Specified by:
size
in interfaceIModLoadingState
- Returns:
- the value of the
size
record component
-
phase
Returns the value of thephase
record component.- Specified by:
phase
in interfaceIModLoadingState
- Returns:
- the value of the
phase
record component
-
inlineRunnable
Returns the value of theinlineRunnable
record component.- Specified by:
inlineRunnable
in interfaceIModLoadingState
- Returns:
- the value of the
inlineRunnable
record component - See Also:
-
transition
Returns the value of thetransition
record component.- Returns:
- the value of the
transition
record component
-