Nattiden před 2 roky
rodič
revize
ebc58abb05

+ 1 - 0
Libraries/Versions/Pre-Release/1.20.5-pre1.md

@@ -1,6 +1,7 @@
 ---
 version-image-link: https://image.stapxs.cn/i/2024/04/11/image.png
 server-jar: https://piston-data.mojang.com/v1/objects/ec45f58d589dc1b00b25c6798dd10d2af70867e5/server.jar
+cats: ['1.21','1.20','1.20.5']
 ---
 ## 实验性特性
 ### 试炼密室

+ 1 - 0
Libraries/Versions/Pre-Release/1.20.5-pre2.md

@@ -2,6 +2,7 @@
 version-image-link: https://image.stapxs.cn/i/2024/04/16/image.png
 server-jar: https://piston-data.mojang.com/v1/objects/018c4aa3b1dcd5ac4487456de062072de750f729/server.jar
 translator: wuyuncheng-26
+cats: ['1.21','1.20','1.20.5']
 ---
 ## 新特性
 * 将 咔嚓 进度更名为 *Shear Brilliance*

+ 1 - 0
Libraries/Versions/Pre-Release/1.20.5-pre3.md

@@ -1,6 +1,7 @@
 ---
 version-image-link: https://image.stapxs.cn/i/2024/04/16/image_1.png
 server-jar: https://piston-data.mojang.com/v1/objects/5ac067ccc569ef9e2177cf4331c8e82d3e072692/server.jar
+cats: ['1.21','1.20','1.20.5']
 ---
 ## 技术性更改
 * 数据包版本现在为 41

+ 5 - 0
Pages/#1.21.yml

@@ -0,0 +1,5 @@
+name: 1.21存档
+cards:
+ - archive_noticebar
+ - T:Separator | content = 历史版本
+ - ${@VersionCategory|1.21}

+ 13 - 0
Resources/Scripts/FetchMainfest.py

@@ -0,0 +1,13 @@
+from Core.Debug import LogWarning
+import requests
+import json
+
+LAUNCHER_MANIFSET_URL = 'https://piston-meta.mojang.com/mc/game/version_manifest.json'
+
+def fetch():
+    try:
+        response = requests.get(LAUNCHER_MANIFSET_URL)
+        return json.loads(response.content)
+    except Exception as e:
+        LogWarning(f'获取版本列表失败:{e.with_traceback()}')
+        return {}

+ 3 - 11
Resources/Scripts/LatestVersion.py

@@ -1,18 +1,10 @@
 from Core.Debug import LogWarning, LogInfo
+from Core.ModuleManager import invokeModule, untilLoaded
 import requests
 import json
 
-LAUNCHER_MANIFSET_URL = 'https://piston-meta.mojang.com/mc/game/version_manifest.json'
-
-def fetch_mainfest():
-    try:
-        response = requests.get(LAUNCHER_MANIFSET_URL)
-        return json.loads(response.content)
-    except Exception as e:
-        LogWarning(f'获取版本列表失败:{e.with_traceback()}')
-        return {}
-
-MANIFSET = fetch_mainfest()
+untilLoaded('FetchMainfest')
+MANIFSET = invokeModule('FetchMainfest','fetch')()
 LATEST_VERSIONS = {'snapshot':'','release':''}
 LATEST_VERSIONS.update(MANIFSET['latest'])
 FULL_VERSIONS = MANIFSET.get('versions')

+ 17 - 0
Resources/Scripts/VersionCategory.py

@@ -0,0 +1,17 @@
+from Core.Project import Project
+from Core.Debug import LogWarning, LogInfo
+from Core.ModuleManager import invokeModule, untilLoaded
+import requests
+import json
+
+untilLoaded('FetchMainfest')
+MANIFSET = invokeModule('FetchMainfest','fetch')()
+FULL_VERSIONS = MANIFSET.get('versions')
+ID_LIST = [version.get('id') for version in FULL_VERSIONS]
+
+def script(cat_name,proj:Project,**kwargs):
+    cards = list(filter(lambda card:isinstance(card.get('cats'),list)
+           and cat_name in card.get('cats'), proj.getAllCard()))
+    cardrefs = [card['card_id'] for card in cards]
+    cardrefs.sort(key=lambda ver:ID_LIST.index(ver.split(':')[1]))
+    return str.join(';',cardrefs)