Skip to content

Commit

Permalink
add afterLoadContent() to Mod.java
Browse files Browse the repository at this point in the history
  • Loading branch information
zeutd committed Aug 27, 2024
1 parent 9a8c263 commit 9c8802c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/src/mindustry/mod/Mod.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@ public void init(){

}

/** Called on clientside mods. Load content here. */
/** Called on clientside mods. You can load content here. */
public void loadContent(){

}

/** Called on clientside mods after all mods loadContent() was called. You can load content here. */
public void afterLoadContent(){

}

/** Register any commands to be used on the server side, e.g. from the console. */
public void registerServerCommands(CommandHandler handler){

Expand Down
8 changes: 8 additions & 0 deletions core/src/mindustry/mod/Mods.java
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,14 @@ public void loadContent(){
}
}

for(LoadedMod mod : orderedMods()){
//hidden mods can't load content
if(mod.main != null && !mod.meta.hidden){
content.setCurrentMod(mod);
mod.main.afterLoadContent();
}
}

content.setCurrentMod(null);

class LoadRun implements Comparable<LoadRun>{
Expand Down

0 comments on commit 9c8802c

Please sign in to comment.