diff --git a/src/main/java/net/fabricmc/loom/extension/LoomGradleExtensionApiImpl.java b/src/main/java/net/fabricmc/loom/extension/LoomGradleExtensionApiImpl.java index 85ec3c187..c7b5b4e57 100644 --- a/src/main/java/net/fabricmc/loom/extension/LoomGradleExtensionApiImpl.java +++ b/src/main/java/net/fabricmc/loom/extension/LoomGradleExtensionApiImpl.java @@ -127,7 +127,7 @@ public abstract class LoomGradleExtensionApiImpl implements LoomGradleExtensionA // Architectury Loom // =================== private Provider platform; - private boolean silentMojangMappingsLicense = false; + private final Property silentMojangMappingsLicense; public Boolean generateSrgTiny = null; private final List tasksBeforeRun = Collections.synchronizedList(new ArrayList<>()); public final List> settingsPostEdit = new ArrayList<>(); @@ -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 @@ -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