3838import java .util .HashMap ;
3939
4040public 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