Class PrefabLoadingState

java.lang.Object
com.hypixel.hytale.builtin.buildertools.prefabeditor.PrefabLoadingState

public class PrefabLoadingState extends Object
Tracks the progress and state of prefab loading operations. Provides progress updates and error reporting to the UI.
  • Constructor Details

    • PrefabLoadingState

      public PrefabLoadingState()
      Default Constructor for a PrefabLoadingState instance.
  • Method Details

    • setTotalPrefabs

      public void setTotalPrefabs(int totalPrefabs)
      Sets the total number of prefabs to be loaded.
      Parameters:
      totalPrefabs - The total count of prefabs.
    • setPhase

      public void setPhase(@Nonnull PrefabLoadingState.Phase phase)
      Advances to the specified phase.
      Parameters:
      phase - The new phase.
    • onPrefabLoaded

      public void onPrefabLoaded(@Nullable Path path)
      Called when a prefab file has been loaded from disk.
      Parameters:
      path - The path of the loaded prefab.
    • onPrefabPasted

      public void onPrefabPasted(@Nullable Path path)
      Called when a prefab has been pasted into the world.
      Parameters:
      path - The path of the pasted prefab.
    • addError

      public void addError(@Nonnull PrefabLoadingState.LoadingError error)
      Records an error that occurred during loading.
      Parameters:
      error - The error to record.
    • addError

      public void addError(@Nonnull String translationKey)
      Records an error with a translation key.
      Parameters:
      translationKey - The translation key for the error message.
    • addError

      public void addError(@Nonnull String translationKey, @Nullable String details)
      Records an error with a translation key and details.
      Parameters:
      translationKey - The translation key for the error message.
      details - Additional details about the error.
    • getCurrentPhase

      @Nonnull public PrefabLoadingState.Phase getCurrentPhase()
      Returns:
      The current loading phase.
    • getTotalPrefabs

      public int getTotalPrefabs()
      Returns:
      The total number of prefabs to load.
    • getLoadedPrefabs

      public int getLoadedPrefabs()
      Returns:
      The number of prefabs loaded from disk.
    • getPastedPrefabs

      public int getPastedPrefabs()
      Returns:
      The number of prefabs pasted into the world.
    • getCurrentPrefabPath

      @Nullable public Path getCurrentPrefabPath()
      Returns:
      The path of the prefab currently being processed, or null if none.
    • getErrors

      @Nonnull public List<PrefabLoadingState.LoadingError> getErrors()
      Returns:
      All errors that occurred during loading.
    • hasErrors

      public boolean hasErrors()
      Returns:
      true if any errors have occurred.
    • isShuttingDown

      public boolean isShuttingDown()
      Returns:
      true if we are in a cancellation/shutdown phase.
    • isShutdownComplete

      public boolean isShutdownComplete()
      Returns:
      true if the shutdown process is complete.
    • getProgressPercentage

      public float getProgressPercentage()
      Returns:
      The overall progress as a percentage (0.0 to 1.0).
    • getElapsedTimeMillis

      public long getElapsedTimeMillis()
      Returns:
      The elapsed time in milliseconds since loading started.
    • getLastNotifyTimeNanos

      public long getLastNotifyTimeNanos()
      Returns:
      The last time a UI notification was sent, in nanoseconds.
    • setLastNotifyTimeNanos

      public void setLastNotifyTimeNanos(long nanos)
      Sets the last time a UI notification was sent.
      Parameters:
      nanos - The time in nanoseconds.
    • getStatusMessage

      @Nonnull public Message getStatusMessage()
      Returns:
      A human-readable status message for the current state.
    • markComplete

      public void markComplete()
      Marks the loading as complete.