gather
Functionality for onboarding and updating new installations and instances
gather_metadata_for_minecraft_server(server_home, name=None, tags=None, server_jar=None)
Parse files (or user input) to generate metadata for a minecraft server installation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
server_home |
Path
|
The working directory of the Minecraft server |
required |
name |
str
|
A name or alias to give to the server. If None is provided, the user will be prompted to enter it. |
None
|
tags |
list of str
|
The tags to assign to the server. If None are specified, the user will be prompted to enter them. |
None
|
server_jar |
Path
|
The path to the server JAR file. If None is provided, this method will
attempt to locate it within the |
None
|
Returns:
Type | Description |
---|---|
InstanceSpec
|
The metadata for this instance |
Raises:
Type | Description |
---|---|
ValueError
|
If this is not a valid Minecraft server installation or the requisite metadata could not be parsed |
Notes
This method extracts metadata entirely from the filename of the server jar file. Custom-named jars or executables in non-standard locations will require their metadata be added manually.
Source code in enderchest/gather.py
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 |
|
gather_metadata_for_mmc_instance(minecraft_folder, instgroups_file=None)
Parse files to generate metadata for a MultiMC-like instance
Parameters:
Name | Type | Description | Default |
---|---|---|---|
minecraft_folder |
Path
|
The path to the installation's .minecraft folder |
required |
instgroups_file |
Path
|
The path to instgroups.json. If None is provided, this method will look for it two directories up from the minecraft folder |
None
|
Returns:
Type | Description |
---|---|
InstanceSpec
|
The metadata for this instance |
Raises:
Type | Description |
---|---|
ValueError
|
If this is not a valid MMC-like Minecraft instance |
Notes
If this method is failing to find the appropriate files, you may want to try ensuring that minecraft_folder is an absolute path.
Source code in enderchest/gather.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
|
gather_metadata_for_official_instance(minecraft_folder, name='official')
Parse files to generate metadata for an official Minecraft installation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
minecraft_folder |
Path
|
The path to the installation's .minecraft folder |
required |
name |
str
|
A name or alias to give to the instance. If None is provided, the default name is "official" |
'official'
|
Returns:
Type | Description |
---|---|
InstanceSpec
|
The metadata for this instance |
Raises:
Type | Description |
---|---|
ValueError
|
If this is not a valid official Minecraft installation |
Notes
This method will always consider this instance to be vanilla, with no modloader. If a Forge or Fabric executable is installed inside this instance, the precise name of that version of that modded minecraft will be included in the version list.
Source code in enderchest/gather.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
|
gather_minecraft_instances(minecraft_root, search_path, official)
Search the specified directory for Minecraft installations and return any that are can be found and parsed
Parameters:
Name | Type | Description | Default |
---|---|---|---|
minecraft_root |
Path
|
The root directory that your minecraft stuff (or, at least, the one that's the parent of your EnderChest folder). This will be used to construct relative paths. |
required |
search_path |
Path
|
The path to search |
required |
official |
bool or None
|
Whether we expect that the instances found in this location will be: - from the official launcher (official=True) - from a MultiMC-style launcher (official=False) - a mix / unsure (official=None) |
required |
Returns:
Type | Description |
---|---|
list of InstanceSpec
|
A list of parsed instances |
Notes
- If a minecraft installation is found but cannot be parsed (or parsed as specified) this method will report that failure but then continue on.
- As a corollary, if no valid Minecraft installations can be found, this method will return an empty list.
Source code in enderchest/gather.py
update_ender_chest(minecraft_root, search_paths=None, instance_type=None, remotes=None, **server_meta)
Orchestration method that coordinates the onboarding of new instances or EnderChest installations
Parameters:
Name | Type | Description | Default |
---|---|---|---|
minecraft_root |
Path
|
The root directory that your minecraft stuff (or, at least, the one that's the parent of your EnderChest folder). |
required |
search_paths |
list of Paths
|
The local search paths to look for Minecraft installations within. Be warned that this search is performed recursively. |
None
|
instance_type |
str
|
Optionally specify the type of the Minecraft instances you expect to find. Options are:
If |
None
|
remotes |
list of URIs or (URI, str) tuples
|
Any remotes you wish to register to this instance. When a (URI, str) tuple is provided, the second value will be used as the name/alias of the remote. If there is already a remote specified with the given alias, this method will replace it. |
None
|
**server_meta |
Pass-through for metadata to pass through to any gathered servers (such as name or jar location) |
{}
|
Source code in enderchest/gather.py
476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 |
|