diff --git a/fclauncher/fabric.go b/fclauncher/fabric.go
new file mode 100644
index 0000000..83bc09d
--- /dev/null
+++ b/fclauncher/fabric.go
@@ -0,0 +1,57 @@
+package main
+
+import (
+ "encoding/json"
+ "fmt"
+ "io"
+ "net/http"
+)
+
+type Fabric struct {
+
+}
+
+
+type FabricDefinition struct {
+ Separator string
+ Build int
+ Maven string
+ Version string
+ Stable bool
+}
+
+type FabricLibrary struct {
+ Name string
+ Url string
+}
+
+type FabricLibraries struct {
+ Client []FabricLibrary
+ Common []FabricLibrary
+ Server []FabricLibrary
+}
+
+type FabricMeta struct {
+ Version int
+ Libraries FabricLibraries
+ MainClass map[string]string
+}
+
+type FabricVersion struct {
+ Loader FabricDefinition
+ Intermediary FabricDefinition
+ LauncherMeta FabricMeta
+}
+
+func (Fabric)GetFabricVersions(mcVersion string) ([]FabricVersion, error) {
+ resp, err := http.Get("https://meta.fabricmc.net/v2/versions/loader/"+mcVersion)
+ if err != nil {
+ return []FabricVersion{}, fmt.Errorf("Unable to pull fabric version manifest: %s\n", err)
+ }
+ defer resp.Body.Close()
+ data, _ := io.ReadAll(resp.Body)
+ versions := []FabricVersion{}
+ json.Unmarshal(data, &versions)
+ fmt.Printf("fabric versions found for %s: %+v\n", mcVersion, versions)
+ return versions, nil
+}
diff --git a/fclauncher/frontend/src/Instances.svelte b/fclauncher/frontend/src/Instances.svelte
index e944e81..9720103 100644
--- a/fclauncher/frontend/src/Instances.svelte
+++ b/fclauncher/frontend/src/Instances.svelte
@@ -2,6 +2,7 @@
import {GetModpacks, GetModpack} from '../wailsjs/go/main/ModpackManager.js'
import {InstallVanilla, LaunchInstance, GetInstances, CheckUpdate} from '../wailsjs/go/main/InstanceManager.js'
import {GetVersions} from '../wailsjs/go/main/App.js'
+ import {GetFabricVersions} from '../wailsjs/go/main/Fabric.js'
import {onMount} from 'svelte'
import {loading} from './global.ts'
import {slide} from 'svelte/transition'
@@ -12,17 +13,30 @@
let instance: string
let addingInstance: boolean = false
let name: string = "New Modpack"
+ let loader: string = "none"
+ let fabric_ver: string = ""
+ let fab_versions: string[] = []
function updateLists(){
GetVersions().then((result) => {
modpacks = result
pack = modpacks[0]
name = modpacks[0]
+ updateLoaders()
})
GetInstances().then((result) => {
instances = result
instance = instances[0].InstanceName
})
+ }
+
+ function updateLoaders(){
+ GetFabricVersions(pack).then((result) => {
+ result.forEach((ver) => {
+ fab_versions.push(ver.Loader.Version)
+ })
+ fabric_ver = fab_versions[0]
+ })
}
onMount(() => {
@@ -47,6 +61,8 @@
function onchange(event){
name = event.target.value
+ pack = event.target.value
+ updateLoaders()
}
@@ -67,8 +83,25 @@
{/each}
+
+
+
+
+
+
+
+
+
+
+ {#if loader == "fabric"}
+
+ {/if}
diff --git a/fclauncher/frontend/wailsjs/go/main/Fabric.d.ts b/fclauncher/frontend/wailsjs/go/main/Fabric.d.ts
new file mode 100755
index 0000000..2b167c8
--- /dev/null
+++ b/fclauncher/frontend/wailsjs/go/main/Fabric.d.ts
@@ -0,0 +1,5 @@
+// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
+// This file is automatically generated. DO NOT EDIT
+import {main} from '../models';
+
+export function GetFabricVersions(arg1:string):Promise>;
diff --git a/fclauncher/frontend/wailsjs/go/main/Fabric.js b/fclauncher/frontend/wailsjs/go/main/Fabric.js
new file mode 100755
index 0000000..f5baf20
--- /dev/null
+++ b/fclauncher/frontend/wailsjs/go/main/Fabric.js
@@ -0,0 +1,7 @@
+// @ts-check
+// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
+// This file is automatically generated. DO NOT EDIT
+
+export function GetFabricVersions(arg1) {
+ return window['go']['main']['Fabric']['GetFabricVersions'](arg1);
+}
diff --git a/fclauncher/frontend/wailsjs/go/models.ts b/fclauncher/frontend/wailsjs/go/models.ts
index 848af65..6b9c44e 100755
--- a/fclauncher/frontend/wailsjs/go/models.ts
+++ b/fclauncher/frontend/wailsjs/go/models.ts
@@ -1,5 +1,142 @@
export namespace main {
+ export class FabricDefinition {
+ Separator: string;
+ Build: number;
+ Maven: string;
+ Version: string;
+ Stable: boolean;
+
+ static createFrom(source: any = {}) {
+ return new FabricDefinition(source);
+ }
+
+ constructor(source: any = {}) {
+ if ('string' === typeof source) source = JSON.parse(source);
+ this.Separator = source["Separator"];
+ this.Build = source["Build"];
+ this.Maven = source["Maven"];
+ this.Version = source["Version"];
+ this.Stable = source["Stable"];
+ }
+ }
+ export class FabricLibrary {
+ Name: string;
+ Url: string;
+
+ static createFrom(source: any = {}) {
+ return new FabricLibrary(source);
+ }
+
+ constructor(source: any = {}) {
+ if ('string' === typeof source) source = JSON.parse(source);
+ this.Name = source["Name"];
+ this.Url = source["Url"];
+ }
+ }
+ export class FabricLibraries {
+ Client: FabricLibrary[];
+ Common: FabricLibrary[];
+ Server: FabricLibrary[];
+
+ static createFrom(source: any = {}) {
+ return new FabricLibraries(source);
+ }
+
+ constructor(source: any = {}) {
+ if ('string' === typeof source) source = JSON.parse(source);
+ this.Client = this.convertValues(source["Client"], FabricLibrary);
+ this.Common = this.convertValues(source["Common"], FabricLibrary);
+ this.Server = this.convertValues(source["Server"], FabricLibrary);
+ }
+
+ convertValues(a: any, classs: any, asMap: boolean = false): any {
+ if (!a) {
+ return a;
+ }
+ if (a.slice && a.map) {
+ return (a as any[]).map(elem => this.convertValues(elem, classs));
+ } else if ("object" === typeof a) {
+ if (asMap) {
+ for (const key of Object.keys(a)) {
+ a[key] = new classs(a[key]);
+ }
+ return a;
+ }
+ return new classs(a);
+ }
+ return a;
+ }
+ }
+
+ export class FabricMeta {
+ Version: number;
+ Libraries: FabricLibraries;
+ MainClass: {[key: string]: string};
+
+ static createFrom(source: any = {}) {
+ return new FabricMeta(source);
+ }
+
+ constructor(source: any = {}) {
+ if ('string' === typeof source) source = JSON.parse(source);
+ this.Version = source["Version"];
+ this.Libraries = this.convertValues(source["Libraries"], FabricLibraries);
+ this.MainClass = source["MainClass"];
+ }
+
+ convertValues(a: any, classs: any, asMap: boolean = false): any {
+ if (!a) {
+ return a;
+ }
+ if (a.slice && a.map) {
+ return (a as any[]).map(elem => this.convertValues(elem, classs));
+ } else if ("object" === typeof a) {
+ if (asMap) {
+ for (const key of Object.keys(a)) {
+ a[key] = new classs(a[key]);
+ }
+ return a;
+ }
+ return new classs(a);
+ }
+ return a;
+ }
+ }
+ export class FabricVersion {
+ Loader: FabricDefinition;
+ Intermediary: FabricDefinition;
+ LauncherMeta: FabricMeta;
+
+ static createFrom(source: any = {}) {
+ return new FabricVersion(source);
+ }
+
+ constructor(source: any = {}) {
+ if ('string' === typeof source) source = JSON.parse(source);
+ this.Loader = this.convertValues(source["Loader"], FabricDefinition);
+ this.Intermediary = this.convertValues(source["Intermediary"], FabricDefinition);
+ this.LauncherMeta = this.convertValues(source["LauncherMeta"], FabricMeta);
+ }
+
+ convertValues(a: any, classs: any, asMap: boolean = false): any {
+ if (!a) {
+ return a;
+ }
+ if (a.slice && a.map) {
+ return (a as any[]).map(elem => this.convertValues(elem, classs));
+ } else if ("object" === typeof a) {
+ if (asMap) {
+ for (const key of Object.keys(a)) {
+ a[key] = new classs(a[key]);
+ }
+ return a;
+ }
+ return new classs(a);
+ }
+ return a;
+ }
+ }
export class Instance {
InstanceName: string;
ModpackId: string;
diff --git a/fclauncher/main.go b/fclauncher/main.go
index 75cc308..fde59e6 100644
--- a/fclauncher/main.go
+++ b/fclauncher/main.go
@@ -31,6 +31,7 @@ func main() {
&app.PrismLauncher,
&app.Java,
&app.Modpacks,
+ &Fabric{},
},
})