class EmoInstance
EmoInstance
EmoInstance()
EmoInstance |
suspend fun accountLogIn(username: String, password: String, save: Boolean = true): Account
Try to authenticate with the Minecraft servers with given username and password. Throws on login failure, set save to false to not save this account in the settings. (e.g. if you only want to check if these are correct credentials) |
|
suspend fun addLocalModpack(modpack: ModpackWithVersions): Unit
Add local modpack to local repository, will inject modpack into cache and save that immediately afterwards |
|
fun addProfile(modpack: Modpack, modpackVersion: ModpackVersion, location: String, name: String): Unit
Add profile with given modpack and modpackVersion on location with name to settings. This function is used by the install workflow |
|
fun getAccounts(): List<Account>
Get a list of configured accounts saved in settings |
|
suspend fun getAccountViaAuthentication(uuid: String = useSettings(true) { it.getSelectedAccountUuid() }, requireLoggedIn: Boolean = true): Account
Get an account by uuid if not given, selected account is used. Will try to reauthenticate with the mojang account service if requireLoggedIn is true or not given, will throw on failed re-authentication |
|
suspend fun getAvailableJRE(environment: EmoEnvironment = EmoEnvironment()): LauncherArtifact? |
|
fun getDataDir(): String
Get location where all configuration and other data is stored for user |
|
fun getEmoContextForModpack(modpack: Modpack, modpackVersion: ModpackVersion, installLocation: String, target: Target, name: String = modpack.name): EmoContext
Get an EmoContext object for install configuration consisting of modpack, modpackVersion, installLocation, target, and name, if no name is given, name of modpack will be used |
|
suspend fun getLocalRepo(): MutableRepository
Get the local modpack repo, which is used for locally imported or created modpacks |
|
fun getMinecraftExecutor(location: String, account: Account): MinecraftExecutor
Get a MinecraftExecutor for given location and account fun getMinecraftExecutor(profile: Profile, account: Account): MinecraftExecutor
Get a MinecraftExecutor for given profile and account |
|
fun getModpack(id: String): ModpackCache?
Get modpack by handle |
|
fun getModpacks(): Map<String, ModpackCache>
Get all modpacks currently known to cache, indexed by id. id is enforced |
|
fun getProfiles(): List<Profile>
Get list of profiles saved in settings |
|
fun getRepositories(): List<RepositoryDefinition>
Get a list of configured repositories from settings |
|
fun getRepository(id: String): RepositoryCache?
Get repository by id saved in ModpackCache.repository |
|
suspend fun loadModpackCollectionCache(): Unit
Load the current modpack collection cache from disk |
|
suspend fun removeAccount(uuid: String): Unit
Remove account from settings by uuid, will also log out the account |
|
fun removeRepository(repositoryDefinition: RepositoryDefinition): Unit
Remove a repository |
|
suspend fun runInstall(emoContext: EmoContext, stateStart: suspend (ProcessStartedEvent<EmoContext>) -> Unit): Unit
Run an install workflow for given emoContext, stateStart will be called everytime the install workflow changes to a state. function will return after install, or throw at failure |
|
suspend fun saveLocalRepo(localRepository: MutableRepository): Unit
Save localRepository as the current local repo |
|
suspend fun saveModpackCollectionCache(): Unit
Save current modpack collection, make sure either updateRepositories or loadModpackCollectionCache is called before, otherwise you will save an empty cache |
|
suspend fun updateRepositories(): Unit
Fetches all remote and local repositories and indexes those, save the new cache with saveModpackCollectionCache |
|
fun <T> useSettings(readOnly: Boolean = false, block: (settings: Settings) -> T): T |