Skip to content

Commit 0ef2faf

Browse files
authored
Set aPrefix and bPrefix when building patch operation (#749)
1 parent ee38053 commit 0ef2faf

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/userdev/java/net/minecraftforge/gradle/userdev/MinecraftUserRepo.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,15 +1031,28 @@ private File findPatched(boolean generate) throws IOException {
10311031
byte[] lastPatched = FileUtils.readFileToByteArray(decomp);
10321032
for (Patcher p : parents) {
10331033
ByteArrayOutputStream bout = new ByteArrayOutputStream();
1034-
CliOperation.Result<PatchOperation.PatchesSummary> result = PatchOperation.builder()
1034+
PatchOperation.Builder opBuilder = PatchOperation.builder()
10351035
.logTo(new LoggingOutputStream(project.getLogger(), LogLevel.LIFECYCLE))
10361036
.basePath(lastPatched, ArchiveFormat.ZIP)
10371037
.patchesPath(p.getZip().toPath())
10381038
.patchesPrefix(p.getPatches())
10391039
.outputPath(bout, ArchiveFormat.ZIP)
10401040
.mode(PatchMode.ACCESS)
10411041
.verbose(DEBUG)
1042-
.summary(DEBUG)
1042+
.summary(DEBUG);
1043+
// Note that pre-1.13 patches use ../{src-base,src-work}/minecraft/ prefixes
1044+
// instead of the default {a,b}/ prefixes. Also, be sure not to override the
1045+
// defaults with null values.
1046+
UserdevConfigV2 cfg = p.getConfigV2();
1047+
if (cfg != null) {
1048+
if (cfg.patchesOriginalPrefix != null) {
1049+
opBuilder = opBuilder.aPrefix(cfg.patchesOriginalPrefix);
1050+
}
1051+
if (cfg.patchesModifiedPrefix != null) {
1052+
opBuilder = opBuilder.bPrefix(cfg.patchesModifiedPrefix);
1053+
}
1054+
}
1055+
CliOperation.Result<PatchOperation.PatchesSummary> result = opBuilder
10431056
.build()
10441057
.operate();
10451058
failed = result.exit != 0;

0 commit comments

Comments
 (0)