Changed default RAM limit

This commit is contained in:
= 2024-11-25 19:21:20 -07:00
parent 8208434b8f
commit ad736787e9

View File

@ -19,40 +19,40 @@ import (
)
type McVersionManifestEntry struct {
Id string
Type string
Url string
Time time.Time
ReleaseTime time.Time
Sha1 string
Id string
Type string
Url string
Time time.Time
ReleaseTime time.Time
Sha1 string
ComplianceLevel int
}
type McLatestEntry struct {
Release string
Release string
Snapshot string
}
type McVersionManifest struct {
Latest McLatestEntry
Latest McLatestEntry
Versions []McVersionManifestEntry
}
type McArguments struct {
Game []string
Jvm []string
Jvm []string
}
type McAssetIndex struct {
Id string
Sha1 string
Size int
Id string
Sha1 string
Size int
TotalSize int
Url string
Url string
}
type McJavaVersion struct {
Component string
Component string
MajorVersion int
}
@ -60,37 +60,37 @@ type McLibraryArtifact struct {
Path string
Sha1 string
Size int
Url string
Url string
}
type McLibraryDownload struct {
Artifact McLibraryArtifact
Artifact McLibraryArtifact
Classifiers map[string]interface{}
}
type McRuleOs struct {
Name string
Name string
Version string
ARch string
ARch string
}
type McRule struct {
Action string
Action string
Features map[string]bool
Os McRuleOs
Os McRuleOs
}
type McLibrary struct {
Downloads McLibraryDownload
Name string
Rules []McRule
Natives map[string]string
Name string
Rules []McRule
Natives map[string]string
}
type McDownload struct {
Sha1 string
Size int
Url string
Url string
}
type McLogging struct {
@ -99,25 +99,25 @@ type McLogging struct {
type McLoggingClient struct {
Argument string
File McDownload
File McDownload
}
type McMetadata struct {
Arguments McArguments
AssetIndex McAssetIndex
Assets string
ComplianceLevel int
Downloads map[string]McDownload
Id string
JavaVersion McJavaVersion
Libraries []McLibrary
MainClass string
Arguments McArguments
AssetIndex McAssetIndex
Assets string
ComplianceLevel int
Downloads map[string]McDownload
Id string
JavaVersion McJavaVersion
Libraries []McLibrary
MainClass string
MinimumLauncherVersion int
ReleaseTime time.Time
Time time.Time
Type string
MinecraftArguments string
Logging McLogging
ReleaseTime time.Time
Time time.Time
Type string
MinecraftArguments string
Logging McLogging
}
func GetVersionManifest() (McVersionManifest, error) {
@ -127,7 +127,7 @@ func GetVersionManifest() (McVersionManifest, error) {
defer resp.Body.Close()
data, err := io.ReadAll(resp.Body)
if err == nil {
versionManifest := McVersionManifest{}
versionManifest := McVersionManifest{}
err = json.Unmarshal(data, &versionManifest)
if err == nil {
dir, err := os.UserConfigDir()
@ -191,7 +191,7 @@ func GetVersionMetadata(wantedVersion string) (McMetadata, error) {
defer f.Close()
if data, err := io.ReadAll(f); err == nil {
sha := sha1.Sum(data)
if hex.EncodeToString(sha[:20]) == version.Sha1{
if hex.EncodeToString(sha[:20]) == version.Sha1 {
metadata := McMetadata{}
json.Unmarshal(data, &metadata)
return metadata, nil
@ -226,7 +226,7 @@ func GetVersionMetadata(wantedVersion string) (McMetadata, error) {
}
}
return metadata, nil
}
}
return McMetadata{}, fmt.Errorf("Unable to find version %s\n", wantedVersion)
@ -398,7 +398,7 @@ func DownloadLibraries(mcVersion string, libPath string, a App) error {
for ind, token := range tokens {
if ind != len(tokens)-1 {
path = filepath.Join(path, token)
}
}
}
err = os.MkdirAll(filepath.Join(libPath, path), 0755)
if err != nil {
@ -415,7 +415,7 @@ func DownloadLibraries(mcVersion string, libPath string, a App) error {
return nil
}
func InstallNatives(mcVersion string, nativesDir string){
func InstallNatives(mcVersion string, nativesDir string) {
metadata, _ := GetVersionMetadata(mcVersion)
for _, lib := range metadata.Libraries {
if lib.Natives != nil {
@ -446,7 +446,7 @@ func InstallNatives(mcVersion string, nativesDir string){
}
}
func DownloadLoggingConfig(mcVersion string, gameDir string){
func DownloadLoggingConfig(mcVersion string, gameDir string) {
metadata, _ := GetVersionMetadata(mcVersion)
resp, err := http.Get(metadata.Logging.Client.File.Url)
if err != nil {
@ -540,7 +540,7 @@ func GetBaseLaunchArgs(mcVersion string, instance Instance, libDir string, binDi
args = append(args, loggingArg)
}
args = append(args, "-Xms512m")
args = append(args, "-Xmx1024m")
args = append(args, "-Xmx4096m")
args = append(args, "-cp")
arg := ""
separater := ":"
@ -556,8 +556,6 @@ func GetBaseLaunchArgs(mcVersion string, instance Instance, libDir string, binDi
arg += filepath.Join(binDir, mcVersion, "client.jar")
args = append(args, arg)
args = append(args, instance.MainClass)
for _, val := range searchArgs {
@ -586,7 +584,6 @@ func GetBaseLaunchArgs(mcVersion string, instance Instance, libDir string, binDi
return args, nil
}
func GetOfflineLaunchArgs(mcVersion string, instance Instance, libDir string, binDir string, assetDir string, gameDir string, playerName string) ([]string, error) {
args, err := GetBaseLaunchArgs(mcVersion, instance, libDir, binDir, assetDir, gameDir)
if err != nil {
@ -594,7 +591,7 @@ func GetOfflineLaunchArgs(mcVersion string, instance Instance, libDir string, bi
}
for ind, val := range args {
switch val{
switch val {
case "${auth_player_name}":
args[ind] = playerName
case "${auth_uuid}":
@ -617,7 +614,7 @@ func GetOnlineLaunchArgs(mcVersion string, instance Instance, libDir string, bin
}
for ind, val := range args {
switch val{
switch val {
case "${auth_player_name}":
args[ind] = auth.Name
case "${auth_uuid}":