Class PotoFlux

java.lang.Object
javafx.application.Application
net.minheur.potoflux.PotoFlux

public class PotoFlux extends javafx.application.Application
Main class for PotoFlux. This should be set as mainClass in Gradle.
  • Nested Class Summary

    Nested classes/interfaces inherited from class javafx.application.Application

    javafx.application.Application.Parameters
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The actual app.
    This contains the JFrame and will be instantiated when the app will run.
    static final String
    The ID for potoflux (namespace)

    Fields inherited from class javafx.application.Application

    STYLESHEET_CASPIAN, STYLESHEET_MODENA
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static @NotNull ResourceLocation
    PotoFlux's reserved method to get a ResourceLocation directly with PotoFlux's modId.
    static @NotNull Path
    Getter for the mod common folder in the appData folder.
    Mods should use this to resolve their modIds: this will be their own appData folder
    static @NotNull Path
    Getter for the main program AppData folder.
    static @Nullable String
    Getter for the app's version.
    If unable to get the version, return null.
    static void
    main(String[] args)
    The main method, that runs PotoFlux.
    It defines the uncaught exception handler, then runs Application.launch(java.lang.Class<? extends javafx.application.Application>, java.lang.String...)
    static void
    runExitLogic(@NotNull ExitCode exitCode)
    Runs the logic on exit, saves things and launches close action runs if exit code is 0.
    This allows the app to run extra saving code before exiting.
    static void
    This method should be used to kill the app.
    Used when crashing the app mainly
    void
    start(javafx.stage.Stage primaryStage)
    The entry point for Potoflux's UI.
    void
    When the app is closed normally in the JavaFX system, this gets called to run the exit logic.

    Methods inherited from class javafx.application.Application

    getHostServices, getParameters, getUserAgentStylesheet, init, launch, launch, notifyPreloader, setUserAgentStylesheet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ID

      public static final String ID
      The ID for potoflux (namespace)
      See Also:
    • app

      public static FXPotoScreen app
      The actual app.
      This contains the JFrame and will be instantiated when the app will run.
  • Constructor Details

    • PotoFlux

      public PotoFlux()
  • Method Details

    • start

      public void start(javafx.stage.Stage primaryStage)
      The entry point for Potoflux's UI. The start method is called after the init method has returned, and after the system is ready for the application to begin running.

      NOTE: This method is called on the JavaFX Application Thread.

      Will first display the FXLoadingScreen, then launch the bootstrap in a Task (making sure it won't freeze the app). It finally creates FXPotoScreen if the bootstrap succeeded

      Specified by:
      start in class javafx.application.Application
      Parameters:
      primaryStage - the primary stage for this application, onto which the application scene can be set. Applications may create other stages, if needed, but they will not be primary stages.
    • stop

      public void stop()
      When the app is closed normally in the JavaFX system, this gets called to run the exit logic.
      Overrides:
      stop in class javafx.application.Application
    • main

      public static void main(String[] args)
      The main method, that runs PotoFlux.
      It defines the uncaught exception handler, then runs Application.launch(java.lang.Class<? extends javafx.application.Application>, java.lang.String...)
      Parameters:
      args - what you give to the app. Can contain 'devEnv' to enable PotoFlux's dev mod
    • getProgramDir

      @NotNull public static @NotNull Path getProgramDir()
      Getter for the main program AppData folder.
      Returns:
      the program's appData folder
    • getModDataDir

      @NotNull public static @NotNull Path getModDataDir()
      Getter for the mod common folder in the appData folder.
      Mods should use this to resolve their modIds: this will be their own appData folder
      Returns:
      the shared appData folder for mods
    • runProgramKill

      public static void runProgramKill(ExitCode exitCode)
      This method should be used to kill the app.
      Used when crashing the app mainly
      Parameters:
      exitCode - the code given on closing.
    • runExitLogic

      public static void runExitLogic(@NotNull @NotNull ExitCode exitCode)
      Runs the logic on exit, saves things and launches close action runs if exit code is 0.
      This allows the app to run extra saving code before exiting.
      Parameters:
      exitCode - the code given on closing.
    • getVersion

      @Nullable public static @Nullable String getVersion()
      Getter for the app's version.
      If unable to get the version, return null.
      Returns:
      the app version
    • fromModId

      @Contract("_ -> new") @NotNull public static @NotNull ResourceLocation fromModId(String loc)
      PotoFlux's reserved method to get a ResourceLocation directly with PotoFlux's modId.
      Parameters:
      loc - the loc to add to the modId
      Returns:
      a built ResourceLocation with potoflux's modId and the loc given