Skip to content

Commit 7e897d7

Browse files
committed
Fix incorrect userdev config values
1 parent 66c235b commit 7e897d7

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/main/groovy/net/minecraftforge/forgedev/ForgeDevExtension.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ private void setup(ForgeDevPlugin plugin, Project project) {
429429
//UserDev Config Default Values
430430
userdevConfig.configure(task -> {
431431
task.getMCPConfig().set(legacyMcp.getConfig());
432-
task.getBinpatcherVersion().set("net.minecraft:binarypatcher:" + Constants.BINPATCH_VERSION + ":fatjar");
432+
task.getBinpatcherVersion().convention("net.minecraftforge:binarypatcher:" + Constants.BINPATCH_VERSION + ":fatjar");
433433
task.getBinpatcherArguments().addAll("--clean", "{clean}", "--output", "{output}", "--apply", "{patch}");
434434
task.getUniversal().convention(universalJar.flatMap(t ->
435435
t.getArchiveBaseName().flatMap(baseName ->
@@ -443,8 +443,8 @@ private void setup(ForgeDevPlugin plugin, Project project) {
443443
t.getArchiveExtension().map(jarExt ->
444444
project.getGroup().toString() + ':' + baseName + ':' + project.getVersion() + ':' + classifier + '@' + jarExt
445445
)))));
446-
task.getPatchesOriginalPrefix().convention(genPatches.flatMap(GeneratePatches::getBasePathPrefix));
447-
task.getPatchesModifiedPrefix().convention(genPatches.flatMap(GeneratePatches::getModifiedPathPrefix));
446+
task.getPatchesOriginalPrefix().set(genPatches.flatMap(GeneratePatches::getBasePathPrefix));
447+
task.getPatchesModifiedPrefix().set(genPatches.flatMap(GeneratePatches::getModifiedPathPrefix));
448448
task.getNotchObf().set(legacyPatcher.getNotchObf());
449449
});
450450

src/main/groovy/net/minecraftforge/forgedev/tasks/generation/GeneratePatcherConfigV2.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
import java.util.HashMap;
3939

4040
public abstract class GeneratePatcherConfigV2 extends DefaultTask implements ForgeDevTask {
41+
private static final String DEFAULT_PATCHES_PREFIX_ORIGINAL = "a/";
42+
private static final String DEFAULT_PATCHES_PREFIX_MODIFIED = "b/";
43+
4144
public abstract @OutputFile RegularFileProperty getOutput();
4245

4346
public abstract @Input @Optional Property<PatcherConfig.V2.DataFunction> getProcessor();
@@ -75,8 +78,8 @@ public abstract class GeneratePatcherConfigV2 extends DefaultTask implements For
7578
public GeneratePatcherConfigV2() {
7679
this.getOutput().convention(this.getDefaultOutputFile("json"));
7780

78-
this.getPatchesOriginalPrefix().convention("a/");
79-
this.getPatchesModifiedPrefix().convention("b/");
81+
this.getPatchesOriginalPrefix().convention(DEFAULT_PATCHES_PREFIX_ORIGINAL);
82+
this.getPatchesModifiedPrefix().convention(DEFAULT_PATCHES_PREFIX_MODIFIED);
8083
this.getSourceFileEncoding().convention(StandardCharsets.UTF_8.name());
8184
this.getInject().convention("inject/");
8285
this.getPatches().convention("patches/");
@@ -114,8 +117,8 @@ protected void exec() throws IOException {
114117
v2.modules = this.getModules().get();
115118
if (v2.modules.isEmpty()) v2.modules = null;
116119
v2.processor = this.getProcessor().getOrNull();
117-
v2.patchesOriginalPrefix = this.getPatchesOriginalPrefix().filter(Util.IS_NOT_BLANK).getOrNull();
118-
v2.patchesModifiedPrefix = this.getPatchesModifiedPrefix().filter(Util.IS_NOT_BLANK).getOrNull();
120+
v2.patchesOriginalPrefix = this.getPatchesOriginalPrefix().filter(Util.IS_NOT_BLANK).getOrElse(DEFAULT_PATCHES_PREFIX_ORIGINAL);
121+
v2.patchesModifiedPrefix = this.getPatchesModifiedPrefix().filter(Util.IS_NOT_BLANK).getOrElse(DEFAULT_PATCHES_PREFIX_MODIFIED);
119122
v2.notchObf = this.getNotchObf().filter(b -> b).getOrNull();
120123
v2.sourceFileCharset = this.getSourceFileEncoding().filter(Util.IS_NOT_BLANK).getOrNull();
121124
v2.universalFilters = this.getUniversalFilters().get();
@@ -133,8 +136,8 @@ private boolean isV2() {
133136
return this.getNotchObf().getOrElse(false)
134137
|| this.getProcessor().isPresent()
135138
|| this.getUniversalFilters().isPresent()
136-
|| !"a/".equals(getPatchesOriginalPrefix().get())
137-
|| !"b/".equals(getPatchesModifiedPrefix().get());
139+
|| !"a/".equals(getPatchesOriginalPrefix().getOrNull())
140+
|| !"b/".equals(getPatchesModifiedPrefix().getOrNull());
138141
}
139142

140143
public void runs(Action<? super NamedDomainObjectContainer<? extends RunConfig>> action) {

0 commit comments

Comments
 (0)