gather
Functionality for finding, resolving and parsing local installations and instances
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
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 |
|
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
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 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 |
|
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
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 474 475 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 |
|
get_instances_matching_shulker_box(minecraft_root, shulker_box_name)
Get the list of registered instances that link to the specified shulker box
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 |
shulker_box_name |
str
|
The name of the shulker box you're asking about |
required |
Returns:
Type | Description |
---|---|
list of InstanceSpec
|
The instances that are / should be linked to the specified shulker box |
Source code in enderchest/gather.py
get_shulker_boxes_matching_instance(minecraft_root, instance_name)
Get the list of shulker boxes that the specified instance links to
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 |
instance_name |
str
|
The name of the instance you're asking about |
required |
Returns:
Type | Description |
---|---|
list of ShulkerBox
|
The shulker boxes that are linked to by the specified instance |
Source code in enderchest/gather.py
load_ender_chest(minecraft_root)
Load the configuration from the enderchest.cfg file in the EnderChest folder.
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 |
Returns:
Type | Description |
---|---|
EnderChest
|
The EnderChest configuration |
Raises:
Type | Description |
---|---|
FileNotFoundError
|
If no EnderChest folder exists in the given minecraft root or if no enderchest.cfg file exists within that EnderChest folder |
ValueError
|
If the EnderChest configuration is invalid and could not be parsed |
Source code in enderchest/gather.py
load_ender_chest_instances(minecraft_root, log_level=logging.INFO)
Get the list of instances registered with the EnderChest located in the minecraft root
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 |
log_level |
int
|
By default, this method will report out the minecraft instances it finds at the INFO level. You can optionally pass in a lower (or higher) level if this method is being called from another method where that information is redundant or overly verbose. |
INFO
|
Returns:
Type | Description |
---|---|
list of InstanceSpec
|
The instances registered with the EnderChest |
Notes
If no EnderChest is installed in the given location, then this will return an empty list rather than failing outright.
Source code in enderchest/gather.py
load_ender_chest_remotes(minecraft_root, log_level=logging.INFO)
Load all remote EnderChest installations registered with this one
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 |
log_level |
int
|
By default, this method will report out the minecraft instances it finds at the INFO level. You can optionally pass in a lower (or higher) level if this method is being called from another method where that information is redundant or overly verbose. |
INFO
|
Returns:
Type | Description |
---|---|
list of (URI, str) tuples
|
The URIs of the remote EnderChests, paired with their aliases |
Notes
If no EnderChest is installed in the given location, then this will return an empty list rather than failing outright.
Source code in enderchest/gather.py
load_shulker_boxes(minecraft_root, log_level=logging.INFO)
Load all shulker boxes in the EnderChest folder and return them in the order in which they should be linked.
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 |
log_level |
int
|
By default, this method will report out the minecraft instances it finds at the INFO level. You can optionally pass in a lower (or higher) level if this method is being called from another method where that information is redundant or overly verbose. |
INFO
|
Returns:
Type | Description |
---|---|
list of ShulkerBoxes
|
The shulker boxes found in the EnderChest folder, ordered in terms of the sequence in which they should be linked |
Notes
If no EnderChest is installed in the given location, then this will return an empty list rather than failing outright.
Source code in enderchest/gather.py
update_ender_chest(minecraft_root, search_paths=None, official=None, remotes=None)
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
|
official |
bool | None
|
Optionally specify whether the Minecraft instances you expect to find
are from the official launcher ( |
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
|