chore: update to 1.20.2
ci/woodpecker/push/jfmod Pipeline was successful
Details
ci/woodpecker/push/jfmod Pipeline was successful
Details
This commit is contained in:
parent
d828de9464
commit
c4d424b792
|
@ -1,16 +1,39 @@
|
||||||
import io.gitlab.jfronny.scripts.*
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("jfmod") version "1.3-SNAPSHOT"
|
id("jfmod") version "1.5-SNAPSHOT"
|
||||||
|
}
|
||||||
|
|
||||||
|
loom {
|
||||||
|
accessWidenerPath.set(file("src/main/resources/resclone.accesswidener"))
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects { group = "io.gitlab.jfronny" }
|
||||||
|
base.archivesName = "resclone"
|
||||||
|
|
||||||
|
val fabricVersion = "0.89.1+1.20.2"
|
||||||
|
val modmenuVersion = "8.0.0-beta.2"
|
||||||
|
jfMod {
|
||||||
|
minecraftVersion = "1.20.2"
|
||||||
|
yarn("build.1")
|
||||||
|
loaderVersion = "0.14.22"
|
||||||
|
libJfVersion = "3.13.1"
|
||||||
|
|
||||||
|
modrinth {
|
||||||
|
projectId = "resclone"
|
||||||
|
optionalDependencies.add("fabric-api")
|
||||||
|
}
|
||||||
|
curseforge {
|
||||||
|
projectId = "839008"
|
||||||
|
optionalDependencies.add("fabric-api")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
include(modImplementation("io.gitlab.jfronny.libjf:libjf-base:${prop("libjf_version")}")!!) // for JfCommons
|
include(modImplementation("io.gitlab.jfronny.libjf:libjf-base:${jfMod.libJfVersion.get()}")!!) // for JfCommons
|
||||||
include(modImplementation("io.gitlab.jfronny.libjf:libjf-config-core-v1:${prop("libjf_version")}")!!) // for JfCommons
|
include(modImplementation("io.gitlab.jfronny.libjf:libjf-config-core-v2:${jfMod.libJfVersion.get()}")!!) // for JfCommons
|
||||||
include(modImplementation(fabricApi.module("fabric-resource-loader-v0", prop("fabric_version")))!!)
|
include(modImplementation(fabricApi.module("fabric-resource-loader-v0", fabricVersion))!!)
|
||||||
|
|
||||||
// Dev env
|
// Dev env
|
||||||
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-config-ui-tiny-v1:${prop("libjf_version")}")
|
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-config-ui-tiny:${jfMod.libJfVersion.get()}")
|
||||||
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-devutil:${prop("libjf_version")}")
|
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-devutil:${jfMod.libJfVersion.get()}")
|
||||||
modLocalRuntime("com.terraformersmc:modmenu:${prop("modmenu_version")}")
|
modLocalRuntime("com.terraformersmc:modmenu:$modmenuVersion")
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
# https://fabricmc.net/develop
|
|
||||||
minecraft_version=1.20
|
|
||||||
yarn_mappings=build.1
|
|
||||||
loader_version=0.14.21
|
|
||||||
|
|
||||||
maven_group=io.gitlab.jfronny
|
|
||||||
archives_base_name=resclone
|
|
||||||
|
|
||||||
modrinth_id=resclone
|
|
||||||
modrinth_optional_dependencies=fabric-api
|
|
||||||
curseforge_id=839008
|
|
||||||
curseforge_optional_dependencies=fabric-api
|
|
||||||
|
|
||||||
fabric_version=0.83.0+1.20
|
|
||||||
libjf_version=3.8.0
|
|
||||||
modmenu_version=7.0.1
|
|
|
@ -1,7 +1,7 @@
|
||||||
package io.gitlab.jfronny.resclone;
|
package io.gitlab.jfronny.resclone;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.log.Logger;
|
import io.gitlab.jfronny.commons.logging.Logger;
|
||||||
import io.gitlab.jfronny.commons.serialize.gson.api.v1.GsonHolders;
|
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.*;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
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.gson.api.v1.GsonHolders;
|
import io.gitlab.jfronny.commons.serialize.gson.api.v2.GsonHolders;
|
||||||
import io.gitlab.jfronny.gson.JsonParseException;
|
import io.gitlab.jfronny.gson.JsonParseException;
|
||||||
import io.gitlab.jfronny.gson.stream.*;
|
import io.gitlab.jfronny.gson.stream.*;
|
||||||
import io.gitlab.jfronny.libjf.config.api.v1.JfCustomConfig;
|
import io.gitlab.jfronny.libjf.config.api.v2.JfCustomConfig;
|
||||||
import io.gitlab.jfronny.libjf.config.api.v1.dsl.DSL;
|
import io.gitlab.jfronny.libjf.config.api.v2.dsl.DSL;
|
||||||
import io.gitlab.jfronny.resclone.data.PackMetaUnloaded;
|
import io.gitlab.jfronny.resclone.data.PackMetaUnloaded;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
@ -100,7 +100,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.v1.type.Type.ofClass(META_SET), 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)
|
||||||
).load();
|
).load();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,16 +3,18 @@ package io.gitlab.jfronny.resclone;
|
||||||
import net.fabricmc.fabric.api.resource.ModResourcePack;
|
import net.fabricmc.fabric.api.resource.ModResourcePack;
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.fabricmc.loader.api.metadata.ModMetadata;
|
import net.fabricmc.loader.api.metadata.ModMetadata;
|
||||||
import net.minecraft.resource.ZipResourcePack;
|
import net.minecraft.resource.*;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
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 String name;
|
private final String name;
|
||||||
|
|
||||||
public RescloneResourcePack(File file, String name) {
|
RescloneResourcePack(ZipFileWrapper file, String name, String overlay) {
|
||||||
super(name, file, true);
|
super(name, file, true, overlay);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,4 +27,31 @@ public class RescloneResourcePack extends ZipResourcePack implements ModResource
|
||||||
public ModMetadata getFabricModMetadata() {
|
public ModMetadata getFabricModMetadata() {
|
||||||
return METADATA;
|
return METADATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class Factory implements ResourcePackProfile.PackFactory {
|
||||||
|
private final File file;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
public Factory(File file, String name) {
|
||||||
|
this.file = file;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourcePack open(String name) {
|
||||||
|
ZipFileWrapper zipFileWrapper = new ZipFileWrapper(this.file);
|
||||||
|
return new RescloneResourcePack(zipFileWrapper, this.name, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourcePack openWithOverlays(String name, ResourcePackProfile.Metadata metadata) {
|
||||||
|
ZipFileWrapper zipFileWrapper = new ZipFileWrapper(this.file);
|
||||||
|
ZipResourcePack resourcePack = new RescloneResourcePack(zipFileWrapper, this.name, "");
|
||||||
|
List<String> overlays = metadata.overlays();
|
||||||
|
if (overlays.isEmpty()) return resourcePack;
|
||||||
|
List<ResourcePack> overlayPacks = new ArrayList<>(overlays.size());
|
||||||
|
for (String string : overlays) overlayPacks.add(new RescloneResourcePack(zipFileWrapper, this.name, string));
|
||||||
|
return new OverlayResourcePack(resourcePack, overlayPacks);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package io.gitlab.jfronny.resclone.fetchers;
|
package io.gitlab.jfronny.resclone.fetchers;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.HttpUtils;
|
import io.gitlab.jfronny.commons.http.client.HttpClient;
|
||||||
import io.gitlab.jfronny.resclone.Resclone;
|
import io.gitlab.jfronny.resclone.Resclone;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
@ -32,7 +32,7 @@ public abstract class BasePackFetcher implements PackFetcher {
|
||||||
|
|
||||||
Resclone.LOGGER.info("Downloading pack: " + url);
|
Resclone.LOGGER.info("Downloading pack: " + url);
|
||||||
|
|
||||||
try (InputStream is = HttpUtils.get(url).userAgent(Resclone.USER_AGENT).sendInputStream();
|
try (InputStream is = HttpClient.get(url).userAgent(Resclone.USER_AGENT).sendInputStream();
|
||||||
OutputStream os = Files.newOutputStream(p)) {
|
OutputStream os = Files.newOutputStream(p)) {
|
||||||
byte[] dataBuffer = new byte[1024];
|
byte[] dataBuffer = new byte[1024];
|
||||||
int bytesRead;
|
int bytesRead;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package io.gitlab.jfronny.resclone.fetchers;
|
package io.gitlab.jfronny.resclone.fetchers;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.HttpUtils;
|
import io.gitlab.jfronny.commons.http.client.HttpClient;
|
||||||
import io.gitlab.jfronny.resclone.Resclone;
|
import io.gitlab.jfronny.resclone.Resclone;
|
||||||
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;
|
||||||
|
@ -64,7 +64,7 @@ public class CurseforgeFetcher extends BasePackFetcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T> T GET(String suffix, Class<T> klazz) throws URISyntaxException, IOException {
|
private static <T> T GET(String suffix, Class<T> klazz) throws URISyntaxException, IOException {
|
||||||
return HttpUtils.get("https://api.curseforge.com/v1/mods/" + suffix).header("x-api-key", API_KEY).sendSerialized(klazz);
|
return HttpClient.get("https://api.curseforge.com/v1/mods/" + suffix).header("x-api-key", API_KEY).sendSerialized(klazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static byte[] unsalt(byte[] data, int salt) {
|
private static byte[] unsalt(byte[] data, int salt) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package io.gitlab.jfronny.resclone.fetchers;
|
package io.gitlab.jfronny.resclone.fetchers;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.HttpUtils;
|
import io.gitlab.jfronny.commons.http.client.HttpClient;
|
||||||
import io.gitlab.jfronny.resclone.Resclone;
|
import io.gitlab.jfronny.resclone.Resclone;
|
||||||
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 io.gitlab.jfronny.resclone.data.github.Repository;
|
||||||
|
@ -40,7 +40,7 @@ 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 {
|
try {
|
||||||
Release latestRelease = HttpUtils.get("https://api.github.com/repos/" + parts[0] + "/" + parts[1] + "/releases/latest").sendSerialized(Release.class);
|
Release latestRelease = HttpClient.get("https://api.github.com/repos/" + parts[0] + "/" + parts[1] + "/releases/latest").sendSerialized(Release.class);
|
||||||
String res = null;
|
String res = null;
|
||||||
|
|
||||||
for (Release.Asset asset : latestRelease.assets) {
|
for (Release.Asset asset : latestRelease.assets) {
|
||||||
|
@ -74,7 +74,7 @@ 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 {
|
try {
|
||||||
branch = HttpUtils.get("https://api.github.com/repos/" + repo).<Repository>sendSerialized(Repository.class).default_branch;
|
branch = HttpClient.get("https://api.github.com/repos/" + repo).<Repository>sendSerialized(Repository.class).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,7 +1,7 @@
|
||||||
package io.gitlab.jfronny.resclone.fetchers;
|
package io.gitlab.jfronny.resclone.fetchers;
|
||||||
|
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
import io.gitlab.jfronny.commons.HttpUtils;
|
import io.gitlab.jfronny.commons.http.client.HttpClient;
|
||||||
import io.gitlab.jfronny.resclone.Resclone;
|
import io.gitlab.jfronny.resclone.Resclone;
|
||||||
import io.gitlab.jfronny.resclone.data.modrinth.Version;
|
import io.gitlab.jfronny.resclone.data.modrinth.Version;
|
||||||
import net.minecraft.MinecraftVersion;
|
import net.minecraft.MinecraftVersion;
|
||||||
|
@ -28,7 +28,7 @@ public class ModrinthFetcher extends BasePackFetcher {
|
||||||
Date latestDate = null;
|
Date latestDate = null;
|
||||||
boolean foundMatchingVersion = false;
|
boolean foundMatchingVersion = false;
|
||||||
|
|
||||||
for (Version ver : HttpUtils.get("https://api.modrinth.com/v2/project/" + baseUrl + "/version")
|
for (Version ver : HttpClient.get("https://api.modrinth.com/v2/project/" + baseUrl + "/version")
|
||||||
.userAgent(Resclone.USER_AGENT)
|
.userAgent(Resclone.USER_AGENT)
|
||||||
.<List<Version>>sendSerialized(versionType)) {
|
.<List<Version>>sendSerialized(versionType)) {
|
||||||
if (foundMatchingVersion && !ver.game_versions.contains(version)) continue;
|
if (foundMatchingVersion && !ver.game_versions.contains(version)) continue;
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class FileResourcePackProviderMixin {
|
||||||
"resclone/" + meta.name(),
|
"resclone/" + meta.name(),
|
||||||
Text.literal(meta.name()),
|
Text.literal(meta.name()),
|
||||||
meta.forceEnable(),
|
meta.forceEnable(),
|
||||||
name -> new RescloneResourcePack(meta.zipPath().toFile(), meta.name()),
|
new RescloneResourcePack.Factory(meta.zipPath().toFile(), meta.name()),
|
||||||
type,
|
type,
|
||||||
ResourcePackProfile.InsertionPosition.TOP,
|
ResourcePackProfile.InsertionPosition.TOP,
|
||||||
source
|
source
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
"environment": "client"
|
"environment": "client"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"accessWidener": "resclone.accesswidener",
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.12.0",
|
"fabricloader": ">=0.12.0",
|
||||||
"minecraft": "*",
|
"minecraft": "*",
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
accessWidener v2 named
|
||||||
|
|
||||||
|
accessible class net/minecraft/resource/ZipResourcePack$ZipFileWrapper
|
||||||
|
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
|
Loading…
Reference in New Issue