From 49cb28478f97ee029385d5d522ca5da72b37c399 Mon Sep 17 00:00:00 2001 From: SkyDynamic Date: Sat, 16 Dec 2023 22:55:20 +0800 Subject: [PATCH] support: mc 1.16.5 and 1.17.1 --- .github/workflows/matrix_includes.json | 12 +------ .github/workflows/scripts/summary.py | 6 ++-- build.gradle | 34 +++++++++++-------- common.gradle | 2 ++ settings.gradle | 3 ++ .../backup/ClientRestoreDelegate.java | 4 +++ .../mixin/MinecraftClientMixin.java | 4 +++ .../quickbackupmulti/utils/QbmManager.java | 4 +++ versions/1.16.5/gradle.properties | 4 +++ versions/1.16.5/qbm.accesswidener | 6 ++++ versions/1.17.1/gradle.properties | 4 +++ versions/1.17.1/qbm.accesswidener | 6 ++++ versions/1.20/gradle.properties | 4 +++ versions/1.20/qbm.accesswidener | 6 ++++ versions/mapping-1.16-1.17.txt | 0 versions/mapping-1.17-1.18.txt | 0 16 files changed, 71 insertions(+), 28 deletions(-) create mode 100644 versions/1.16.5/gradle.properties create mode 100644 versions/1.16.5/qbm.accesswidener create mode 100644 versions/1.17.1/gradle.properties create mode 100644 versions/1.17.1/qbm.accesswidener create mode 100644 versions/1.20/gradle.properties create mode 100644 versions/1.20/qbm.accesswidener create mode 100644 versions/mapping-1.16-1.17.txt create mode 100644 versions/mapping-1.17-1.18.txt diff --git a/.github/workflows/matrix_includes.json b/.github/workflows/matrix_includes.json index f87fc8c..7124ac5 100644 --- a/.github/workflows/matrix_includes.json +++ b/.github/workflows/matrix_includes.json @@ -1,11 +1 @@ -[ - { - "subproject_dir": "1.18.2" - }, - { - "subproject_dir": "1.19.4" - }, - { - "subproject_dir": "1.20.1" - } -] \ No newline at end of file +[ "1.16.5", "1.17.1", "1.18.2", "1.19.4", "1.20.1", "1.20.2", "1.20.3", "1.20.4" ] \ No newline at end of file diff --git a/.github/workflows/scripts/summary.py b/.github/workflows/scripts/summary.py index 5af30dc..d74aca5 100644 --- a/.github/workflows/scripts/summary.py +++ b/.github/workflows/scripts/summary.py @@ -2,7 +2,7 @@ A script to scan through all valid mod jars in build-artifacts.zip/$version/build/libs, and generate an artifact summary table for that to GitHub action step summary """ -__author__ = 'Fallen_Breath' +__author__ = ['Fallen_Breath', 'Sky_Dynamic'] import glob import json @@ -19,7 +19,7 @@ def read_prop(file_name: str, key: str) -> str: target_subproject = os.environ.get('TARGET_SUBPROJECT', '') with open('.github/workflows/matrix_includes.json') as f: - matrix: list[dict] = json.load(f) + matrix: list[str] = json.load(f) with open(os.environ['GITHUB_STEP_SUMMARY'], 'w') as f: f.write('## Build Artifacts Summary\n\n') @@ -27,7 +27,7 @@ def read_prop(file_name: str, key: str) -> str: f.write('| --- | --- | --- |\n') for m in matrix: - subproject = m['subproject_dir'] + subproject = m if target_subproject != '' and subproject != target_subproject: continue game_versions = read_prop('versions/{}/gradle.properties'.format(subproject), 'game_versions') diff --git a/build.gradle b/build.gradle index adfc0b4..af65eab 100644 --- a/build.gradle +++ b/build.gradle @@ -1,20 +1,26 @@ plugins { - id 'fabric-loom' version '1.4-SNAPSHOT' apply false - id 'maven-publish' - id 'com.replaymod.preprocess' version 'SNAPSHOT' + id "fabric-loom" version "1.4-SNAPSHOT" apply false + id "maven-publish" + id "com.replaymod.preprocess" version "SNAPSHOT" } preprocess { - def mc118 = createNode('1.18.2', 1_18_02, 'yarn') - def mc119 = createNode('1.19.4', 1_19_04, 'yarn') - def mc1201 = createNode('1.20.1', 1_20_01, 'yarn') - def mc1202 = createNode("1.20.2", 1_20_02, 'yarn') - def mc1203 = createNode("1.20.3", 1_20_03, 'yarn') - def mc1204 = createNode("1.20.4", 1_20_04, 'yarn') + def mc116 = createNode("1.16.5", 1_16_05, "yarn") + def mc117 = createNode("1.17.1", 1_17_01, "yarn") + def mc118 = createNode("1.18.2", 1_18_02, "yarn") + def mc119 = createNode("1.19.4", 1_19_04, "yarn") + def mc1200 = createNode("1.20", 1_20_00, "yarn") + def mc1201 = createNode("1.20.1", 1_20_01, "yarn") + def mc1202 = createNode("1.20.2", 1_20_02, "yarn") + def mc1203 = createNode("1.20.3", 1_20_03, "yarn") + def mc1204 = createNode("1.20.4", 1_20_04, "yarn") - mc118.link(mc119, file('versions/mapping-1.18-1.19.txt')) - mc119.link(mc1201, file('versions/mapping-1.19-1.20.txt')) - mc1201.link(mc1202, file('versions/mapping-1.19-1.20.txt')) - mc1202.link(mc1203, file('versions/mapping-1.19-1.20.txt')) - mc1203.link(mc1204, file('versions/mapping-1.19-1.20.txt')) + mc116.link(mc117, file("versions/mapping-1.16-1.17.txt")) + mc117.link(mc118, file("versions/mapping-1.17-1.18.txt")) + mc118.link(mc119, file("versions/mapping-1.18-1.19.txt")) + mc119.link(mc1200, file("versions/mapping-1.19-1.20.txt")) + mc1200.link(mc1201, file("versions/mapping-1.19-1.20.txt")) + mc1201.link(mc1202, file("versions/mapping-1.19-1.20.txt")) + mc1202.link(mc1203, file("versions/mapping-1.19-1.20.txt")) + mc1203.link(mc1204, file("versions/mapping-1.19-1.20.txt")) } \ No newline at end of file diff --git a/common.gradle b/common.gradle index 77cff06..d50b1b1 100644 --- a/common.gradle +++ b/common.gradle @@ -40,8 +40,10 @@ dependencies { mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + implementation group: 'commons-io', name: 'commons-io', version: '2.15.1' implementation group: 'org.yaml', name: 'snakeyaml', version: '2.0' + implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.1' } String versionSuffix = '' diff --git a/settings.gradle b/settings.gradle index 46c4657..bd1b542 100644 --- a/settings.gradle +++ b/settings.gradle @@ -27,8 +27,11 @@ pluginManagement { } def versions = Arrays.asList( + "1.16.5", + "1.17.1", "1.18.2", "1.19.4", + "1.20", "1.20.1", "1.20.2", "1.20.3", diff --git a/src/main/java/dev/skydynamic/quickbackupmulti/backup/ClientRestoreDelegate.java b/src/main/java/dev/skydynamic/quickbackupmulti/backup/ClientRestoreDelegate.java index d507fe5..58e3189 100644 --- a/src/main/java/dev/skydynamic/quickbackupmulti/backup/ClientRestoreDelegate.java +++ b/src/main/java/dev/skydynamic/quickbackupmulti/backup/ClientRestoreDelegate.java @@ -44,7 +44,11 @@ public void run() { Config.TEMP_CONFIG.setIsBackupValue(false); Text title = Text.of(tr("quickbackupmulti.toast.end_title")); Text content = Text.of(tr("quickbackupmulti.toast.end_content")); + //#if MC>=11800 SystemToast.show(minecraftClient.toastManager, SystemToast.Type.PERIODIC_NOTIFICATION, title, content); + //#else + //$$ SystemToast.show(minecraftClient.toastManager, SystemToast.Type.WORLD_BACKUP, title, content); + //#endif }); }); }); diff --git a/src/main/java/dev/skydynamic/quickbackupmulti/mixin/MinecraftClientMixin.java b/src/main/java/dev/skydynamic/quickbackupmulti/mixin/MinecraftClientMixin.java index c60d5e6..58ea521 100644 --- a/src/main/java/dev/skydynamic/quickbackupmulti/mixin/MinecraftClientMixin.java +++ b/src/main/java/dev/skydynamic/quickbackupmulti/mixin/MinecraftClientMixin.java @@ -25,7 +25,11 @@ void inj(CallbackInfo ci) { if (Config.TEMP_CONFIG.isBackup) { Text title = Text.of(tr("quickbackupmulti.toast.start_title")); Text content = Text.of(tr("quickbackupmulti.toast.start_content")); + //#if MC>=11800 SystemToast.show(this.toastManager, SystemToast.Type.PERIODIC_NOTIFICATION, title, content); + //#else + //$$ SystemToast.show(this.toastManager, SystemToast.Type.WORLD_BACKUP, title, content); + //#endif } } diff --git a/src/main/java/dev/skydynamic/quickbackupmulti/utils/QbmManager.java b/src/main/java/dev/skydynamic/quickbackupmulti/utils/QbmManager.java index e56105a..cc19435 100644 --- a/src/main/java/dev/skydynamic/quickbackupmulti/utils/QbmManager.java +++ b/src/main/java/dev/skydynamic/quickbackupmulti/utils/QbmManager.java @@ -136,7 +136,11 @@ public static int make(ServerCommandSource commandSource, int slot, String desc) try { Messenger.sendMessage(commandSource, Text.of(tr("quickbackupmulti.make.start"))); MinecraftServer server = commandSource.getServer(); + //#if MC>11800 server.saveAll(true, true, true); + //#else + //$$ server.save(true, true, true); + //#endif for (ServerWorld serverWorld : server.getWorlds()) { if (serverWorld == null || serverWorld.savingDisabled) continue; serverWorld.savingDisabled = true; diff --git a/versions/1.16.5/gradle.properties b/versions/1.16.5/gradle.properties new file mode 100644 index 0000000..8daa815 --- /dev/null +++ b/versions/1.16.5/gradle.properties @@ -0,0 +1,4 @@ +minecraft_version=1.16.5 +yarn_mappings=1.16.5+build.10 +fabric_version=0.42.0+1.16 +game_versions = 1.16.5 \ No newline at end of file diff --git a/versions/1.16.5/qbm.accesswidener b/versions/1.16.5/qbm.accesswidener new file mode 100644 index 0000000..79f1e58 --- /dev/null +++ b/versions/1.16.5/qbm.accesswidener @@ -0,0 +1,6 @@ +accessWidener v2 named + +accessible method net/minecraft/server/MinecraftServer runServer ()V +accessible field net/minecraft/server/MinecraftServer stopped Z +accessible field net/minecraft/server/MinecraftServer running Z +accessible field net/minecraft/client/MinecraftClient toastManager Lnet/minecraft/client/toast/ToastManager; \ No newline at end of file diff --git a/versions/1.17.1/gradle.properties b/versions/1.17.1/gradle.properties new file mode 100644 index 0000000..d3f456c --- /dev/null +++ b/versions/1.17.1/gradle.properties @@ -0,0 +1,4 @@ +minecraft_version=1.17.1 +yarn_mappings=1.17.1+build.65 +fabric_version=0.46.1+1.17 +game_versions = 1.17.1 \ No newline at end of file diff --git a/versions/1.17.1/qbm.accesswidener b/versions/1.17.1/qbm.accesswidener new file mode 100644 index 0000000..79f1e58 --- /dev/null +++ b/versions/1.17.1/qbm.accesswidener @@ -0,0 +1,6 @@ +accessWidener v2 named + +accessible method net/minecraft/server/MinecraftServer runServer ()V +accessible field net/minecraft/server/MinecraftServer stopped Z +accessible field net/minecraft/server/MinecraftServer running Z +accessible field net/minecraft/client/MinecraftClient toastManager Lnet/minecraft/client/toast/ToastManager; \ No newline at end of file diff --git a/versions/1.20/gradle.properties b/versions/1.20/gradle.properties new file mode 100644 index 0000000..fba03cc --- /dev/null +++ b/versions/1.20/gradle.properties @@ -0,0 +1,4 @@ +minecraft_version=1.20 +yarn_mappings=1.20+build.1 +fabric_version=0.83.0+1.20 +game_versions = 1.20 diff --git a/versions/1.20/qbm.accesswidener b/versions/1.20/qbm.accesswidener new file mode 100644 index 0000000..79f1e58 --- /dev/null +++ b/versions/1.20/qbm.accesswidener @@ -0,0 +1,6 @@ +accessWidener v2 named + +accessible method net/minecraft/server/MinecraftServer runServer ()V +accessible field net/minecraft/server/MinecraftServer stopped Z +accessible field net/minecraft/server/MinecraftServer running Z +accessible field net/minecraft/client/MinecraftClient toastManager Lnet/minecraft/client/toast/ToastManager; \ No newline at end of file diff --git a/versions/mapping-1.16-1.17.txt b/versions/mapping-1.16-1.17.txt new file mode 100644 index 0000000..e69de29 diff --git a/versions/mapping-1.17-1.18.txt b/versions/mapping-1.17-1.18.txt new file mode 100644 index 0000000..e69de29