Record Class ModLoadingState

java.lang.Object
java.lang.Record
net.minecraftforge.fml.ModLoadingState
Record Components:
name - the name of this state
previous - the name of the state immediately previous to this state
message - a function returning a human-friendly message for this state
phase - the mod loading phase this state belongs to
inlineRunnable - an optional runnable, which runs before starting the transition from this state to the next
transition - 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 Details

  • Constructor Details

  • 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 interface IModLoadingState
      Type Parameters:
      T - a type of event fired on the mod-specific event bus
      Parameters:
      syncExecutor - a synchronous executor
      parallelExecutor - a parallel executor
      progressBar - a progress meter for tracking progress
      preSyncTask - a function which returns a task to run before event pre-dispatch hook
      postSyncTask - a function which returns a task to run after event post-dispatch hook
      Returns:
      a transition task for this state
    • empty

      public static ModLoadingState empty(String name, String previous, ModLoadingPhase phase)
      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 state
      previous - the name of the immediately previous state to this state
      phase - 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 of Processing transition [name].
      Parameters:
      name - the name of the state
      previous - the name of the immediately previous state to this state
      phase - the mod loading phase the state belongs to
      transition - 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 state
      previous - the name of the immediately previous state to this state
      message - a function returning a human-friendly message for this state
      phase - the mod loading phase the state belongs to
      transition - 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 of Processing work [name].
      Parameters:
      name - the name of the state
      previous - the name of the immediately previous state to this state
      phase - the mod loading phase the state belongs to
      inline - 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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Specified by:
      name in interface IModLoadingState
      Returns:
      the value of the name record component
    • previous

      public String previous()
      Returns the value of the previous record component.
      Specified by:
      previous in interface IModLoadingState
      Returns:
      the value of the previous record component
    • message

      public Function<ModList,String> message()
      Returns the value of the message record component.
      Specified by:
      message in interface IModLoadingState
      Returns:
      the value of the message record component
    • size

      public ToIntFunction<ModList> size()
      Returns the value of the size record component.
      Specified by:
      size in interface IModLoadingState
      Returns:
      the value of the size record component
    • phase

      public ModLoadingPhase phase()
      Returns the value of the phase record component.
      Specified by:
      phase in interface IModLoadingState
      Returns:
      the value of the phase record component
    • inlineRunnable

      public Optional<Consumer<ModList>> inlineRunnable()
      Returns the value of the inlineRunnable record component.
      Specified by:
      inlineRunnable in interface IModLoadingState
      Returns:
      the value of the inlineRunnable record component
      See Also:
    • transition

      public Optional<IModStateTransition> transition()
      Returns the value of the transition record component.
      Returns:
      the value of the transition record component