From ab0bfebe875649b07ca9549f3b0bd8b3106abaa1 Mon Sep 17 00:00:00 2001 From: Samuel Walker Date: Tue, 29 Oct 2024 21:48:59 -0600 Subject: [PATCH] Started work on downloading minecraft --- fclauncher/InstanceManager.go | 12 + fclauncher/app.go | 15 ++ fclauncher/frontend/src/Instances.svelte | 27 +-- fclauncher/frontend/wailsjs/go/main/App.d.ts | 2 + fclauncher/frontend/wailsjs/go/main/App.js | 4 + .../wailsjs/go/main/InstanceManager.d.ts | 2 + .../wailsjs/go/main/InstanceManager.js | 4 + fclauncher/minecraft.go | 216 ++++++++++++++++++ 8 files changed, 267 insertions(+), 15 deletions(-) create mode 100644 fclauncher/minecraft.go diff --git a/fclauncher/InstanceManager.go b/fclauncher/InstanceManager.go index bbb4ea0..c3645cc 100644 --- a/fclauncher/InstanceManager.go +++ b/fclauncher/InstanceManager.go @@ -11,6 +11,7 @@ import ( "runtime" "strconv" "strings" + "time" ) type Instance struct { @@ -146,6 +147,17 @@ func (i *InstanceManager)InstallModpack(modpack Modpack, instanceName string){ } +func (i *InstanceManager)InstallVanilla(version string, instanceName string) { + metadata, err := GetVersionMetadata(version) + if err != nil { + fmt.Printf("Unable to obtain metadata: %s\n", err) + } else { + fmt.Printf("Version Metadata: %+v", metadata) + } + time.Sleep(time.Second * 1) + return +} + func (i *InstanceManager)GetInstances() []Instance{ return i.instances } diff --git a/fclauncher/app.go b/fclauncher/app.go index 240b903..8d77820 100644 --- a/fclauncher/app.go +++ b/fclauncher/app.go @@ -61,6 +61,21 @@ func (a *App) CheckPrerequisites() { a.Java.InstallJavaVer(21) a.Status("Java 21 Installed") } + +} + +func (App) GetVersions() ([]string, error) { + manifest, err := GetVersionManifest() + if err != nil { + fmt.Printf("Manifest Error: %s\n", err) + return []string{}, err + } + versions := []string{} + for _, version := range manifest.Versions { + versions = append(versions, version.Id) + } + return versions, nil + } func (a *App) Status(status string) { diff --git a/fclauncher/frontend/src/Instances.svelte b/fclauncher/frontend/src/Instances.svelte index 4f75c5e..5ff508b 100644 --- a/fclauncher/frontend/src/Instances.svelte +++ b/fclauncher/frontend/src/Instances.svelte @@ -1,12 +1,13 @@