quilt implemented
This commit is contained in:
parent
46bfc92370
commit
a614f71aa1
@ -65,7 +65,6 @@ func (i *InstanceManager)SearchInstances() {
|
|||||||
io.Copy(buff, f)
|
io.Copy(buff, f)
|
||||||
instance := Instance{}
|
instance := Instance{}
|
||||||
json.Unmarshal(buff.Bytes(), &instance)
|
json.Unmarshal(buff.Bytes(), &instance)
|
||||||
fmt.Printf("Found Instance: %+v\n", instance)
|
|
||||||
i.instances = append(i.instances, instance)
|
i.instances = append(i.instances, instance)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -397,6 +396,8 @@ func (i *InstanceManager)InstallQuilt(instance string, quiltVersion string) {
|
|||||||
|
|
||||||
instanceObject.Libraries = append(instanceObject.Libraries, filepath.Join(ProcessMavenPath(metadata.Intermediary.Maven), ProcessMavenFilename(metadata.Intermediary.Maven)))
|
instanceObject.Libraries = append(instanceObject.Libraries, filepath.Join(ProcessMavenPath(metadata.Intermediary.Maven), ProcessMavenFilename(metadata.Intermediary.Maven)))
|
||||||
|
|
||||||
|
instanceObject.Libraries = append(instanceObject.Libraries, filepath.Join(ProcessMavenPath(metadata.Hashed.Maven), ProcessMavenFilename(metadata.Hashed.Maven)))
|
||||||
|
|
||||||
instanceObject.MainClass = metadata.LauncherMeta.MainClass["client"]
|
instanceObject.MainClass = metadata.LauncherMeta.MainClass["client"]
|
||||||
instanceObject.QuiltVersion = quiltVersion
|
instanceObject.QuiltVersion = quiltVersion
|
||||||
dir, _ := os.UserConfigDir()
|
dir, _ := os.UserConfigDir()
|
||||||
|
@ -78,7 +78,7 @@
|
|||||||
break
|
break
|
||||||
case "quilt":
|
case "quilt":
|
||||||
InstallQuilt(name, quilt_ver).then(() => {
|
InstallQuilt(name, quilt_ver).then(() => {
|
||||||
addingInstance = false
|
$addingInstance = false
|
||||||
$loading = false
|
$loading = false
|
||||||
updateLists()
|
updateLists()
|
||||||
})
|
})
|
||||||
|
@ -350,6 +350,7 @@ export namespace main {
|
|||||||
export class QuiltVersion {
|
export class QuiltVersion {
|
||||||
Loader: QuiltDefinition;
|
Loader: QuiltDefinition;
|
||||||
Intermediary: QuiltDefinition;
|
Intermediary: QuiltDefinition;
|
||||||
|
Hashed: QuiltDefinition;
|
||||||
LauncherMeta: QuiltMeta;
|
LauncherMeta: QuiltMeta;
|
||||||
|
|
||||||
static createFrom(source: any = {}) {
|
static createFrom(source: any = {}) {
|
||||||
@ -360,6 +361,7 @@ export namespace main {
|
|||||||
if ('string' === typeof source) source = JSON.parse(source);
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
this.Loader = this.convertValues(source["Loader"], QuiltDefinition);
|
this.Loader = this.convertValues(source["Loader"], QuiltDefinition);
|
||||||
this.Intermediary = this.convertValues(source["Intermediary"], QuiltDefinition);
|
this.Intermediary = this.convertValues(source["Intermediary"], QuiltDefinition);
|
||||||
|
this.Hashed = this.convertValues(source["Hashed"], QuiltDefinition);
|
||||||
this.LauncherMeta = this.convertValues(source["LauncherMeta"], QuiltMeta);
|
this.LauncherMeta = this.convertValues(source["LauncherMeta"], QuiltMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,6 +549,9 @@ func GetBaseLaunchArgs(mcVersion string, instance Instance, libDir string, binDi
|
|||||||
}
|
}
|
||||||
for _, lib := range instance.Libraries {
|
for _, lib := range instance.Libraries {
|
||||||
arg += filepath.Join(libDir, lib) + separater
|
arg += filepath.Join(libDir, lib) + separater
|
||||||
|
if _, err := os.Stat(filepath.Join(libDir, lib)); err != nil {
|
||||||
|
fmt.Printf("Error: missing library: %s\n", lib)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
arg += filepath.Join(binDir, mcVersion, "client.jar")
|
arg += filepath.Join(binDir, mcVersion, "client.jar")
|
||||||
args = append(args, arg)
|
args = append(args, arg)
|
||||||
|
@ -45,6 +45,7 @@ type QuiltMeta struct {
|
|||||||
type QuiltVersion struct {
|
type QuiltVersion struct {
|
||||||
Loader QuiltDefinition
|
Loader QuiltDefinition
|
||||||
Intermediary QuiltDefinition
|
Intermediary QuiltDefinition
|
||||||
|
Hashed QuiltDefinition
|
||||||
LauncherMeta QuiltMeta
|
LauncherMeta QuiltMeta
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +58,6 @@ func (Quilt)GetQuiltVersions(mcVersion string) ([]QuiltVersion, error) {
|
|||||||
data, _ := io.ReadAll(resp.Body)
|
data, _ := io.ReadAll(resp.Body)
|
||||||
versions := []QuiltVersion{}
|
versions := []QuiltVersion{}
|
||||||
json.Unmarshal(data, &versions)
|
json.Unmarshal(data, &versions)
|
||||||
fmt.Printf("Quilt Versions: %s\n", data)
|
|
||||||
return versions, nil
|
return versions, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,6 +91,10 @@ func InstallQuiltLib(lib QuiltLibrary, libDir string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
if resp.StatusCode != 200 {
|
||||||
|
fmt.Printf("unable to find library: %s\n", lib.Url+path)
|
||||||
|
return
|
||||||
|
}
|
||||||
os.MkdirAll(filepath.Join(libDir, ProcessMavenPath(lib.Name)), 0755)
|
os.MkdirAll(filepath.Join(libDir, ProcessMavenPath(lib.Name)), 0755)
|
||||||
f, _ := os.OpenFile(filepath.Join(libDir, path), os.O_CREATE|os.O_RDWR, 0755)
|
f, _ := os.OpenFile(filepath.Join(libDir, path), os.O_CREATE|os.O_RDWR, 0755)
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
@ -105,7 +109,8 @@ func InstallQuiltLibs(mcVersion string, quiltVersion string, libDir string) {
|
|||||||
for _, lib := range metadata.LauncherMeta.Libraries.Common {
|
for _, lib := range metadata.LauncherMeta.Libraries.Common {
|
||||||
InstallQuiltLib(lib, libDir)
|
InstallQuiltLib(lib, libDir)
|
||||||
}
|
}
|
||||||
InstallQuiltLib(QuiltLibrary{Name: metadata.Loader.Maven, Sha1: "", Url: "https://maven.fabricmc.net/"}, libDir)
|
InstallQuiltLib(QuiltLibrary{Name: metadata.Loader.Maven, Sha1: "", Url: "https://maven.quiltmc.org/repository/release/"}, libDir)
|
||||||
InstallQuiltLib(QuiltLibrary{Name: metadata.Intermediary.Maven, Sha1: "", Url: "https://maven.fabricmc.net/"}, libDir)
|
InstallQuiltLib(QuiltLibrary{Name: metadata.Intermediary.Maven, Sha1: "", Url: "https://maven.fabricmc.net/"}, libDir)
|
||||||
|
InstallQuiltLib(QuiltLibrary{Name: metadata.Hashed.Maven, Sha1: "", Url: "https://maven.quiltmc.org/repository/release/"}, libDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user