More cleanup

This commit is contained in:
Anuken 2019-12-14 20:49:55 -05:00
parent e043f4bb66
commit bcc8f65ac8
3 changed files with 10 additions and 8 deletions

View File

@ -123,7 +123,7 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform
for(ApplicationListener listener : modules){
listener.init();
}
mods.each(Mod::init);
mods.eachClass(Mod::init);
finished = true;
Events.fire(new ClientLoadEvent());
super.resize(graphics.getWidth(), graphics.getHeight());

View File

@ -243,13 +243,16 @@ public class Mods implements Loadable{
}
resolveModState();
//sort mods to make sure servers handle them properly.
mods.sort(Structs.comparing(m -> m.name));
sortMods();
buildFiles();
}
private void sortMods(){
//sort mods to make sure servers handle them properly.
mods.sort(Structs.comps(Structs.comparingInt(m -> -m.state.ordinal()), Structs.comparing(m -> m.name)));
}
private void resolveModState(){
mods.each(this::updateDependencies);
@ -483,6 +486,7 @@ public class Mods implements Loadable{
requiresReload = true;
mod.state = enabled ? ModState.enabled : ModState.disabled;
mods.each(this::updateDependencies);
sortMods();
}
}

View File

@ -2,7 +2,6 @@ package io.anuke.mindustry.ui.dialogs;
import io.anuke.arc.*;
import io.anuke.arc.Net.*;
import io.anuke.arc.collection.*;
import io.anuke.arc.files.*;
import io.anuke.arc.util.*;
import io.anuke.arc.util.io.*;
@ -110,11 +109,10 @@ public class ModsDialog extends FloatingDialog{
if(!mods.list().isEmpty()){
cont.pane(table -> {
table.margin(10f).top();
Array<LoadedMod> all = Array.withArrays(mods.all(), mods.disabled());
boolean anyDisabled = false;
for(LoadedMod mod : all){
if(!mod.enabled() && !anyDisabled && mods.all().size > 0){
for(LoadedMod mod : mods.list()){
if(!mod.enabled() && !anyDisabled && mods.list().size > 0){
anyDisabled = true;
table.row();
table.addImage().growX().height(4f).pad(6f).color(Pal.gray);