Skip to content

Commit

Permalink
Finalize silentMojangMappingsLicense on read, close #203
Browse files Browse the repository at this point in the history
  • Loading branch information
shedaniel committed Apr 5, 2024
1 parent 6497070 commit 06111ac
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public abstract class LoomGradleExtensionApiImpl implements LoomGradleExtensionA
// Architectury Loom
// ===================
private Provider<ModPlatform> platform;
private boolean silentMojangMappingsLicense = false;
private final Property<Boolean> silentMojangMappingsLicense;
public Boolean generateSrgTiny = null;
private final List<String> tasksBeforeRun = Collections.synchronizedList(new ArrayList<>());
public final List<Consumer<RunConfig>> settingsPostEdit = new ArrayList<>();
Expand Down Expand Up @@ -215,6 +215,8 @@ protected LoomGradleExtensionApiImpl(Project project, LoomFiles directories) {

return ModPlatform.FABRIC;
})::get);
this.silentMojangMappingsLicense = project.getObjects().property(Boolean.class).convention(false);
this.silentMojangMappingsLicense.finalizeValueOnRead();
}

@Override
Expand Down Expand Up @@ -489,12 +491,16 @@ public FileCollection getNamedMinecraftJars() {

@Override
public void silentMojangMappingsLicense() {
this.silentMojangMappingsLicense = true;
try {
this.silentMojangMappingsLicense.set(true);
} catch (IllegalStateException e) {
throw new IllegalStateException("loom.silentMojangMappingsLicense() must be called before its value is read, usually with loom.layered {}.", e);
}
}

@Override
public boolean isSilentMojangMappingsLicenseEnabled() {
return silentMojangMappingsLicense;
return silentMojangMappingsLicense.get();
}

@Override
Expand Down

0 comments on commit 06111ac

Please sign in to comment.