mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-22 14:19:42 +00:00
Fix this stupid message once and for all, closes #107
This commit is contained in:
1 parent
6a82a617f6
commit
2060164ec8
2 files changed
+34
-5
No files matched your search
@@ -26,6 +26,7 @@ package org.spongepowered.asm.mixin.transformer;
|
||||
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -464,12 +465,21 @@ class MixinConfig implements Comparable<MixinConfig>, IMixinConfig {
|
||||
String defaultGroup = this.injectorOptions.defaultGroup;
|
||||
return defaultGroup != null && !defaultGroup.isEmpty() ? defaultGroup : "default";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the number of mixins in this config, for debug logging
|
||||
*
|
||||
* @return total enumerated mixins in set
|
||||
*/
|
||||
int getDeclaredMixinCount() {
|
||||
return MixinConfig.getCollectionSize(this.mixinClasses, this.mixinClassesClient, this.mixinClassesServer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of mixins actually initialised, for debug logging
|
||||
*
|
||||
* @return total enumerated mixins in set
|
||||
*/
|
||||
int getMixinCount() {
|
||||
return this.mixins.size();
|
||||
}
|
||||
@@ -648,4 +658,14 @@ class MixinConfig implements Comparable<MixinConfig>, IMixinConfig {
|
||||
}
|
||||
}
|
||||
|
||||
private static int getCollectionSize(Collection<?>... collections) {
|
||||
int total = 0;
|
||||
for (Collection<?> collection : collections) {
|
||||
if (collection != null) {
|
||||
total += collection.size();
|
||||
}
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -486,12 +486,14 @@ public class MixinTransformer extends TreeTransformer {
|
||||
|
||||
this.addConfigs(environment);
|
||||
this.addModules(environment);
|
||||
this.initConfigs();
|
||||
int totalMixins = this.initConfigs();
|
||||
this.currentEnvironment = environment;
|
||||
|
||||
double elapsedTime = (System.currentTimeMillis() - startTime) * 0.001D;
|
||||
if (elapsedTime > 0.25D) {
|
||||
this.logger.log(this.verboseLoggingLevel, "Mixin preparation completed in {} sec", new DecimalFormat("###0.000").format(elapsedTime));
|
||||
String elapsed = new DecimalFormat("###0.000").format(elapsedTime);
|
||||
String perMixinTime = new DecimalFormat("###0.0").format((elapsedTime / totalMixins) * 1000.0);
|
||||
this.logger.log(this.verboseLoggingLevel, "Prepared {} mixins in {} sec ({} msec avg.)", totalMixins, elapsed, perMixinTime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -541,12 +543,17 @@ public class MixinTransformer extends TreeTransformer {
|
||||
|
||||
/**
|
||||
* Initialise mixin configs
|
||||
*
|
||||
* @return total number of mixins initialised
|
||||
*/
|
||||
private void initConfigs() {
|
||||
private int initConfigs() {
|
||||
int totalMixins = 0;
|
||||
|
||||
for (MixinConfig config : this.pendingConfigs) {
|
||||
try {
|
||||
this.logger.log(this.verboseLoggingLevel, "Preparing {} ({})", config, config.getDeclaredMixinCount());
|
||||
config.initialise(this.hotSwapper);
|
||||
this.logger.log(this.verboseLoggingLevel, "Prepared {} ({})", config, config.getMixinCount());
|
||||
totalMixins += config.getMixinCount();
|
||||
} catch (Exception ex) {
|
||||
this.logger.error("Error encountered whilst initialising mixin config '" + config.getName() + "': " + ex.getMessage(), ex);
|
||||
}
|
||||
@@ -579,6 +586,8 @@ public class MixinTransformer extends TreeTransformer {
|
||||
this.configs.addAll(this.pendingConfigs);
|
||||
Collections.sort(this.configs);
|
||||
this.pendingConfigs.clear();
|
||||
|
||||
return totalMixins;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user