instance
Specification of a Minecraft instance
InstanceSpec
Bases: NamedTuple
Specification of a Minecraft instance
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The "display name" for the instance |
required |
root |
Path
|
The path to its ".minecraft" folder |
required |
minecraft_versions |
list-like of str
|
The minecraft versions of this instance. This is typically a 1-tuple, but some loaders (such as the official one) will just comingle all your assets together across all profiles |
required |
modloader |
str
|
The (display) name of the modloader (vanilla corresponds to "") |
required |
tags |
list-like of str
|
The tags assigned to this instance, including both the ones assigned in the launcher (groups) and the ones assigned by hand. |
required |
Source code in enderchest/instance.py
from_cfg(section)
classmethod
Parse an instance spec as read in from the enderchest config file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
section |
dict-like of str to str
|
The section in the enderchest config as parsed by a ConfigParser |
required |
Returns:
Type | Description |
---|---|
InstanceSpec
|
The resulting InstanceSpec |
Raises:
Type | Description |
---|---|
KeyError
|
If a required key is absent |
ValueError
|
If a required entry cannot be parsed |
Source code in enderchest/instance.py
equals(minecraft_root, instance, other_instance)
Determine whether two instances point to the same location
Parameters:
Name | Type | Description | Default |
---|---|---|---|
minecraft_root |
Path
|
The starting location (the parent of where your EnderChest folder lives) |
required |
instance |
InstanceSpec
|
the first instance |
required |
other_instance |
InstanceSpec
|
the instance to compare it against |
required |
Returns:
Type | Description |
---|---|
bool
|
True if and only if the two instances have the same root, with regards
to the provided |
Source code in enderchest/instance.py
merge(*instances)
Merge multiple instances, layering information from the ones provided later on top of the ones provided earlier
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*instances |
InstanceSpec
|
The instances to combine |
()
|
Returns:
Type | Description |
---|---|
InstanceSpec
|
The merged instance |
Notes
The resulting merged instance will use: - the first instance's name - the union of all non-group tags - all other data from the last instance
Source code in enderchest/instance.py
normalize_modloader(loader)
Implement common modloader aliases
Parameters:
Name | Type | Description | Default |
---|---|---|---|
loader |
str
|
User-provided modloader name |
required |
Returns:
Type | Description |
---|---|
list of str
|
The modloader values that should be checked against to match the user's intent |
Source code in enderchest/instance.py
parse_version(version_string)
The first release of each major Minecraft version doesn't follow strict major.minor.patch semver. This method appends the ".0" so that our version matcher doesn't mess up
Parameters:
Name | Type | Description | Default |
---|---|---|---|
version_string |
str
|
The version read in from the Minecraft instance's config |
required |
Returns:
Type | Description |
---|---|
str
|
Either the original version string or the original version string with ".0" tacked onto the end of it |
Notes
Regex adapted straight from https://semver.org