Package net.minheur.potoflux
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
FieldsModifier and TypeFieldDescriptionstatic FXPotoScreenThe actual app.
This contains the JFrame and will be instantiated when the app will run.static final StringThe ID for potoflux (namespace)Fields inherited from class javafx.application.Application
STYLESHEET_CASPIAN, STYLESHEET_MODENA -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull ResourceLocationPotoFlux's reserved method to get aResourceLocationdirectly with PotoFlux's modId.static @NotNull PathGetter for the mod common folder in the appData folder.
Mods should use this to resolve their modIds: this will be their own appData folderstatic @NotNull PathGetter for the main program AppData folder.static @Nullable StringGetter for the app's version.
If unable to get the version, return null.static voidThe main method, that runs PotoFlux.
It defines the uncaught exception handler, then runsApplication.launch(java.lang.Class<? extends javafx.application.Application>, java.lang.String...)static voidrunExitLogic(@NotNull ExitCode exitCode) Runs the logic on exit, saves things and launches close action runs if exit code is0.
This allows the app to run extra saving code before exiting.static voidrunProgramKill(ExitCode exitCode) This method should be used to kill the app.
Used when crashing the app mainlyvoidstart(javafx.stage.Stage primaryStage) The entry point for Potoflux's UI.voidstop()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
-
Field Details
-
ID
The ID for potoflux (namespace)- See Also:
-
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 aTask(making sure it won't freeze the app). It finally createsFXPotoScreenif the bootstrap succeeded- Specified by:
startin classjavafx.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:
stopin classjavafx.application.Application
-
main
The main method, that runs PotoFlux.
It defines the uncaught exception handler, then runsApplication.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
Getter for the main program AppData folder.- Returns:
- the program's appData folder
-
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
This method should be used to kill the app.
Used when crashing the app mainly- Parameters:
exitCode- the code given on closing.
-
runExitLogic
Runs the logic on exit, saves things and launches close action runs if exit code is0.
This allows the app to run extra saving code before exiting.- Parameters:
exitCode- the code given on closing.
-
getVersion
Getter for the app's version.
If unable to get the version, return null.- Returns:
- the app version
-
fromModId
PotoFlux's reserved method to get aResourceLocationdirectly with PotoFlux's modId.- Parameters:
loc- the loc to add to the modId- Returns:
- a built
ResourceLocationwith potoflux's modId and the loc given
-