mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-02 13:37:45 -05:00
Make mojang mappings stable by implementing a custom license supplier
Signed-off-by: shedaniel <daniel@shedaniel.me>
This commit is contained in:
@@ -82,12 +82,6 @@ configurations.all {
|
||||
}
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
failOnNonReproducibleResolution()
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation gradleApi()
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public record MojangMappingLayer(MinecraftVersionMeta.Download clientDownload,
|
||||
MinecraftVersionMeta.Download serverDownload,
|
||||
File workingDir,
|
||||
Logger logger,
|
||||
BooleanSupplier silenceLicense) implements MappingLayer {
|
||||
MojangMappingsSpec.SilenceLicenseOption silenceLicense) implements MappingLayer {
|
||||
@Override
|
||||
public void visit(MappingVisitor mappingVisitor) throws IOException {
|
||||
var clientMappings = new File(workingDir(), "client.txt");
|
||||
@@ -57,7 +57,7 @@ public record MojangMappingLayer(MinecraftVersionMeta.Download clientDownload,
|
||||
|
||||
download(clientMappings, serverMappings);
|
||||
|
||||
if (!silenceLicense.getAsBoolean()) {
|
||||
if (!silenceLicense.isSilent()) {
|
||||
printMappingsLicense(clientMappings.toPath());
|
||||
}
|
||||
|
||||
|
||||
@@ -24,21 +24,51 @@
|
||||
|
||||
package net.fabricmc.loom.configuration.providers.mappings.mojmap;
|
||||
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
import net.fabricmc.loom.configuration.providers.mappings.MappingContext;
|
||||
import net.fabricmc.loom.configuration.providers.mappings.MappingsSpec;
|
||||
import net.fabricmc.loom.configuration.providers.minecraft.MinecraftVersionMeta;
|
||||
|
||||
public record MojangMappingsSpec(BooleanSupplier silenceLicense) implements MappingsSpec<MojangMappingLayer> {
|
||||
public record MojangMappingsSpec(SilenceLicenseOption silenceLicense) implements MappingsSpec<MojangMappingLayer> {
|
||||
// Keys in dependency manifest
|
||||
private static final String MANIFEST_CLIENT_MAPPINGS = "client_mappings";
|
||||
private static final String MANIFEST_SERVER_MAPPINGS = "server_mappings";
|
||||
|
||||
public MojangMappingsSpec(SilenceLicenseSupplier supplier) {
|
||||
this(new SilenceLicenseOption(supplier));
|
||||
}
|
||||
|
||||
public MojangMappingsSpec() {
|
||||
this(() -> false);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface SilenceLicenseSupplier {
|
||||
boolean isSilent();
|
||||
}
|
||||
|
||||
public record SilenceLicenseOption(SilenceLicenseSupplier supplier) {
|
||||
public boolean isSilent() {
|
||||
return supplier.isSilent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof SilenceLicenseOption that)) return false;
|
||||
return isSilent() == that.isSilent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Boolean.hashCode(isSilent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return isSilent() + "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MojangMappingLayer createLayer(MappingContext context) {
|
||||
MinecraftVersionMeta versionInfo = context.minecraftProvider().getVersionInfo();
|
||||
|
||||
Reference in New Issue
Block a user