diff --git a/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/mm/ApplyServerSourceAndNmsPatches.kt b/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/mm/ApplyServerSourceAndNmsPatches.kt index d8eaccc..33783df 100644 --- a/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/mm/ApplyServerSourceAndNmsPatches.kt +++ b/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/mm/ApplyServerSourceAndNmsPatches.kt @@ -59,6 +59,10 @@ abstract class ApplyServerSourceAndNmsPatches : BaseTask() { if (paperDecompiledSource.isPresent && Files.notExists(nmsFile)) { nmsFile = paperDecompiledSource.file(fileName).get().path } + if (Files.notExists(nmsFile)) { + // we add new files within src/main/resources/data/minecraft/ but they don't exist in the nms source + return@forEach + } val patchFile = patchDir.resolve(fileName).resolveSibling((patchedFile.name + ".patch")) // keep extension val commandText = @@ -85,9 +89,9 @@ abstract class ApplyServerSourceAndNmsPatches : BaseTask() { val patchName = patch.name.split("-", limit = 2)[1] println("Applying Patch: $patchName") val excludeArray = directoriesToPatch.get().map { "--exclude=$it/**" }.toTypedArray() - git("am", "--ignore-whitespace", *excludeArray, patch.toPath().absolutePathString()).execute() + git("am", "--ignore-whitespace", "--include=src/main/resources/data/minecraft/datapacks/paper/**", *excludeArray, "--include=**", patch.toPath().absolutePathString()).execute() val includeArray = directoriesToPatch.get().map { "--include=$it/**" }.toTypedArray() - git("apply", "--ignore-whitespace", *includeArray, patch.toPath().absolutePathString()).execute() + git("apply", "--ignore-whitespace", "--exclude=src/main/resources/data/minecraft/datapacks/paper/**", *includeArray, patch.toPath().absolutePathString()).execute() val (sourceFiles, dataFiles) = McDev.readPatchLines(listOf(patch.toPath())) createPerFileDiff(sourcePatchesDir, sourceFiles, "src/main/java/") diff --git a/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/mm/filterrepo/FinalizePaperHistory.kt b/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/mm/filterrepo/FinalizePaperHistory.kt index 845f137..7d3459e 100644 --- a/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/mm/filterrepo/FinalizePaperHistory.kt +++ b/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/mm/filterrepo/FinalizePaperHistory.kt @@ -32,18 +32,13 @@ abstract class FinalizePaperHistory : BaseTask() { @TaskAction fun run() { Git.checkForGit() + val deletionsArr = deletions.get().toTypedArray() + if (deletionsArr.isEmpty()) { + return + } Git(paperDir).let { git -> - val paperMojangApi = outputDir.path.resolve("Paper-MojangAPI/src/main/java") - paperMojangApi.copyRecursivelyTo(outputDir.path.resolve("paper-api/src/main/java")) - paperMojangApi.deleteRecursive() - git("add", "paper-api/src/main/java", "Paper-MojangAPI").execute() - git("commit", "--message", "Merge Paper-MojangAPI into Paper API", "--author=Automated ").execute() - - val deletionsArr = deletions.get().toTypedArray() - if (deletionsArr.isNotEmpty()) { - git("rm", "-r", *deletionsArr).execute() - git("commit", "-m", "OWW! That fork is HARD!", "--author=Automated ").execute() - } + git("rm", "-r", *deletionsArr).execute() + git("commit", "-m", "OWW! That fork is HARD!", "--author=Automated ").execute() } } }