emo / me.eater.emo / EmoInstance

EmoInstance

class EmoInstance

EmoInstance

Constructors

<init>

EmoInstance()

EmoInstance

Functions

accountLogIn

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)

addLocalModpack

suspend fun addLocalModpack(modpack: ModpackWithVersions): Unit

Add local modpack to local repository, will inject modpack into cache and save that immediately afterwards

addProfile

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

getAccounts

fun getAccounts(): List<Account>

Get a list of configured accounts saved in settings

getAccountViaAuthentication

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

getAvailableJRE

suspend fun getAvailableJRE(environment: EmoEnvironment = EmoEnvironment()): LauncherArtifact?

getDataDir

fun getDataDir(): String

Get location where all configuration and other data is stored for user

getEmoContextForModpack

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

getLocalRepo

suspend fun getLocalRepo(): MutableRepository

Get the local modpack repo, which is used for locally imported or created modpacks

getMinecraftExecutor

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

getModpack

fun getModpack(id: String): ModpackCache?

Get modpack by handle

getModpacks

fun getModpacks(): Map<String, ModpackCache>

Get all modpacks currently known to cache, indexed by id. id is enforced [user-handle]/[modpack-id]

getProfiles

fun getProfiles(): List<Profile>

Get list of profiles saved in settings

getRepositories

fun getRepositories(): List<RepositoryDefinition>

Get a list of configured repositories from settings

getRepository

fun getRepository(id: String): RepositoryCache?

Get repository by id saved in ModpackCache.repository

loadModpackCollectionCache

suspend fun loadModpackCollectionCache(): Unit

Load the current modpack collection cache from disk

removeAccount

suspend fun removeAccount(uuid: String): Unit

Remove account from settings by uuid, will also log out the account

removeRepository

fun removeRepository(repositoryDefinition: RepositoryDefinition): Unit

Remove a repository

runInstall

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

saveLocalRepo

suspend fun saveLocalRepo(localRepository: MutableRepository): Unit

Save localRepository as the current local repo

saveModpackCollectionCache

suspend fun saveModpackCollectionCache(): Unit

Save current modpack collection, make sure either updateRepositories or loadModpackCollectionCache is called before, otherwise you will save an empty cache

updateRepositories

suspend fun updateRepositories(): Unit

Fetches all remote and local repositories and indexes those, save the new cache with saveModpackCollectionCache

useSettings

fun <T> useSettings(readOnly: Boolean = false, block: (settings: Settings) -> T): T