Skip to content

Commit 095bd47

Browse files
authored
Merge pull request #6262 from PCL-Community/fix#6230
fix(ModDownload): 愚人节版本无法下载 NeoForge
2 parents 730387d + 43db6f0 commit 095bd47

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

Plain Craft Launcher 2/Modules/Minecraft/ModDownload.vb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,10 @@
804804
VersionName = ApiName.Replace("1.20.1-", "")
805805
Version = New Version("19." & VersionName)
806806
Inherit = "1.20.1"
807+
ElseIf ApiName.StartsWith("0.") Then '0.25w14craftmine.3-beta
808+
VersionName = ApiName
809+
Version = New Version("0.0." & ApiName.BeforeFirst("-").AfterFirst(".").AfterFirst(".") & ".0") 'Minor 里有字母,但 Version 类的 Minor 是 Int 类型,只能这样写了
810+
Inherit = ApiName.BeforeFirst("-").AfterFirst(".").BeforeFirst(".")
807811
Else '20.4.30-beta
808812
VersionName = ApiName
809813
Version = New Version(ApiName.BeforeFirst("-"))
@@ -874,7 +878,7 @@
874878

875879
Private Function GetNeoForgeEntries(LatestJson As String, LatestLegacyJson As String) As List(Of DlNeoForgeListEntry)
876880
Dim VersionNames = RegexSearch(LatestLegacyJson & LatestJson,
877-
"(?<="")(1\.20\.1-)?\d+\.\d+\.\d+(-beta)?(?="")") '我寻思直接正则就行.jpg
881+
"(?<="")(?:(1\.20\.1-)?\d+\.\d+\.\d+|0\.[^.]+\.\d+)(-beta)?(?="")") '我寻思直接正则就行.jpg
878882
Dim Versions = VersionNames.
879883
Where(Function(name) name <> "47.1.82"). '这个版本虽然在版本列表中,但不能下载
880884
Select(Function(name) New DlNeoForgeListEntry(name)).ToList

Plain Craft Launcher 2/Pages/PageDownload/PageDownloadInstall.xaml.vb

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -364,25 +364,21 @@
364364
LabForge.Foreground = ColorGray1
365365
End If
366366
'NeoForge
367-
If Not SelectedMinecraftId.Contains("1.") OrElse Val(SelectedMinecraftId.Split(".")(1)) <= 19 Then
368-
CardNeoForge.Visibility = Visibility.Collapsed
367+
CardNeoForge.Visibility = Visibility.Visible
368+
Dim NeoForgeError As String = LoadNeoForgeGetError()
369+
CardNeoForge.MainSwap.Visibility = If(NeoForgeError Is Nothing, Visibility.Visible, Visibility.Collapsed)
370+
If NeoForgeError IsNot Nothing Then CardNeoForge.IsSwapped = True
371+
SetNeoForgeInfoShow(CardNeoForge.IsSwapped)
372+
If SelectedNeoForge Is Nothing Then
373+
BtnNeoForgeClear.Visibility = Visibility.Collapsed
374+
ImgNeoForge.Visibility = Visibility.Collapsed
375+
LabNeoForge.Text = If(NeoForgeError, "可以添加")
376+
LabNeoForge.Foreground = ColorGray4
369377
Else
370-
CardNeoForge.Visibility = Visibility.Visible
371-
Dim NeoForgeError As String = LoadNeoForgeGetError()
372-
CardNeoForge.MainSwap.Visibility = If(NeoForgeError Is Nothing, Visibility.Visible, Visibility.Collapsed)
373-
If NeoForgeError IsNot Nothing Then CardNeoForge.IsSwapped = True
374-
SetNeoForgeInfoShow(CardNeoForge.IsSwapped)
375-
If SelectedNeoForge Is Nothing Then
376-
BtnNeoForgeClear.Visibility = Visibility.Collapsed
377-
ImgNeoForge.Visibility = Visibility.Collapsed
378-
LabNeoForge.Text = If(NeoForgeError, "可以添加")
379-
LabNeoForge.Foreground = ColorGray4
380-
Else
381-
BtnNeoForgeClear.Visibility = Visibility.Visible
382-
ImgNeoForge.Visibility = Visibility.Visible
383-
LabNeoForge.Text = SelectedNeoForge.VersionName
384-
LabNeoForge.Foreground = ColorGray1
385-
End If
378+
BtnNeoForgeClear.Visibility = Visibility.Visible
379+
ImgNeoForge.Visibility = Visibility.Visible
380+
LabNeoForge.Text = SelectedNeoForge.VersionName
381+
LabNeoForge.Foreground = ColorGray1
386382
End If
387383
'Fabric
388384
If SelectedMinecraftId.Contains("1.") AndAlso Val(SelectedMinecraftId.Split(".")(1)) <= 13 Then
@@ -918,7 +914,6 @@
918914
''' 获取 NeoForge 的加载异常信息。若正常则返回 Nothing。
919915
''' </summary>
920916
Private Function LoadNeoForgeGetError() As String
921-
If Not SelectedMinecraftId.StartsWith("1.") Then Return "不可用"
922917
If SelectedOptiFine IsNot Nothing Then Return "与 OptiFine 不兼容"
923918
If SelectedForge IsNot Nothing Then Return "与 Forge 不兼容"
924919
If SelectedFabric IsNot Nothing Then Return "与 Fabric 不兼容"

0 commit comments

Comments
 (0)