Compare commits
No commits in common. "master" and "1.12.0" have entirely different histories.
@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("jfmod") version "1.6-SNAPSHOT"
|
id("jfmod") version "1.5-SNAPSHOT"
|
||||||
}
|
}
|
||||||
|
|
||||||
loom {
|
loom {
|
||||||
@ -9,14 +9,13 @@ loom {
|
|||||||
allprojects { group = "io.gitlab.jfronny" }
|
allprojects { group = "io.gitlab.jfronny" }
|
||||||
base.archivesName = "resclone"
|
base.archivesName = "resclone"
|
||||||
|
|
||||||
val modmenuVersion = "11.0.0-beta.1"
|
val fabricVersion = "0.91.1+1.20.4"
|
||||||
val commonsVersion = "2.0.0-SNAPSHOT"
|
val modmenuVersion = "9.0.0-pre.1"
|
||||||
jfMod {
|
jfMod {
|
||||||
minecraftVersion = "1.21"
|
minecraftVersion = "1.20.4"
|
||||||
yarn("build.1")
|
yarn("build.1")
|
||||||
loaderVersion = "0.15.11"
|
loaderVersion = "0.15.0"
|
||||||
libJfVersion = "3.16.0"
|
libJfVersion = "3.14.1"
|
||||||
fabricApiVersion = "0.100.1+1.21"
|
|
||||||
|
|
||||||
modrinth {
|
modrinth {
|
||||||
projectId = "resclone"
|
projectId = "resclone"
|
||||||
@ -29,19 +28,12 @@ jfMod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
include(modImplementation("io.gitlab.jfronny.libjf:libjf-base")!!) // for JfCommons
|
include(modImplementation("io.gitlab.jfronny.libjf:libjf-base:${jfMod.libJfVersion.get()}")!!) // for JfCommons
|
||||||
include(modImplementation("io.gitlab.jfronny.libjf:libjf-config-core-v2")!!) // for JfCommons
|
include(modImplementation("io.gitlab.jfronny.libjf:libjf-config-core-v2:${jfMod.libJfVersion.get()}")!!) // for JfCommons
|
||||||
include(modImplementation("net.fabricmc.fabric-api:fabric-resource-loader-v0")!!)
|
include(modImplementation(fabricApi.module("fabric-resource-loader-v0", fabricVersion))!!)
|
||||||
|
|
||||||
compileOnly("io.gitlab.jfronny:commons-serialize-generator-annotations:$commonsVersion")
|
|
||||||
annotationProcessor("io.gitlab.jfronny:commons-serialize-generator:$commonsVersion")
|
|
||||||
|
|
||||||
// Dev env
|
// Dev env
|
||||||
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-config-ui-tiny")
|
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-config-ui-tiny:${jfMod.libJfVersion.get()}")
|
||||||
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-devutil")
|
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-devutil:${jfMod.libJfVersion.get()}")
|
||||||
modLocalRuntime("com.terraformersmc:modmenu:$modmenuVersion")
|
modLocalRuntime("com.terraformersmc:modmenu:$modmenuVersion")
|
||||||
// for modmenu
|
|
||||||
modLocalRuntime("net.fabricmc.fabric-api:fabric-resource-loader-v0")
|
|
||||||
modLocalRuntime("net.fabricmc.fabric-api:fabric-screen-api-v1")
|
|
||||||
modLocalRuntime("net.fabricmc.fabric-api:fabric-key-binding-api-v1")
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package io.gitlab.jfronny.resclone;
|
package io.gitlab.jfronny.resclone;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.logger.SystemLoggerPlus;
|
import io.gitlab.jfronny.commons.logging.Logger;
|
||||||
|
import io.gitlab.jfronny.commons.serialize.gson.api.v2.GsonHolders;
|
||||||
import io.gitlab.jfronny.resclone.data.PackMetaLoaded;
|
import io.gitlab.jfronny.resclone.data.PackMetaLoaded;
|
||||||
import io.gitlab.jfronny.resclone.data.PackMetaUnloaded;
|
import io.gitlab.jfronny.resclone.data.PackMetaUnloaded;
|
||||||
import io.gitlab.jfronny.resclone.fetchers.*;
|
import io.gitlab.jfronny.resclone.fetchers.*;
|
||||||
@ -25,7 +26,7 @@ public class Resclone implements ModInitializer {
|
|||||||
public static final Set<PackMetaLoaded> NEW_PACKS = new LinkedHashSet<>(); // Client-only!
|
public static final Set<PackMetaLoaded> NEW_PACKS = new LinkedHashSet<>(); // Client-only!
|
||||||
|
|
||||||
public static final String MOD_ID = "resclone";
|
public static final String MOD_ID = "resclone";
|
||||||
public static final SystemLoggerPlus LOGGER = SystemLoggerPlus.forName(MOD_ID);
|
public static final Logger LOGGER = Logger.forName(MOD_ID);
|
||||||
public static final String USER_AGENT = "jfmods/" + MOD_ID + "/" + FabricLoader.getInstance()
|
public static final String USER_AGENT = "jfmods/" + MOD_ID + "/" + FabricLoader.getInstance()
|
||||||
.getModContainer(MOD_ID).orElseThrow()
|
.getModContainer(MOD_ID).orElseThrow()
|
||||||
.getMetadata()
|
.getMetadata()
|
||||||
@ -39,6 +40,7 @@ public class Resclone implements ModInitializer {
|
|||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
LOGGER.info("Initialising Resclone.");
|
LOGGER.info("Initialising Resclone.");
|
||||||
|
GsonHolders.registerSerializer();
|
||||||
|
|
||||||
urlCache = new PackUrlCache(getConfigPath().resolve("urlCache.properties"));
|
urlCache = new PackUrlCache(getConfigPath().resolve("urlCache.properties"));
|
||||||
FETCHER_INSTANCES.clear();
|
FETCHER_INSTANCES.clear();
|
||||||
@ -56,7 +58,7 @@ public class Resclone implements ModInitializer {
|
|||||||
}
|
}
|
||||||
reload();
|
reload();
|
||||||
|
|
||||||
LOGGER.info("Installed {0} resource pack{1}.", packCount, packCount == 1 ? "" : "s");
|
LOGGER.info("Installed {} resource pack{}.", packCount, packCount == 1 ? "" : "s");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addFetcher(PackFetcher fetcher) {
|
public void addFetcher(PackFetcher fetcher) {
|
||||||
@ -85,7 +87,9 @@ public class Resclone implements ModInitializer {
|
|||||||
LOGGER.info("No resclone pack was specified, add one");
|
LOGGER.info("No resclone pack was specified, add one");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
try (ExecutorService pool = Executors.newFixedThreadPool(RescloneConfig.packs.size())) {
|
try {
|
||||||
|
//TODO migrate this to try-with-resources once JVM is updated
|
||||||
|
ExecutorService pool = Executors.newFixedThreadPool(RescloneConfig.packs.size());
|
||||||
for (PackMetaUnloaded s : RescloneConfig.packs) {
|
for (PackMetaUnloaded s : RescloneConfig.packs) {
|
||||||
pool.submit(generateTask(s, metas));
|
pool.submit(generateTask(s, metas));
|
||||||
}
|
}
|
||||||
@ -107,15 +111,15 @@ public class Resclone implements ModInitializer {
|
|||||||
private Runnable generateTask(PackMetaUnloaded meta, Set<PackMetaLoaded> metas) {
|
private Runnable generateTask(PackMetaUnloaded meta, Set<PackMetaLoaded> metas) {
|
||||||
return () -> {
|
return () -> {
|
||||||
try {
|
try {
|
||||||
if (!FETCHER_INSTANCES.containsKey(meta.fetcher()))
|
if (!FETCHER_INSTANCES.containsKey(meta.fetcher))
|
||||||
throw new Exception("Invalid fetcher: " + meta.fetcher());
|
throw new Exception("Invalid fetcher: " + meta.fetcher);
|
||||||
Path cacheDir = getConfigPath().resolve("cache");
|
Path cacheDir = getConfigPath().resolve("cache");
|
||||||
PackMetaLoaded p;
|
PackMetaLoaded p;
|
||||||
try {
|
try {
|
||||||
boolean isNew = !urlCache.containsKey(meta.source());
|
boolean isNew = !urlCache.containsKey(meta.source);
|
||||||
//Download
|
//Download
|
||||||
PackFetcher.Result fr = FETCHER_INSTANCES.get(meta.fetcher()).get(meta.source(), cacheDir, meta.forceDownload());
|
PackFetcher.Result fr = FETCHER_INSTANCES.get(meta.fetcher).get(meta.source, cacheDir, meta.forceDownload);
|
||||||
p = new PackMetaLoaded(fr.downloadPath(), meta.name(), meta.forceEnable());
|
p = new PackMetaLoaded(fr.downloadPath(), meta.name, meta.forceEnable);
|
||||||
metas.add(p);
|
metas.add(p);
|
||||||
if (isNew && FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) NEW_PACKS.add(p);
|
if (isNew && FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) NEW_PACKS.add(p);
|
||||||
if (fr.freshDownload()) {
|
if (fr.freshDownload()) {
|
||||||
@ -135,7 +139,7 @@ public class Resclone implements ModInitializer {
|
|||||||
throw new Exception("Failed to download pack", e);
|
throw new Exception("Failed to download pack", e);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
LOGGER.error("Encountered issue while preparing " + meta.name(), e);
|
LOGGER.error("Encountered issue while preparing " + meta.name, e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,15 @@
|
|||||||
package io.gitlab.jfronny.resclone;
|
package io.gitlab.jfronny.resclone;
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import io.gitlab.jfronny.commons.serialize.MalformedDataException;
|
import io.gitlab.jfronny.commons.serialize.gson.api.v2.GsonHolders;
|
||||||
import io.gitlab.jfronny.commons.serialize.Token;
|
import io.gitlab.jfronny.gson.JsonParseException;
|
||||||
import io.gitlab.jfronny.commons.serialize.json.JsonReader;
|
import io.gitlab.jfronny.gson.stream.*;
|
||||||
import io.gitlab.jfronny.commons.serialize.json.JsonWriter;
|
|
||||||
import io.gitlab.jfronny.libjf.LibJf;
|
|
||||||
import io.gitlab.jfronny.libjf.config.api.v2.JfCustomConfig;
|
import io.gitlab.jfronny.libjf.config.api.v2.JfCustomConfig;
|
||||||
import io.gitlab.jfronny.libjf.config.api.v2.dsl.DSL;
|
import io.gitlab.jfronny.libjf.config.api.v2.dsl.DSL;
|
||||||
import io.gitlab.jfronny.resclone.data.GC_PackMetaUnloaded;
|
|
||||||
import io.gitlab.jfronny.resclone.data.PackMetaUnloaded;
|
import io.gitlab.jfronny.resclone.data.PackMetaUnloaded;
|
||||||
import io.gitlab.jfronny.resclone.util.ListAdaptation;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -29,6 +26,7 @@ public class RescloneConfig implements JfCustomConfig {
|
|||||||
private static final String PRUNE_UNUSED = "pruneUnused";
|
private static final String PRUNE_UNUSED = "pruneUnused";
|
||||||
private static final String FILTER_PACKS = "filterPacks";
|
private static final String FILTER_PACKS = "filterPacks";
|
||||||
private static final String LOG_PROCESSING = "logProcessing";
|
private static final String LOG_PROCESSING = "logProcessing";
|
||||||
|
private static final Type META_SET = new TypeToken<Set<PackMetaUnloaded>>(){}.getType();
|
||||||
|
|
||||||
private static void load(Path path) throws IOException {
|
private static void load(Path path) throws IOException {
|
||||||
if (!Files.exists(path)) {
|
if (!Files.exists(path)) {
|
||||||
@ -42,46 +40,42 @@ public class RescloneConfig implements JfCustomConfig {
|
|||||||
|
|
||||||
boolean updateRequired = false;
|
boolean updateRequired = false;
|
||||||
try (BufferedReader br = Files.newBufferedReader(path);
|
try (BufferedReader br = Files.newBufferedReader(path);
|
||||||
JsonReader reader = LibJf.LENIENT_TRANSPORT.createReader(br)) {
|
JsonReader reader = GsonHolders.CONFIG.getGson().newJsonReader(br)) {
|
||||||
if (reader.peek() == Token.BEGIN_ARRAY) {
|
if (reader.peek() == JsonToken.BEGIN_ARRAY) {
|
||||||
// Legacy format compatibility
|
// Legacy format compatibility
|
||||||
packs = ListAdaptation.deserializeSet(reader, GC_PackMetaUnloaded::deserialize);
|
packs = GsonHolders.CONFIG.getGson().fromJson(reader, META_SET);
|
||||||
updateRequired = true;
|
updateRequired = true;
|
||||||
} else if (reader.peek() == Token.BEGIN_OBJECT) {
|
} else if (reader.peek() == JsonToken.BEGIN_OBJECT) {
|
||||||
// New format
|
// New format
|
||||||
reader.beginObject();
|
reader.beginObject();
|
||||||
Set<PackMetaUnloaded> packs = null;
|
Set<PackMetaUnloaded> packs = null;
|
||||||
Boolean pruneUnused = null;
|
Boolean pruneUnused = null;
|
||||||
Boolean filterPacks = null;
|
Boolean filterPacks = null;
|
||||||
Boolean logProcessing = null;
|
Boolean logProcessing = null;
|
||||||
while (reader.peek() != Token.END_OBJECT) {
|
while (reader.peek() != JsonToken.END_OBJECT) {
|
||||||
final String name = reader.nextName();
|
final String name = reader.nextName();
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case PACKS -> {
|
case PACKS -> {
|
||||||
if (packs != null) throw new MalformedDataException(ERR_DUPLICATE.formatted(PACKS));
|
if (packs != null) throw new JsonParseException(ERR_DUPLICATE.formatted(PACKS));
|
||||||
if (reader.peek() == Token.BEGIN_ARRAY) {
|
packs = GsonHolders.CONFIG.getGson().fromJson(reader, META_SET);
|
||||||
packs = ListAdaptation.deserializeSet(reader, GC_PackMetaUnloaded::deserialize);
|
|
||||||
} else {
|
|
||||||
packs = Set.of(GC_PackMetaUnloaded.deserialize(reader));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
case PRUNE_UNUSED -> {
|
case PRUNE_UNUSED -> {
|
||||||
if (pruneUnused != null) throw new MalformedDataException(ERR_DUPLICATE.formatted(PRUNE_UNUSED));
|
if (pruneUnused != null) throw new JsonParseException(ERR_DUPLICATE.formatted(PRUNE_UNUSED));
|
||||||
pruneUnused = reader.nextBoolean();
|
pruneUnused = reader.nextBoolean();
|
||||||
}
|
}
|
||||||
case FILTER_PACKS -> {
|
case FILTER_PACKS -> {
|
||||||
if (filterPacks != null) throw new MalformedDataException(ERR_DUPLICATE.formatted(FILTER_PACKS));
|
if (filterPacks != null) throw new JsonParseException(ERR_DUPLICATE.formatted(FILTER_PACKS));
|
||||||
filterPacks = reader.nextBoolean();
|
filterPacks = reader.nextBoolean();
|
||||||
}
|
}
|
||||||
case LOG_PROCESSING -> {
|
case LOG_PROCESSING -> {
|
||||||
if (logProcessing != null) throw new MalformedDataException(ERR_DUPLICATE.formatted(LOG_PROCESSING));
|
if (logProcessing != null) throw new JsonParseException(ERR_DUPLICATE.formatted(LOG_PROCESSING));
|
||||||
logProcessing = reader.nextBoolean();
|
logProcessing = reader.nextBoolean();
|
||||||
}
|
}
|
||||||
default -> throw new MalformedDataException("Unexpected element: \"" + name + "\" in Resclone config");
|
default -> throw new JsonParseException("Unexpected element: \"" + name + "\" in Resclone config");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reader.endObject();
|
reader.endObject();
|
||||||
if (packs == null) throw new MalformedDataException("Expected Resclone config object to contain packs");
|
if (packs == null) throw new JsonParseException("Expected Resclone config object to contain packs");
|
||||||
if (pruneUnused == null) {
|
if (pruneUnused == null) {
|
||||||
pruneUnused = true;
|
pruneUnused = true;
|
||||||
updateRequired = true;
|
updateRequired = true;
|
||||||
@ -98,23 +92,19 @@ public class RescloneConfig implements JfCustomConfig {
|
|||||||
RescloneConfig.pruneUnused = pruneUnused;
|
RescloneConfig.pruneUnused = pruneUnused;
|
||||||
RescloneConfig.filterPacks = filterPacks;
|
RescloneConfig.filterPacks = filterPacks;
|
||||||
RescloneConfig.logProcessing = logProcessing;
|
RescloneConfig.logProcessing = logProcessing;
|
||||||
} else throw new MalformedDataException("Expected Resclone config to be an object or array");
|
} else throw new JsonParseException("Expected Resclone config to be an object or array");
|
||||||
}
|
}
|
||||||
if (updateRequired) write(path);
|
if (updateRequired) write(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void write(Path path) throws IOException {
|
private static void write(Path path) throws IOException {
|
||||||
try (BufferedWriter bw = Files.newBufferedWriter(path);
|
try (BufferedWriter bw = Files.newBufferedWriter(path);
|
||||||
JsonWriter writer = LibJf.LENIENT_TRANSPORT.createWriter(bw)) {
|
JsonWriter writer = GsonHolders.CONFIG.getGson().newJsonWriter(bw)) {
|
||||||
writer.beginObject()
|
writer.beginObject()
|
||||||
.comment("The packs to be loaded by resclone")
|
.comment("The packs to be loaded by resclone")
|
||||||
.name(PACKS)
|
.name(PACKS);
|
||||||
.beginArray();
|
GsonHolders.CONFIG.getGson().toJson(packs, META_SET, writer);
|
||||||
for (PackMetaUnloaded pack : packs) {
|
writer.comment("Automatically remove all downloaded packs that are not in the config to free up unneeded space")
|
||||||
GC_PackMetaUnloaded.serialize(pack, writer);
|
|
||||||
}
|
|
||||||
writer.endArray()
|
|
||||||
.comment("Automatically remove all downloaded packs that are not in the config to free up unneeded space")
|
|
||||||
.name(PRUNE_UNUSED)
|
.name(PRUNE_UNUSED)
|
||||||
.value(pruneUnused)
|
.value(pruneUnused)
|
||||||
.comment("Whether to filter packs to remove files unchanged from vanilla and empty directories")
|
.comment("Whether to filter packs to remove files unchanged from vanilla and empty directories")
|
||||||
@ -143,7 +133,7 @@ public class RescloneConfig implements JfCustomConfig {
|
|||||||
Resclone.LOGGER.error("Could not write config", e);
|
Resclone.LOGGER.error("Could not write config", e);
|
||||||
}
|
}
|
||||||
}).setPath(path)
|
}).setPath(path)
|
||||||
.<Set<PackMetaUnloaded>>value(PACKS, new HashSet<>(), Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, io.gitlab.jfronny.libjf.config.api.v2.type.Type.ofClass(new TypeToken<Set<PackMetaUnloaded>>(){}.getType()), 100, () -> packs, p -> packs = p)
|
.<Set<PackMetaUnloaded>>value(PACKS, new HashSet<>(), Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, io.gitlab.jfronny.libjf.config.api.v2.type.Type.ofClass(META_SET), 100, () -> packs, p -> packs = p)
|
||||||
.value(PRUNE_UNUSED, pruneUnused, () -> pruneUnused, p -> pruneUnused = p)
|
.value(PRUNE_UNUSED, pruneUnused, () -> pruneUnused, p -> pruneUnused = p)
|
||||||
.value(FILTER_PACKS, filterPacks, () -> filterPacks, p -> filterPacks = p)
|
.value(FILTER_PACKS, filterPacks, () -> filterPacks, p -> filterPacks = p)
|
||||||
.value(LOG_PROCESSING, logProcessing, () -> logProcessing, p -> logProcessing = p)
|
.value(LOG_PROCESSING, logProcessing, () -> logProcessing, p -> logProcessing = p)
|
||||||
|
@ -11,13 +11,16 @@ import java.util.List;
|
|||||||
|
|
||||||
public class RescloneResourcePack extends ZipResourcePack implements ModResourcePack {
|
public class RescloneResourcePack extends ZipResourcePack implements ModResourcePack {
|
||||||
private static final ModMetadata METADATA = FabricLoader.getInstance().getModContainer(Resclone.MOD_ID).orElseThrow().getMetadata();
|
private static final ModMetadata METADATA = FabricLoader.getInstance().getModContainer(Resclone.MOD_ID).orElseThrow().getMetadata();
|
||||||
private final ResourcePackInfo info;
|
private final String name;
|
||||||
private final ZipFileWrapper file;
|
|
||||||
|
|
||||||
RescloneResourcePack(ZipFileWrapper file, ResourcePackInfo info, String overlay) {
|
RescloneResourcePack(ZipFileWrapper file, String name, String overlay) {
|
||||||
super(info, file, overlay);
|
super(name, file, true, overlay);
|
||||||
this.info = info;
|
this.name = name;
|
||||||
this.file = file;
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -25,34 +28,29 @@ public class RescloneResourcePack extends ZipResourcePack implements ModResource
|
|||||||
return METADATA;
|
return METADATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ModResourcePack createOverlay(String overlay) {
|
|
||||||
return new RescloneResourcePack(this.file, this.info, overlay);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Factory implements ResourcePackProfile.PackFactory {
|
public static class Factory implements ResourcePackProfile.PackFactory {
|
||||||
private final File file;
|
private final File file;
|
||||||
private final ResourcePackInfo info;
|
private final String name;
|
||||||
|
|
||||||
public Factory(File file, ResourcePackInfo info) {
|
public Factory(File file, String name) {
|
||||||
this.file = file;
|
this.file = file;
|
||||||
this.info = info;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourcePack open(ResourcePackInfo info) {
|
public ResourcePack open(String name) {
|
||||||
ZipFileWrapper zipFileWrapper = new ZipFileWrapper(this.file);
|
ZipFileWrapper zipFileWrapper = new ZipFileWrapper(this.file);
|
||||||
return new RescloneResourcePack(zipFileWrapper, this.info, "");
|
return new RescloneResourcePack(zipFileWrapper, this.name, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourcePack openWithOverlays(ResourcePackInfo info, ResourcePackProfile.Metadata metadata) {
|
public ResourcePack openWithOverlays(String name, ResourcePackProfile.Metadata metadata) {
|
||||||
ZipFileWrapper zipFileWrapper = new ZipFileWrapper(this.file);
|
ZipFileWrapper zipFileWrapper = new ZipFileWrapper(this.file);
|
||||||
ZipResourcePack resourcePack = new RescloneResourcePack(zipFileWrapper, this.info, "");
|
ZipResourcePack resourcePack = new RescloneResourcePack(zipFileWrapper, this.name, "");
|
||||||
List<String> overlays = metadata.overlays();
|
List<String> overlays = metadata.overlays();
|
||||||
if (overlays.isEmpty()) return resourcePack;
|
if (overlays.isEmpty()) return resourcePack;
|
||||||
List<ResourcePack> overlayPacks = new ArrayList<>(overlays.size());
|
List<ResourcePack> overlayPacks = new ArrayList<>(overlays.size());
|
||||||
for (String string : overlays) overlayPacks.add(new RescloneResourcePack(zipFileWrapper, this.info, string));
|
for (String string : overlays) overlayPacks.add(new RescloneResourcePack(zipFileWrapper, this.name, string));
|
||||||
return new OverlayResourcePack(resourcePack, overlayPacks);
|
return new OverlayResourcePack(resourcePack, overlayPacks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,20 @@
|
|||||||
package io.gitlab.jfronny.resclone.data;
|
package io.gitlab.jfronny.resclone.data;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
// Represents a pack as present in the config
|
||||||
|
// Can't be a record since it'll need to be parsed by Gson
|
||||||
|
@SuppressWarnings("ClassCanBeRecord")
|
||||||
|
public class PackMetaUnloaded {
|
||||||
|
public final String fetcher;
|
||||||
|
public final String source;
|
||||||
|
public final String name;
|
||||||
|
public final boolean forceDownload;
|
||||||
|
public final boolean forceEnable;
|
||||||
|
|
||||||
@GSerializable
|
public PackMetaUnloaded(String fetcher, String source, String name, boolean forceDownload, boolean forceEnable) {
|
||||||
public record PackMetaUnloaded(String fetcher, String source, String name, boolean forceDownload, boolean forceEnable) {
|
this.fetcher = fetcher;
|
||||||
|
this.source = source;
|
||||||
|
this.name = name;
|
||||||
|
this.forceDownload = forceDownload;
|
||||||
|
this.forceEnable = forceEnable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
package io.gitlab.jfronny.resclone.data.curseforge;
|
package io.gitlab.jfronny.resclone.data.curseforge;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@GSerializable
|
|
||||||
public class GetModFilesResponse {
|
public class GetModFilesResponse {
|
||||||
public List<Data> data;
|
public List<Data> data;
|
||||||
|
|
||||||
@GSerializable
|
|
||||||
public static class Data {
|
public static class Data {
|
||||||
public String downloadUrl;
|
public String downloadUrl;
|
||||||
public Date fileDate;
|
public Date fileDate;
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
package io.gitlab.jfronny.resclone.data.curseforge;
|
package io.gitlab.jfronny.resclone.data.curseforge;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
|
||||||
|
|
||||||
@GSerializable
|
|
||||||
public class GetModResponse {
|
public class GetModResponse {
|
||||||
public Data data;
|
public Data data;
|
||||||
|
|
||||||
@GSerializable
|
|
||||||
public static class Data {
|
public static class Data {
|
||||||
public Boolean allowModDistribution;
|
public Boolean allowModDistribution;
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
package io.gitlab.jfronny.resclone.data.github;
|
package io.gitlab.jfronny.resclone.data.github;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@GSerializable
|
|
||||||
public class Release {
|
public class Release {
|
||||||
public List<Asset> assets;
|
public List<Asset> assets;
|
||||||
public String zipball_url;
|
public String zipball_url;
|
||||||
|
|
||||||
@GSerializable
|
|
||||||
public static class Asset {
|
public static class Asset {
|
||||||
public String name;
|
public String name;
|
||||||
public String content_type;
|
public String content_type;
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package io.gitlab.jfronny.resclone.data.github;
|
package io.gitlab.jfronny.resclone.data.github;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
|
||||||
|
|
||||||
@GSerializable
|
|
||||||
public class Repository {
|
public class Repository {
|
||||||
public String default_branch;
|
public String default_branch;
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
package io.gitlab.jfronny.resclone.data.modrinth;
|
package io.gitlab.jfronny.resclone.data.modrinth;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.serialize.annotations.SerializedName;
|
import io.gitlab.jfronny.gson.annotations.SerializedName;
|
||||||
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@GSerializable
|
|
||||||
public class Version {
|
public class Version {
|
||||||
public String name;
|
public String name;
|
||||||
public String version_number;
|
public String version_number;
|
||||||
@ -26,7 +24,6 @@ public class Version {
|
|||||||
public Integer downloads;
|
public Integer downloads;
|
||||||
public List<File> files;
|
public List<File> files;
|
||||||
|
|
||||||
@GSerializable
|
|
||||||
public static class Dependency {
|
public static class Dependency {
|
||||||
@Nullable public String version_id;
|
@Nullable public String version_id;
|
||||||
@Nullable public String project_id;
|
@Nullable public String project_id;
|
||||||
@ -46,7 +43,6 @@ public class Version {
|
|||||||
listed, archived, draft, unlisted, scheduled, unknown
|
listed, archived, draft, unlisted, scheduled, unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable
|
|
||||||
public static class File {
|
public static class File {
|
||||||
public Hashes hashes;
|
public Hashes hashes;
|
||||||
public String url;
|
public String url;
|
||||||
@ -55,7 +51,6 @@ public class Version {
|
|||||||
public Integer size;
|
public Integer size;
|
||||||
@Nullable public Type file_type;
|
@Nullable public Type file_type;
|
||||||
|
|
||||||
@GSerializable
|
|
||||||
public static class Hashes {
|
public static class Hashes {
|
||||||
public String sha512;
|
public String sha512;
|
||||||
public String sha1;
|
public String sha1;
|
||||||
|
@ -1,19 +1,13 @@
|
|||||||
package io.gitlab.jfronny.resclone.fetchers;
|
package io.gitlab.jfronny.resclone.fetchers;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.http.client.HttpClient;
|
import io.gitlab.jfronny.commons.http.client.HttpClient;
|
||||||
import io.gitlab.jfronny.commons.serialize.json.JsonReader;
|
|
||||||
import io.gitlab.jfronny.commons.throwable.ThrowingFunction;
|
|
||||||
import io.gitlab.jfronny.libjf.LibJf;
|
|
||||||
import io.gitlab.jfronny.resclone.Resclone;
|
import io.gitlab.jfronny.resclone.Resclone;
|
||||||
import io.gitlab.jfronny.resclone.data.curseforge.GC_GetModFilesResponse;
|
|
||||||
import io.gitlab.jfronny.resclone.data.curseforge.GC_GetModResponse;
|
|
||||||
import io.gitlab.jfronny.resclone.data.curseforge.GetModFilesResponse;
|
import io.gitlab.jfronny.resclone.data.curseforge.GetModFilesResponse;
|
||||||
import io.gitlab.jfronny.resclone.data.curseforge.GetModResponse;
|
import io.gitlab.jfronny.resclone.data.curseforge.GetModResponse;
|
||||||
import net.minecraft.MinecraftVersion;
|
import net.minecraft.MinecraftVersion;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
@ -39,7 +33,7 @@ public class CurseforgeFetcher extends BasePackFetcher {
|
|||||||
@Override
|
@Override
|
||||||
public String getDownloadUrl(String baseUrl) throws Exception {
|
public String getDownloadUrl(String baseUrl) throws Exception {
|
||||||
try {
|
try {
|
||||||
GetModResponse response = GET(baseUrl, GC_GetModResponse::deserialize);
|
GetModResponse response = GET(baseUrl, GetModResponse.class);
|
||||||
if (!response.data.allowModDistribution)
|
if (!response.data.allowModDistribution)
|
||||||
throw new Exception("The author of " + baseUrl + " disabled access to this pack outside of the curseforge launcher");
|
throw new Exception("The author of " + baseUrl + " disabled access to this pack outside of the curseforge launcher");
|
||||||
|
|
||||||
@ -49,7 +43,7 @@ public class CurseforgeFetcher extends BasePackFetcher {
|
|||||||
Date latestDate = null;
|
Date latestDate = null;
|
||||||
boolean foundMatchingVersion = false;
|
boolean foundMatchingVersion = false;
|
||||||
|
|
||||||
for (GetModFilesResponse.Data addon : GET(baseUrl + "/files", GC_GetModFilesResponse::deserialize).data) {
|
for (GetModFilesResponse.Data addon : GET(baseUrl + "/files", GetModFilesResponse.class).data) {
|
||||||
if (foundMatchingVersion && !addon.gameVersions.contains(version)) continue;
|
if (foundMatchingVersion && !addon.gameVersions.contains(version)) continue;
|
||||||
if (!foundMatchingVersion && addon.gameVersions.contains(version)) {
|
if (!foundMatchingVersion && addon.gameVersions.contains(version)) {
|
||||||
foundMatchingVersion = true;
|
foundMatchingVersion = true;
|
||||||
@ -69,11 +63,8 @@ public class CurseforgeFetcher extends BasePackFetcher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T> T GET(String suffix, ThrowingFunction<JsonReader, T, IOException> klazz) throws URISyntaxException, IOException {
|
private static <T> T GET(String suffix, Class<T> klazz) throws URISyntaxException, IOException {
|
||||||
try (Reader r = HttpClient.get("https://api.curseforge.com/v1/mods/" + suffix).header("x-api-key", API_KEY).sendReader();
|
return HttpClient.get("https://api.curseforge.com/v1/mods/" + suffix).header("x-api-key", API_KEY).sendSerialized(klazz);
|
||||||
JsonReader jr = LibJf.LENIENT_TRANSPORT.createReader(r)) {
|
|
||||||
return klazz.apply(jr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static byte[] unsalt(byte[] data, int salt) {
|
private static byte[] unsalt(byte[] data, int salt) {
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
package io.gitlab.jfronny.resclone.fetchers;
|
package io.gitlab.jfronny.resclone.fetchers;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.http.client.HttpClient;
|
import io.gitlab.jfronny.commons.http.client.HttpClient;
|
||||||
import io.gitlab.jfronny.commons.serialize.json.JsonReader;
|
|
||||||
import io.gitlab.jfronny.libjf.LibJf;
|
|
||||||
import io.gitlab.jfronny.resclone.Resclone;
|
import io.gitlab.jfronny.resclone.Resclone;
|
||||||
import io.gitlab.jfronny.resclone.data.github.GC_Release;
|
|
||||||
import io.gitlab.jfronny.resclone.data.github.GC_Repository;
|
|
||||||
import io.gitlab.jfronny.resclone.data.github.Release;
|
import io.gitlab.jfronny.resclone.data.github.Release;
|
||||||
|
import io.gitlab.jfronny.resclone.data.github.Repository;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
public class GitHubFetcher extends BasePackFetcher {
|
public class GitHubFetcher extends BasePackFetcher {
|
||||||
@ -43,9 +39,8 @@ public class GitHubFetcher extends BasePackFetcher {
|
|||||||
|
|
||||||
//"user/repo/release" - Gets from the latest release.
|
//"user/repo/release" - Gets from the latest release.
|
||||||
else if (parts[2].equalsIgnoreCase("release")) {
|
else if (parts[2].equalsIgnoreCase("release")) {
|
||||||
try (Reader r = HttpClient.get("https://api.github.com/repos/" + parts[0] + "/" + parts[1] + "/releases/latest").sendReader();
|
try {
|
||||||
JsonReader jr = LibJf.LENIENT_TRANSPORT.createReader(r)) {
|
Release latestRelease = HttpClient.get("https://api.github.com/repos/" + parts[0] + "/" + parts[1] + "/releases/latest").sendSerialized(Release.class);
|
||||||
Release latestRelease = GC_Release.deserialize(jr);
|
|
||||||
String res = null;
|
String res = null;
|
||||||
|
|
||||||
for (Release.Asset asset : latestRelease.assets) {
|
for (Release.Asset asset : latestRelease.assets) {
|
||||||
@ -78,9 +73,8 @@ public class GitHubFetcher extends BasePackFetcher {
|
|||||||
|
|
||||||
private String getFromBranch(String repo, @Nullable String branch) {
|
private String getFromBranch(String repo, @Nullable String branch) {
|
||||||
if (branch == null) {
|
if (branch == null) {
|
||||||
try (Reader r = HttpClient.get("https://api.github.com/repos/" + repo).sendReader();
|
try {
|
||||||
JsonReader jr = LibJf.LENIENT_TRANSPORT.createReader(r)) {
|
branch = HttpClient.get("https://api.github.com/repos/" + repo).<Repository>sendSerialized(Repository.class).default_branch;
|
||||||
branch = GC_Repository.deserialize(jr).default_branch;
|
|
||||||
} catch (IOException | URISyntaxException e) {
|
} catch (IOException | URISyntaxException e) {
|
||||||
Resclone.LOGGER.error("Failed to fetch branch for " + repo + ". Choosing \"main\"", e);
|
Resclone.LOGGER.error("Failed to fetch branch for " + repo + ". Choosing \"main\"", e);
|
||||||
branch = "main";
|
branch = "main";
|
||||||
|
@ -1,21 +1,19 @@
|
|||||||
package io.gitlab.jfronny.resclone.fetchers;
|
package io.gitlab.jfronny.resclone.fetchers;
|
||||||
|
|
||||||
|
import com.google.common.reflect.TypeToken;
|
||||||
import io.gitlab.jfronny.commons.http.client.HttpClient;
|
import io.gitlab.jfronny.commons.http.client.HttpClient;
|
||||||
import io.gitlab.jfronny.commons.serialize.json.JsonReader;
|
|
||||||
import io.gitlab.jfronny.libjf.LibJf;
|
|
||||||
import io.gitlab.jfronny.resclone.Resclone;
|
import io.gitlab.jfronny.resclone.Resclone;
|
||||||
import io.gitlab.jfronny.resclone.data.modrinth.GC_Version;
|
|
||||||
import io.gitlab.jfronny.resclone.data.modrinth.Version;
|
import io.gitlab.jfronny.resclone.data.modrinth.Version;
|
||||||
import io.gitlab.jfronny.resclone.util.ListAdaptation;
|
|
||||||
import net.minecraft.MinecraftVersion;
|
import net.minecraft.MinecraftVersion;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.lang.reflect.Type;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ModrinthFetcher extends BasePackFetcher {
|
public class ModrinthFetcher extends BasePackFetcher {
|
||||||
|
private static final Type versionType = new TypeToken<List<Version>>() {}.getType();
|
||||||
@Override
|
@Override
|
||||||
public String getSourceTypeName() {
|
public String getSourceTypeName() {
|
||||||
return "modrinth";
|
return "modrinth";
|
||||||
@ -30,14 +28,9 @@ public class ModrinthFetcher extends BasePackFetcher {
|
|||||||
Date latestDate = null;
|
Date latestDate = null;
|
||||||
boolean foundMatchingVersion = false;
|
boolean foundMatchingVersion = false;
|
||||||
|
|
||||||
List<Version> versions;
|
for (Version ver : HttpClient.get("https://api.modrinth.com/v2/project/" + baseUrl + "/version")
|
||||||
try (Reader r = HttpClient.get("https://api.modrinth.com/v2/project/" + baseUrl + "/version")
|
|
||||||
.userAgent(Resclone.USER_AGENT)
|
.userAgent(Resclone.USER_AGENT)
|
||||||
.sendReader();
|
.<List<Version>>sendSerialized(versionType)) {
|
||||||
JsonReader jr = LibJf.LENIENT_TRANSPORT.createReader(r)) {
|
|
||||||
versions = ListAdaptation.deserializeList(jr, GC_Version::deserialize);
|
|
||||||
}
|
|
||||||
for (Version ver : versions) {
|
|
||||||
if (foundMatchingVersion && !ver.game_versions.contains(version)) continue;
|
if (foundMatchingVersion && !ver.game_versions.contains(version)) continue;
|
||||||
if (ver.files.isEmpty()) continue;
|
if (ver.files.isEmpty()) continue;
|
||||||
if (!foundMatchingVersion && ver.game_versions.contains(version)) {
|
if (!foundMatchingVersion && ver.game_versions.contains(version)) {
|
||||||
@ -61,7 +54,7 @@ public class ModrinthFetcher extends BasePackFetcher {
|
|||||||
if (file.file_type == Version.File.Type.REQUIRED_RESOURCE_PACK) return file.url;
|
if (file.file_type == Version.File.Type.REQUIRED_RESOURCE_PACK) return file.url;
|
||||||
}
|
}
|
||||||
Resclone.LOGGER.error("Identification failed, using first file of " + baseUrl);
|
Resclone.LOGGER.error("Identification failed, using first file of " + baseUrl);
|
||||||
return latest.files.getFirst().url;
|
return latest.files.get(0).url;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
throw new IOException("Could not get Modrinth download for " + baseUrl, e);
|
throw new IOException("Could not get Modrinth download for " + baseUrl, e);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
@Mixin(FileResourcePackProvider.class)
|
@Mixin(FileResourcePackProvider.class)
|
||||||
@ -21,21 +20,14 @@ public class FileResourcePackProviderMixin {
|
|||||||
@Inject(at = @At("TAIL"), method = "register(Ljava/util/function/Consumer;)V")
|
@Inject(at = @At("TAIL"), method = "register(Ljava/util/function/Consumer;)V")
|
||||||
public void registerExtra(Consumer<ResourcePackProfile> consumer, CallbackInfo info) {
|
public void registerExtra(Consumer<ResourcePackProfile> consumer, CallbackInfo info) {
|
||||||
for (PackMetaLoaded meta : Resclone.DOWNLOADED_PACKS) {
|
for (PackMetaLoaded meta : Resclone.DOWNLOADED_PACKS) {
|
||||||
ResourcePackInfo ifo = new ResourcePackInfo(
|
|
||||||
"resclone/" + meta.name(),
|
|
||||||
Text.literal(meta.name()),
|
|
||||||
source,
|
|
||||||
Optional.empty()
|
|
||||||
);
|
|
||||||
ResourcePackProfile resourcePackProfile = ResourcePackProfile.create(
|
ResourcePackProfile resourcePackProfile = ResourcePackProfile.create(
|
||||||
ifo,
|
"resclone/" + meta.name(),
|
||||||
new RescloneResourcePack.Factory(meta.zipPath().toFile(), ifo),
|
Text.literal(meta.name()),
|
||||||
|
meta.forceEnable(),
|
||||||
|
new RescloneResourcePack.Factory(meta.zipPath().toFile(), meta.name()),
|
||||||
type,
|
type,
|
||||||
new ResourcePackPosition(
|
ResourcePackProfile.InsertionPosition.TOP,
|
||||||
meta.forceEnable(),
|
source
|
||||||
ResourcePackProfile.InsertionPosition.TOP,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
if (resourcePackProfile != null) {
|
if (resourcePackProfile != null) {
|
||||||
consumer.accept(resourcePackProfile);
|
consumer.accept(resourcePackProfile);
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
package io.gitlab.jfronny.resclone.util;
|
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.serialize.SerializeReader;
|
|
||||||
import io.gitlab.jfronny.commons.throwable.ThrowingFunction;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class ListAdaptation {
|
|
||||||
public static <T, TEx extends Exception, Reader extends SerializeReader<TEx, Reader>> List<T> deserializeList(Reader reader, ThrowingFunction<Reader, T, TEx> deserializeOne) throws TEx {
|
|
||||||
List<T> result = new ArrayList<>();
|
|
||||||
reader.beginArray();
|
|
||||||
while (reader.hasNext()) {
|
|
||||||
result.add(deserializeOne.apply(reader));
|
|
||||||
}
|
|
||||||
reader.endArray();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <T, TEx extends Exception, Reader extends SerializeReader<TEx, Reader>> Set<T> deserializeSet(Reader reader, ThrowingFunction<Reader, T, TEx> serializeOne) throws TEx {
|
|
||||||
Set<T> result = new LinkedHashSet<>();
|
|
||||||
reader.beginArray();
|
|
||||||
while (reader.hasNext()) {
|
|
||||||
result.add(serializeOne.apply(reader));
|
|
||||||
}
|
|
||||||
reader.endArray();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
accessWidener v2 named
|
accessWidener v2 named
|
||||||
|
|
||||||
accessible class net/minecraft/resource/ZipResourcePack$ZipFileWrapper
|
accessible class net/minecraft/resource/ZipResourcePack$ZipFileWrapper
|
||||||
accessible method net/minecraft/resource/ZipResourcePack <init> (Lnet/minecraft/resource/ResourcePackInfo;Lnet/minecraft/resource/ZipResourcePack$ZipFileWrapper;Ljava/lang/String;)V
|
extendable method net/minecraft/resource/ZipResourcePack <init> (Ljava/lang/String;Lnet/minecraft/resource/ZipResourcePack$ZipFileWrapper;ZLjava/lang/String;)V
|
||||||
accessible method net/minecraft/resource/ZipResourcePack$ZipFileWrapper <init> (Ljava/io/File;)V
|
accessible method net/minecraft/resource/ZipResourcePack$ZipFileWrapper <init> (Ljava/io/File;)V
|
@ -2,6 +2,7 @@
|
|||||||
"required": true,
|
"required": true,
|
||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"package": "io.gitlab.jfronny.resclone.mixin",
|
"package": "io.gitlab.jfronny.resclone.mixin",
|
||||||
|
"compatibilityLevel": "JAVA_8",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"FileResourcePackProviderMixin"
|
"FileResourcePackProviderMixin"
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user