Don't warn about mcdev data files that aren't being modified (#241)

This commit is contained in:
Jake Potrebic 2024-04-29 15:49:55 -07:00 committed by GitHub
parent 3711175570
commit 381e557a2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -45,7 +45,8 @@ object McDev {
val (javaPatchLines, dataPatchLines) = readPatchLines(patches)
decompJar.openZip().use { zipFile ->
val decompFiles = mutableSetOf<String>()
val decompSourceFiles = mutableSetOf<String>()
val decompDataFiles = mutableSetOf<String>()
zipFile.walk().use { stream ->
for (zipEntry in stream) {
@ -53,7 +54,10 @@ object McDev {
val path = zipEntry.invariantSeparatorsPathString.substring(1)
if (path.endsWith(".java")) {
decompFiles += path
decompSourceFiles += path
}
if (path.startsWith("data/")) {
decompDataFiles += path
}
// pull in all package-info classes
@ -70,9 +74,14 @@ object McDev {
}
}
val exactJavaImports = javaPatchLines.filter { decompFiles.contains(it) }
val exactJavaImports = javaPatchLines.filter { decompSourceFiles.contains(it) }
.map { targetDir.resolve(it) }
val exactDataImports = if (dataTargetDir != null) dataPatchLines.map { dataTargetDir.resolve("data/minecraft/$it") } else listOf()
val exactDataImports = if (dataTargetDir != null) {
dataPatchLines.map { "data/minecraft/$it" }.filter { decompDataFiles.contains(it) }
.map { dataTargetDir.resolve(it) }
} else {
listOf()
}
val (additionalSrcImports, additionalDataImports) = readAdditionalImports(importsFile)