Skip to content

Commit

Permalink
Add a module porting progress indicator to ZetaModuleManager
Browse files Browse the repository at this point in the history
  • Loading branch information
quat1024 committed Oct 28, 2023
1 parent cd86669 commit 891a217
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/main/java/vazkii/zeta/module/ZetaModuleManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;

import net.minecraftforge.fml.loading.FMLEnvironment;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -122,14 +120,22 @@ public void load(ModuleFinder finder) {
for(TentativeModule t : tentative)
modulesByKey.put(t.keyClass(), constructAndSetup(t));

//Just for fun
int count = modulesByKey.size();
int nonLegacyCount = count - legacyModuleCount;
String percentNonLegacy = String.format("%.2f", ((float) nonLegacyCount / count) * 100f);
z.log.info("Constructed {} modules, of which {} are legacy @LoadModules. Module porting is {}% done.", modulesByKey.size(), legacyModuleCount, percentNonLegacy);

z.loadBus.fire(new ZModulesReady());
}

int legacyModuleCount = 0;
private ZetaModule constructAndSetup(TentativeModule t) {
boolean isLegacy = t.clazz().isAnnotationPresent(LoadModule.class); //as opposed to ZetaLoadModule
if(isLegacy)
if(isLegacy) {
z.log.info("Constructing module {}... (LEGACY MODULE)", t.displayName());
else
legacyModuleCount++;
} else
z.log.info("Constructing module {}...", t.displayName());

//construct, set properties
Expand Down

0 comments on commit 891a217

Please sign in to comment.