File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
src/main/java/me/piitex/renjava Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,29 @@ protected void init() {
109109 this .registerData (PLAYER );
110110 this .registerData (TRACKS );
111111 new RenLoader (this );
112- ADDONLOADER = new AddonLoader ();
112+ }
113+
114+ public void reload (boolean resetGraphics ) {
115+ // Reloads the game. Do not call unless you know what you are doing.
116+ PLAYER = null ;
117+ TRACKS = null ;
118+ EVENTHANDLER .getRegisteredListeners ().clear ();
119+ registeredCharacters .clear ();
120+ registeredData .clear ();
121+ ADDONLOADER .disable ();
122+ ADDONLOADER = null ;
123+
124+ gameWindow .clear ();
125+ gameWindow .render ();
126+
127+ // Re-initialize.
128+ init ();
129+
130+ if (resetGraphics ) {
131+ gameWindow .getStage ().setOnHiding (null );
132+ gameWindow .getStage ().hide ();
133+ new GuiLoader (gameWindow .getStage (), this , hostServices );
134+ }
113135 }
114136
115137 public String getName () {
You can’t perform that action at this time.
0 commit comments