From ee1dade57d3035a3ce682ea0e2ced420265587b9 Mon Sep 17 00:00:00 2001 From: 33 Date: Tue, 10 Oct 2023 21:37:06 +0800 Subject: [PATCH] feat: update dependencies --- README.md | 3 ++- build.gradle.kts | 18 +++++++++--------- .../java/i18nupdatemod/core/ResourcePack.java | 2 +- .../java/i18nupdatemod/util/DigestUtil.java | 18 ++++++++++++------ src/main/resources/i18nMetaData.json | 14 +++++++------- 5 files changed, 31 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index c530795..42b89bd 100644 --- a/README.md +++ b/README.md @@ -28,4 +28,5 @@ ## 支持的「简体中文资源包」 为了尽可能实用,目前本Mod会根据游戏版本自动下载或转换「简体中文资源包」。 - 官方支持:支持1.10.2、1.12.2、1.16.5、1.18.2、1.19.3 -- 自动转换:支持其它所有版本,会合并最近的双版本,尽可能做最大化的支持;即便是官方支持版本,也会合并一些其它版本的资源包 \ No newline at end of file +- 自动转换:支持其它所有版本,会合并最近的双版本,尽可能做最大化的支持;即便是官方支持版本,也会合并一些其它版本的资源包 +- 特别说明:1.13开始将语言文件变化为json格式,所以不能将1.12.2的资源包用于1.13以上,反之同理 \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index d442692..ee7b653 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,8 +1,8 @@ plugins { - id("com.github.johnrengelman.shadow") version ("7.1.2") id("java") - id("com.modrinth.minotaur") version "2.6.0" - id("io.github.CDAGaming.cursegradle") version "1.6.0" + id("com.github.johnrengelman.shadow") version "8.1.1" + id("com.modrinth.minotaur") version "2.8.4" + id("io.github.CDAGaming.cursegradle") version "1.6.1" } group = "i18nupdatemod" @@ -43,17 +43,17 @@ configurations.configureEach { } dependencies { - testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.2") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.2") + testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0") + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.0") implementation("net.runelite.archive-patcher:archive-patcher-applier:1.2") - compileOnly("org.jetbrains:annotations:24.0.0") + compileOnly("org.jetbrains:annotations:24.0.1") - implementation("net.fabricmc:fabric-loader:0.14.12") + implementation("net.fabricmc:fabric-loader:0.14.22") implementation("cpw.mods:modlauncher:8.1.3") implementation("net.minecraft:launchwrapper:1.12") - implementation("commons-io:commons-io:2.11.0") - implementation("org.ow2.asm:asm:9.4") + implementation("commons-io:commons-io:2.14.0") + implementation("org.ow2.asm:asm:9.6") implementation("com.google.code.gson:gson:2.10.1") } diff --git a/src/main/java/i18nupdatemod/core/ResourcePack.java b/src/main/java/i18nupdatemod/core/ResourcePack.java index 54e4af2..6c890e5 100644 --- a/src/main/java/i18nupdatemod/core/ResourcePack.java +++ b/src/main/java/i18nupdatemod/core/ResourcePack.java @@ -84,7 +84,7 @@ private void downloadFull(String fileUrl, String md5Url) throws IOException { Files.move(downloadTmp, tmpFilePath, StandardCopyOption.REPLACE_EXISTING); Log.debug(String.format("Updates temp file: %s", tmpFilePath)); } catch (Exception e) { - Log.warning("Error which downloading: ", e); + Log.warning("Error while downloading: %s", e); } if (!Files.exists(tmpFilePath)) { throw new FileNotFoundException("Tmp file not found."); diff --git a/src/main/java/i18nupdatemod/util/DigestUtil.java b/src/main/java/i18nupdatemod/util/DigestUtil.java index bb65e46..ffc790d 100644 --- a/src/main/java/i18nupdatemod/util/DigestUtil.java +++ b/src/main/java/i18nupdatemod/util/DigestUtil.java @@ -18,12 +18,18 @@ public static String md5Hex(Path file) throws IOException, NoSuchAlgorithmExcept dig.update(buf, 0, read); } - byte[] data = dig.digest(); - StringBuilder sb = new StringBuilder(); - for (byte d : data) { - sb.append(Integer.toHexString(d)); - } - return sb.toString(); + return hexString(dig.digest()); + } + } + + private static final String HEX = "0123456789ABCDEF"; + + public static String hexString(byte[] data) { + StringBuilder sb = new StringBuilder(); + for (byte d : data) { + sb.append(HEX.charAt((d & 0xf0) >>> 4)); + sb.append(HEX.charAt(d & 0xf)); } + return sb.toString(); } } diff --git a/src/main/resources/i18nMetaData.json b/src/main/resources/i18nMetaData.json index c9fbea3..eebaedf 100644 --- a/src/main/resources/i18nMetaData.json +++ b/src/main/resources/i18nMetaData.json @@ -103,44 +103,44 @@ ], "assets": [ { - "loader": "Forge", "targetVersion": "1.10.2", + "loader": "Forge", "filename": "Minecraft-Mod-Language-Modpack-1-10-2.zip", "md5Filename": "1.10.2.md5" }, { - "loader": "Forge", "targetVersion": "1.12.2", + "loader": "Forge", "filename": "Minecraft-Mod-Language-Modpack.zip", "md5Filename": "1.12.2.md5" }, { - "loader": "Forge", "targetVersion": "1.16.5", + "loader": "Forge", "filename": "Minecraft-Mod-Language-Modpack-1-16.zip", "md5Filename": "1.16.md5" }, { - "loader": "Fabric", "targetVersion": "1.16.5", + "loader": "Fabric", "filename": "Minecraft-Mod-Language-Modpack-1-16-Fabric.zip", "md5Filename": "1.16-fabric.md5" }, { - "loader": "Forge", "targetVersion": "1.18.2", + "loader": "Forge", "filename": "Minecraft-Mod-Language-Modpack-1-18.zip", "md5Filename": "1.18.md5" }, { - "loader": "Fabric", "targetVersion": "1.18.2", + "loader": "Fabric", "filename": "Minecraft-Mod-Language-Modpack-1-18-Fabric.zip", "md5Filename": "1.18-fabric.md5" }, { - "loader": "Forge", "targetVersion": "1.19.3", + "loader": "Forge", "filename": "Minecraft-Mod-Language-Modpack-1-19.zip", "md5Filename": "1.19.md5" }