Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持 unlisted-versions-of-minecraft #4555

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d7c4b5d
支持 unlisted-versions-of-minecraft
zkitefly Aug 20, 2024
558cdcb
update
zkitefly Aug 20, 2024
db3530d
update
zkitefly Aug 20, 2024
802a223
update
zkitefly Aug 20, 2024
7832a8c
修改筛选器
zkitefly Aug 20, 2024
f8b045a
Fix
zkitefly Aug 20, 2024
e5a81b5
修复 2.0 的愚人节版本分类
zkitefly Aug 20, 2024
e28513a
Update Plain Craft Launcher 2/Modules/Minecraft/ModMinecraft.vb
zkitefly Aug 20, 2024
9c5d2f0
修复标签为 pending 时错误分类的问题
zkitefly Aug 20, 2024
fae7b56
gitcode.com 不要多线程
zkitefly Aug 20, 2024
3917adc
Merge branch 'uvmc' of https://github.com/zkitefly/PCL2 into uvmc
zkitefly Aug 20, 2024
8411bbd
Fix
zkitefly Aug 20, 2024
fddf519
Fix
zkitefly Aug 20, 2024
ad797b6
Uvmc test (#1)
zkitefly Aug 20, 2024
a81b321
point -> .
zkitefly Aug 20, 2024
76d0f01
Uvmc test (#2)
zkitefly Aug 29, 2024
f4fb085
Update ModMinecraft.vb
zkitefly Aug 31, 2024
c4b59de
防止误判
zkitefly Aug 31, 2024
7965ca8
Update ModDownload.vb
zkitefly Aug 31, 2024
72357c7
Merge remote-tracking branch 'upstream/main' into uvmc
zkitefly Sep 21, 2024
79005a1
Update ModDownload.vb
zkitefly Sep 21, 2024
3491e4e
Update Plain Craft Launcher 2/Modules/Minecraft/ModDownload.vb
zkitefly Sep 21, 2024
499dba5
Update Plain Craft Launcher 2/Modules/Minecraft/ModDownload.vb
zkitefly Sep 21, 2024
4561a71
Update ModDownload.vb
zkitefly Sep 21, 2024
290bee7
Merge branch 'main' into uvmc
zkitefly Oct 25, 2024
7f1de5d
Update Plain Craft Launcher 2/Modules/Minecraft/ModMinecraft.vb
zkitefly Oct 25, 2024
ae87513
Update Plain Craft Launcher 2/Modules/Minecraft/ModMinecraft.vb
zkitefly Oct 26, 2024
3e86c84
Update Plain Craft Launcher 2/Modules/Minecraft/ModMinecraft.vb
zkitefly Oct 27, 2024
5a9cd80
Update ModMinecraft.vb
zkitefly Nov 9, 2024
17863d5
update link
zkitefly Nov 22, 2024
72ebd5f
update download list type
zkitefly Nov 22, 2024
5fc5133
Merge branch 'main' into uvmc
zkitefly Nov 22, 2024
e68b0d1
Update ModNet.vb
zkitefly Nov 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Plain Craft Launcher 2/Modules/Base/ModNet.vb
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ Capture:
Next
'是否禁用多线程,以及规定碎片大小
Dim TargetUrl As String = GetSource().Url
If TargetUrl.Contains("pcl2-server") OrElse TargetUrl.Contains("gitcode.net") OrElse TargetUrl.Contains("github.com") OrElse TargetUrl.Contains("modrinth") Then Return Nothing
If TargetUrl.Contains("pcl2-server") OrElse TargetUrl.Contains("gitcode") OrElse TargetUrl.Contains("github.com") OrElse TargetUrl.Contains("modrinth") Then Return Nothing
'寻找最大碎片
'FUTURE: 下载引擎重做,计算下载源平均链接时间和线程下载速度,按最高时间节省来开启多线程
Dim FilePieceMax As NetThread = Threads
Expand Down
53 changes: 46 additions & 7 deletions Plain Craft Launcher 2/Modules/Minecraft/ModDownload.vb
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,26 @@
Try
Dim Versions As JArray = Json("versions")
If Versions.Count < 200 Then Throw New Exception("获取到的版本列表长度不足(" & Json.ToString & ")")
'添加 PCL 特供项
If File.Exists(PathTemp & "Cache\download.json") Then Versions.Merge(GetJson(ReadFile(PathTemp & "Cache\download.json")))
Dim CacheFilePath As String = PathTemp & "Cache\uvmc-download.json"
If Not File.Exists(CacheFilePath) Then
Try
'下载未列出的版本文件
Dim UnlistedJson As JObject = NetGetCodeByRequestRetry("https://zkitefly.github.io/unlisted-versions-of-minecraft/version_manifest.json", IsJson:=True)
'替换 "pending" 和 "release" 为 "snapshot"
For Each versionuvmc As JObject In UnlistedJson("versions")
If versionuvmc("type").ToString() = "pending" OrElse versionuvmc("type").ToString() = "release" Then
versionuvmc("type") = "snapshot"
End If
Next
'将下载的内容保存至缓存文件
File.WriteAllText(CacheFilePath, UnlistedJson.ToString())
Catch ex As Exception
Log("[Download] 未列出的版本官方源下载失败: " & ex.Message)
End Try
Else '如果缓存文件存在,则将其读取并合并到版本列表中
Dim CachedJson As JObject = GetJson(ReadFile(CacheFilePath))
Versions.Merge(CachedJson("versions"))
End If
'返回
Loader.Output = New DlClientListResult With {.IsOfficial = True, .SourceName = "Mojang 官方源", .Value = Json}
'解析更新提示(Release)
Expand Down Expand Up @@ -236,8 +254,26 @@
Try
Dim Versions As JArray = Json("versions")
If Versions.Count < 200 Then Throw New Exception("获取到的版本列表长度不足(" & Json.ToString & ")")
'添加 PCL 特供项
If File.Exists(PathTemp & "Cache\download.json") Then Versions.Merge(GetJson(ReadFile(PathTemp & "Cache\download.json")))
Dim CacheFilePath As String = PathTemp & "Cache\uvmc-download.json"
If Not File.Exists(CacheFilePath) Then
Try
'下载未列出的版本文件
Dim UnlistedJson As JObject = NetGetCodeByRequestRetry("https://raw.gitcode.com/zkitefly/unlisted-versions-of-minecraft/raw/main/version_manifest.json", IsJson:=True)
'替换 "pending" 和 "release" 为 "snapshot"
For Each versionuvmc As JObject In UnlistedJson("versions")
If versionuvmc("type").ToString() = "pending" OrElse versionuvmc("type").ToString() = "release" Then
versionuvmc("type") = "snapshot"
End If
Next
'将下载的内容保存至缓存文件
File.WriteAllText(CacheFilePath, UnlistedJson.ToString())
Catch ex As Exception
Log("[Download] 未列出的版本镜像源下载失败: " & ex.Message)
End Try
Else '如果缓存文件存在,则将其读取并合并到版本列表中
Dim CachedJson As JObject = GetJson(ReadFile(CacheFilePath))
Versions.Merge(CachedJson("versions"))
End If
'返回
Loader.Output = New DlClientListResult With {.IsOfficial = False, .SourceName = "BMCLAPI", .Value = Json}
Catch ex As Exception
Expand Down Expand Up @@ -1168,11 +1204,13 @@
Original.
Replace("https://piston-data.mojang.com", "https://bmclapi2.bangbang93.com/maven").
Replace("https://piston-meta.mojang.com", "https://bmclapi2.bangbang93.com/maven").
Replace("https://libraries.minecraft.net", "https://bmclapi2.bangbang93.com/maven"),
Replace("https://libraries.minecraft.net", "https://bmclapi2.bangbang93.com/maven").
Replace("https://zkitefly.github.io/unlisted-versions-of-minecraft", "https://raw.gitcode.com/zkitefly/unlisted-versions-of-minecraft/raw/main"),
Original.
Replace("https://piston-data.mojang.com", "https://bmclapi2.bangbang93.com/libraries").
Replace("https://piston-meta.mojang.com", "https://bmclapi2.bangbang93.com/libraries").
Replace("https://libraries.minecraft.net", "https://bmclapi2.bangbang93.com/libraries"),
Replace("https://libraries.minecraft.net", "https://bmclapi2.bangbang93.com/libraries").
Replace("https://zkitefly.github.io/unlisted-versions-of-minecraft", "https://raw.gitcode.com/zkitefly/unlisted-versions-of-minecraft/raw/main"),
Original
}
End Function
Expand All @@ -1195,7 +1233,8 @@
Replace("https://piston-data.mojang.com", "https://bmclapi2.bangbang93.com").
Replace("https://piston-meta.mojang.com", "https://bmclapi2.bangbang93.com").
Replace("https://launcher.mojang.com", "https://bmclapi2.bangbang93.com").
Replace("https://launchermeta.mojang.com", "https://bmclapi2.bangbang93.com"),
Replace("https://launchermeta.mojang.com", "https://bmclapi2.bangbang93.com").
Replace("https://zkitefly.github.io/unlisted-versions-of-minecraft", "https://raw.gitcode.com/zkitefly/unlisted-versions-of-minecraft/raw/main"),
zkitefly marked this conversation as resolved.
Show resolved Hide resolved
Original
}
End Function
Expand Down
20 changes: 14 additions & 6 deletions Plain Craft Launcher 2/Modules/Minecraft/ModMinecraft.vb
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,10 @@ Public Module ModMinecraft
Else
ReleaseTime = JsonObject("releaseTime").ToObject(Of Date)
End If
If ReleaseTime.Year > 2000 AndAlso ReleaseTime.Year < 2013 Then
_Version.McName = "Old"
GoTo VersionSearchFinish
End If
If ReleaseTime.Year > 2000 AndAlso (ReleaseTime.Year < 2011 OrElse (ReleaseTime.Year = 2011 AndAlso ReleaseTime.Month < 9) OrElse (ReleaseTime.Year = 2011 AndAlso ReleaseTime.Month = 9 AndAlso ReleaseTime.Day <= 20)) Then ' 2000 年到 2011 年 9 月 20 日之间
zkitefly marked this conversation as resolved.
Show resolved Hide resolved
_Version.McName = "Old"
GoTo VersionSearchFinish
End If
Catch
ReleaseTime = New Date(1970, 1, 1, 15, 0, 0)
End Try
Expand Down Expand Up @@ -1029,8 +1029,16 @@ ExitDataLoad:
''' </summary>
Public Function GetMcFoolName(Name As String) As String
Name = Name.ToLower
If Name.StartsWithF("2.0") Then
Return "这个秘密计划了两年的更新将游戏推向了一个新高度!"
If Name.StartsWith("2.0") OrElse Name.StartsWith("2point0") Then
Dim Tag = ""
If Name.EndsWith("red") Then
Tag = "(红色版本)"
ElseIf Name.EndsWith("blue") Then
Tag = "(蓝色版本)"
ElseIf Name.EndsWith("purple") Then
Tag = "(紫色版本)"
End If
Return "这个秘密计划了两年的更新将游戏推向了一个新高度!" & Tag
ElseIf Name.StartsWithF("20w14inf") OrElse Name = "20w14∞" Then
Return "我们加入了 20 亿个新的维度,让无限的想象变成了现实!"
ElseIf Name = "15w14a" Then
Expand Down
32 changes: 17 additions & 15 deletions Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.vb
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ Public Module ModDownloadLib
Else
NewItem.Info = Entry("lore").ToString
End If
If Entry("url").ToString.Contains("pcl") Then NewItem.Info = "[PCL 特供下载] " & NewItem.Info
If Entry("url").ToString.Contains("unlisted-versions-of-minecraft") Then NewItem.Info = "[UVMC 特供下载] " & NewItem.Info
zkitefly marked this conversation as resolved.
Show resolved Hide resolved
AddHandler NewItem.Click, OnClick
'建立菜单
If IsSaveOnly Then
Expand Down Expand Up @@ -253,7 +253,7 @@ Public Module ModDownloadLib
Dim Id As String = VersionJson("id").ToString.ToLower
If Id = "3d shareware v1.34" Then
WikiName = "3D_Shareware_v1.34"
ElseIf Id = "2.0" Then
ElseIf Id = "2.0" OrElse Id.StartsWithF("2point0") Then
WikiName = "Java版2.0"
ElseIf Id = "1.rv-pre1" Then
WikiName = "Java版1.RV-Pre1"
Expand All @@ -279,31 +279,33 @@ Public Module ModDownloadLib
WikiName = "Java版RC2"
ElseIf Id.StartsWithF("1.19_deep_dark_experimental_snapshot-") OrElse Id.StartsWithF("1_19_deep_dark_experimental_snapshot-") Then
WikiName = Id.Replace("1_19", "1.19").Replace("1.19_deep_dark_experimental_snapshot-", "Java版Deep_Dark_Experimental_Snapshot_")
ElseIf Id = "b1.9-pre6" Then
WikiName = "Java版Beta_1.9_Prerelease_6"
ElseIf Id.Contains("b1.9") Then
WikiName = "Java版Beta_1.9_Prerelease"
WikiName = "Java版" & Id.Replace("b", "Beta_").Replace("-pre", "_Prerelease_")
ElseIf Id = "c0.30_01c" OrElse Id = "c0.30_survival" OrElse Id.Contains("生存测试") OrElse Id = "c0.30-1" OrElse Id = "c0.30-2" Then
WikiName = "Java版Classic_0.30(生存模式)"
ElseIf Id.StartsWithF("c0.31") OrElse Id = "in-20100130" Then
WikiName = "Java版Indev_0.31_20100130"
ElseIf Id = "b1.6-tb3" Then
WikiName = "Java版Beta_1.6_Test_Build_3"
ElseIf VersionJson("type") = "release" OrElse VersionJson("type") = "snapshot" OrElse VersionJson("type") = "special" Then
WikiName = If(Id.Contains("w"), "", "Java版") & Id.Replace(" Pre-Release ", "-pre")
ElseIf Id.StartsWithF("b") Then
WikiName = "Java版" & Id.TrimEnd("a", "b", "c", "d", "e").Replace("b", "Beta_")
WikiName = "Java版" & Id.Replace("b", "Beta_").Replace("tb3", "Test_Build_3")
ElseIf Id.StartsWithF("a") Then
WikiName = "Java版" & Id.TrimEnd("a", "b", "c", "d", "e").Replace("a", "Alpha_v")
ElseIf Id = "inf-20100618" Then
WikiName = "Java版Infdev_20100618"
ElseIf Id = "c0.30_01c" OrElse Id = "c0.30_survival" OrElse Id.Contains("生存测试") Then
WikiName = "Java版Classic_0.30(生存模式)"
ElseIf Id.StartsWithF("c0.31") Then
WikiName = "Java版Indev_0.31_20100130"
WikiName = "Java版" & Id.Replace("a", "Alpha_v")
ElseIf Id.StartsWithF("inf-") Then
WikiName = "Java版" & Id.Replace("inf-", "Infdev_")
ElseIf Id.StartsWithF("in-") Then
WikiName = "Java版" & Id.Replace("in-", "Indev_")
ElseIf Id.StartsWithF("c") Then
WikiName = "Java版" & Id.Replace("c", "Classic_")
WikiName = "Java版" & Id.Replace("c", "Classic_").Replace("st", "SURVIVAL_TEST")
ElseIf Id.StartsWithF("rd-") Then
WikiName = "Java版Pre-classic_" & Id
Else
Log("[Error] 未知的版本格式:" & Id & "。", LogLevel.Feedback)
Exit Sub
End If
OpenWebsite("https://zh.minecraft.wiki/w/" & WikiName.Replace("_experimental-snapshot-", "-exp"))
OpenWebsite("https://zh.minecraft.wiki/w/Special:%E6%90%9C%E7%B4%A2?search=" & WikiName.Replace("_experimental-snapshot-", "-exp"))
End Sub

#End Region
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,18 @@
Not Version("id").ToString.ToLower.Contains("combat") AndAlso
Not Version("id").ToString.ToLower.Contains("rc") AndAlso
Not Version("id").ToString.ToLower.Contains("experimental") AndAlso
Not Version("id").ToString.ToLower.Equals("1.2") AndAlso
Not Version("id").ToString.ToLower.Contains("pre") Then
Type = "正式版"
Version("type") = "release"
End If
'愚人节版本
Select Case Version("id").ToString.ToLower
Case "2point0_blue", "2point0_red", "2point0_purple", "2.0_blue", "2.0_red", "2.0_purple", "2.0"
Type = "愚人节版"
Version("id") = Version("id").ToString().Replace("point", ".")
Version("type") = "special"
Version.Add("lore", GetMcFoolName(Version("id")))
Case "20w14infinite", "20w14∞"
Type = "愚人节版"
Version("id") = "20w14∞"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,12 +603,18 @@
Not Version("id").ToString.ToLower.Contains("combat") AndAlso
Not Version("id").ToString.ToLower.Contains("rc") AndAlso
Not Version("id").ToString.ToLower.Contains("experimental") AndAlso
Not Version("id").ToString.ToLower.Equals("1.2") AndAlso
Not Version("id").ToString.ToLower.Contains("pre") Then
Type = "正式版"
Version("type") = "release"
End If
'愚人节版本
Select Case Version("id").ToString.ToLower
Case "2point0_blue", "2point0_red", "2point0_purple", "2.0_blue", "2.0_red", "2.0_purple", "2.0"
Type = "愚人节版"
Version("id") = Version("id").ToString().Replace("point", ".")
Version("type") = "special"
Version.Add("lore", GetMcFoolName(Version("id")))
Case "20w14infinite", "20w14∞"
Type = "愚人节版"
Version("id") = "20w14∞"
Expand Down