llgutils

package module
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2023 License: BSD-3-Clause Imports: 14 Imported by: 1

README

llgutils

Pretty much a library for creating a launcher for Lunar Client in Go.

Installation

run

go get github.com/KotonBads/llgutils@latest

then

go mod tidy

Example

package main

import (
	utils "github.com/KotonBads/llgutils"
)

func main() {
	launchbody := utils.LaunchBody{
		OS:      "linux",
		Arch:    "x64",
		Version: "1.8.9",
		Module:  "forge",
	}
	launchmeta, _ := utils.FetchLaunchMeta(launchbody)
	launchmeta.DownloadArtifacts("temp")
	launchmeta.DownloadCosmetics("temp/textures")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckHash

func CheckHash(path string, hash string) bool

func DownloadFile

func DownloadFile(path string, url string) (err error)

func IfExists

func IfExists(path string) bool

func Unzip

func Unzip(src string, dest string) error

Types

type Artifacts

type Artifacts struct {
	Name string `json:"name"`
	Sha1 string `json:"sha1"`
	Url  string `json:"url"`
	Type string `json:"type"`
}

type LaunchBody

type LaunchBody struct {
	OS      string
	Version string
	Module  string
	Arch    string
}

type LaunchMeta

type LaunchMeta struct {
	Success        bool `json:"success"`
	LaunchTypeData struct {
		Artifacts []Artifacts `json:"artifacts"`
		MainClass string      `json:"mainClass"`
	} `json:"launchTypeData"`
	Licenses []struct {
		File string `json:"file"`
		URL  string `json:"url"`
		Sha1 string `json:"sha1"`
	} `json:"licenses"`
	Textures struct {
		IndexURL  string `json:"indexUrl"`
		IndexSha1 string `json:"indexSha1"`
		BaseURL   string `json:"baseUrl"`
	} `json:"textures"`
	Jre struct {
		Download struct {
			URL       string `json:"url"`
			Extension string `json:"extension"`
		} `json:"download"`
		ExecutablePathInArchive []string    `json:"executablePathInArchive"`
		CheckFiles              [][]string  `json:"checkFiles"`
		ExtraArguments          []string    `json:"extraArguments"`
		JavawDownload           interface{} `json:"javawDownload"`
		JavawExeChecksum        interface{} `json:"javawExeChecksum"`
		JavaExeChecksum         string      `json:"javaExeChecksum"`
	} `json:"jre"`
}

func FetchLaunchMeta

func FetchLaunchMeta(launchdata LaunchBody) (response LaunchMeta, err error)

func (LaunchMeta) DownloadArtifacts

func (data LaunchMeta) DownloadArtifacts(path string) (err error)

func (LaunchMeta) DownloadCosmetics

func (data LaunchMeta) DownloadCosmetics(path string) (err error)

func (LaunchMeta) SortFiles

func (data LaunchMeta) SortFiles(path string) (classpath []string, ichorClassPath []string, external []string, natives []string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL