@@ -59,6 +59,10 @@ abstract class ApplyServerSourceAndNmsPatches : BaseTask() {
59
59
if (paperDecompiledSource.isPresent && Files .notExists(nmsFile)) {
60
60
nmsFile = paperDecompiledSource.file(fileName).get().path
61
61
}
62
+ if (Files .notExists(nmsFile)) {
63
+ // we add new files within src/main/resources/data/minecraft/ but they don't exist in the nms source
64
+ return @forEach
65
+ }
62
66
val patchFile = patchDir.resolve(fileName).resolveSibling((patchedFile.name + " .patch" )) // keep extension
63
67
64
68
val commandText =
@@ -85,9 +89,9 @@ abstract class ApplyServerSourceAndNmsPatches : BaseTask() {
85
89
val patchName = patch.name.split(" -" , limit = 2 )[1 ]
86
90
println (" Applying Patch: $patchName " )
87
91
val excludeArray = directoriesToPatch.get().map { " --exclude=$it /**" }.toTypedArray()
88
- git(" am" , " --ignore-whitespace" , * excludeArray, patch.toPath().absolutePathString()).execute()
92
+ git(" am" , " --ignore-whitespace" , " --include=src/main/resources/data/minecraft/datapacks/paper/** " , * excludeArray, " --include=** " , patch.toPath().absolutePathString()).execute()
89
93
val includeArray = directoriesToPatch.get().map { " --include=$it /**" }.toTypedArray()
90
- git(" apply" , " --ignore-whitespace" , * includeArray, patch.toPath().absolutePathString()).execute()
94
+ git(" apply" , " --ignore-whitespace" , " --exclude=src/main/resources/data/minecraft/datapacks/paper/** " , * includeArray, patch.toPath().absolutePathString()).execute()
91
95
92
96
val (sourceFiles, dataFiles) = McDev .readPatchLines(listOf (patch.toPath()))
93
97
createPerFileDiff(sourcePatchesDir, sourceFiles, " src/main/java/" )
0 commit comments