Merge with Fabric 0.13, stage 1

This commit is contained in:
Juuz
2022-08-09 17:18:43 +03:00
20 changed files with 222 additions and 235 deletions

View File

@@ -27,15 +27,12 @@ package net.fabricmc.loom.util;
import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import com.google.gson.JsonObject;
import org.gradle.api.logging.Logger;
import org.jetbrains.annotations.Nullable;
import net.fabricmc.loom.LoomGradlePlugin;
public final class ModUtils {
private ModUtils() {
}
@@ -56,19 +53,11 @@ public final class ModUtils {
@Nullable
public static JsonObject getFabricModJson(Path path) {
final byte[] modJsonBytes;
try {
modJsonBytes = ZipUtils.unpackNullable(path, "fabric.mod.json");
return ZipUtils.unpackGsonNullable(path, "fabric.mod.json", JsonObject.class);
} catch (IOException e) {
throw new UncheckedIOException("Failed to extract fabric.mod.json from " + path, e);
}
if (modJsonBytes == null) {
return null;
}
return LoomGradlePlugin.GSON.fromJson(new String(modJsonBytes, StandardCharsets.UTF_8), JsonObject.class);
}
public static boolean shouldRemapMod(Logger logger, File input, Object id, ModPlatform platform, String config) {