diff --git a/libraries/java/Claritas.jar b/libraries/java/Claritas.jar index 29ed747..619fa03 100644 Binary files a/libraries/java/Claritas.jar and b/libraries/java/Claritas.jar differ diff --git a/src/model/struct/model/module/module.struct.ts b/src/model/struct/model/module/module.struct.ts index f383cc4..548b236 100644 --- a/src/model/struct/model/module/module.struct.ts +++ b/src/model/struct/model/module/module.struct.ts @@ -126,6 +126,36 @@ export abstract class ModuleStructure extends BaseModelStructure { } + protected async invokeClaritas(moduleCandidates: ModuleCandidate[]): Promise { + if(this.getClaritasType() != null) { + const claritasExecutor = new ClaritasWrapper() + + let claritasCandidates = moduleCandidates + const exceptionCandidates: [ModuleCandidate, ClaritasException][] = [] + for(const exception of this.getClaritasExceptions()) { + const exceptionCandidate = moduleCandidates.find((value) => value.file.toLowerCase().indexOf(exception.exceptionName) > -1) + if(exceptionCandidate != null) { + exceptionCandidates.push([exceptionCandidate, exception]) + claritasCandidates = claritasCandidates.filter((value) => value.file.toLowerCase().indexOf(exception.exceptionName) === -1) + } + } + + this.claritasResult = await claritasExecutor.execute( + this.getClaritasType()!, + this.minecraftVersion, + claritasCandidates.map(entry => entry.filePath) + ) + + if(this.claritasResult == null) { + this.logger.error('Failed to process Claritas result!') + } else { + for(const [candidate, exception] of exceptionCandidates) { + this.claritasResult[candidate.filePath] = exception.proxyMetadata + } + } + } + } + protected async _doModuleRetrieval(moduleCandidates: ModuleCandidate[], options?: { preProcess?: (candidate: ModuleCandidate) => void postProcess?: (module: Module) => void @@ -135,33 +165,8 @@ export abstract class ModuleStructure extends BaseModelStructure { if(moduleCandidates.length > 0) { - // Invoke Claritas - if(this.getClaritasType() != null) { - const claritasExecutor = new ClaritasWrapper() - - let claritasCandidates = moduleCandidates - const exceptionCandidates: [ModuleCandidate, ClaritasException][] = [] - for(const exception of this.getClaritasExceptions()) { - const exceptionCandidate = moduleCandidates.find((value) => value.file.toLowerCase().indexOf(exception.exceptionName) > -1) - if(exceptionCandidate != null) { - exceptionCandidates.push([exceptionCandidate, exception]) - claritasCandidates = claritasCandidates.filter((value) => value.file.toLowerCase().indexOf(exception.exceptionName) === -1) - } - } - - this.claritasResult = await claritasExecutor.execute( - this.getClaritasType()!, - this.minecraftVersion, - claritasCandidates.map(entry => entry.filePath) - ) - if(this.claritasResult == null) { - this.logger.error('Failed to process Claritas result!') - } else { - for(const [candidate, exception] of exceptionCandidates) { - this.claritasResult[candidate.filePath] = exception.proxyMetadata - } - } - } + // Invoke Claritas and attach result to class. + await this.invokeClaritas(moduleCandidates) // Process Modules for(const candidate of moduleCandidates) {