Fix problem with duplicate mods caused by duplicate classes found during scan.
File Scan results are now sets. Signed-off-by: cpw <cpw+github@weeksfamily.ca>
This commit is contained in:
parent
dd7e7fc122
commit
7f1ea578d6
4 changed files with 10 additions and 3 deletions
|
@ -291,7 +291,7 @@ project(':forge') {
|
|||
installer 'cpw.mods:modlauncher:0.11.+'
|
||||
installer 'net.minecraftforge:accesstransformers:0.15.+:shadowed'
|
||||
installer 'net.minecraftforge:eventbus:0.8.+:service'
|
||||
installer 'net.minecraftforge:forgespi:0.8.+'
|
||||
installer 'net.minecraftforge:forgespi:0.10.+'
|
||||
installer 'net.minecraftforge:coremods:0.4.+'
|
||||
installer 'net.minecraftforge:unsafe:0.2.+'
|
||||
installer 'com.electronwill.night-config:core:3.4.2'
|
||||
|
|
|
@ -75,7 +75,7 @@ public class ModClassVisitor extends ClassVisitor
|
|||
return new ModMethodVisitor(name, desc, annotations);
|
||||
}
|
||||
|
||||
public void buildData(final List<ModFileScanData.ClassData> classes, final List<ModFileScanData.AnnotationData> annotations) {
|
||||
public void buildData(final Set<ModFileScanData.ClassData> classes, final Set<ModFileScanData.AnnotationData> annotations) {
|
||||
classes.add(new ModFileScanData.ClassData(this.asmType, this.asmSuperType, this.interfaces));
|
||||
final List<ModFileScanData.AnnotationData> collect = this.annotations.stream().
|
||||
filter(ma->ModFileScanData.interestingAnnotations().test(ma.asmType)).
|
||||
|
|
|
@ -57,6 +57,7 @@ public class ModFile
|
|||
private final String jarVersion;
|
||||
private Map<String, Object> fileProperties;
|
||||
private IModLanguageProvider loader;
|
||||
private Throwable scanError;
|
||||
|
||||
public void setFileProperties(Map<String, Object> fileProperties)
|
||||
{
|
||||
|
@ -159,12 +160,18 @@ public class ModFile
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (this.scanError != null) {
|
||||
throw new RuntimeException(this.scanError);
|
||||
}
|
||||
return this.fileModFileScanData;
|
||||
}
|
||||
|
||||
public void setScanResult(final ModFileScanData modFileScanData, final Throwable throwable) {
|
||||
this.futureScanResult = null;
|
||||
this.fileModFileScanData = modFileScanData;
|
||||
if (throwable != null) {
|
||||
this.scanError = throwable;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -95,7 +95,7 @@ public class FMLJavaModLanguageProvider implements IModLanguageProvider
|
|||
.filter(ad -> ad.getAnnotationType().equals(MODANNOTATION))
|
||||
.peek(ad -> LOGGER.debug(SCAN, "Found @Mod class {} with id {}", ad.getClassType().getClassName(), ad.getAnnotationData().get("value")))
|
||||
.map(ad -> new FMLModTarget(ad.getClassType().getClassName(), (String)ad.getAnnotationData().get("value")))
|
||||
.collect(Collectors.toMap(FMLModTarget::getModId, Function.identity()));
|
||||
.collect(Collectors.toMap(FMLModTarget::getModId, Function.identity(), (a,b)->a));
|
||||
scanResult.addLanguageLoader(modTargetMap);
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue