Skip to content

Missing modloader when used in multiple loader workflow with non-ephemeral environment #117

@XxInvictus

Description

@XxInvictus

I have found an issue where the modloader download logic breaks down when used in a non-ephemeral environment and trying to run tests on both Forge and Fabric. This was discovered when switching from a Github Hosted Runner to a Self-Hosted Gitlab Runner.

What Happens:

  1. First (for this example Fabric) run begins
  2. $HOME/.minecraft/versions/{0}/{1}.json does not exist
  3. Downloader runs
  4. Below folders get created and populated with relevant files:
    a. .minecraft/versions/{0}/
    b. .minecraft/versions/.*fabric.*/
  5. First test runs successfully (for this example we will use Fabric)
  6. Second (for this example Forge) run begins
  7. $HOME/.minecraft/versions/{0}/{1}.json DOES exist
    a. It was created as part of Fabric run
  8. Downloader does NOT run
  9. Below folder does NOT get created and populated
    a. .minecraft/versions/.*forge.*/
  10. Test fails due to Couldn't find object for regex '.*forge.*'!

Below is the line where this ultimately occurs:

if [ ! -f "$HOME/.minecraft/versions/${{ inputs.mc }}/${{ inputs.mc }}.json" ]; then

A mediocre solution would be to use the input.modloader as well to check for the relevant modloader on top of the existence of the mc version folder. ie:

        if [ ! -f "$HOME/.minecraft/versions/${{ inputs.mc }}/${{ inputs.mc }}.json" ]; then
          java -jar headlessmc-launcher-${{ inputs.hmc-version }}.jar --command download ${{ inputs.mc }}
        fi
        if [[  ! -n "$(ls -d $HOME/.minecraft/versions/*${{ inputs.modloader }}*)" ]]; then
          java -jar headlessmc-launcher-${{ inputs.hmc-version }}.jar --command ${{ inputs.modloader }} ${{ inputs.mc }} --java ${{ inputs.java }}
        fi

This would then still present issues with using multiple versions though ie.

  1. Run with Forge/Fabric x.x.1 and have the below folders and their files leftover:
    a. x.x.1/
    b. x.x.1-forge-x.x.1/
    c. fabric-loader-x.x.1-x.x.1
  2. Run on version fabric x.x.2
  3. Check for existence of x.x.2.json, doesn't exist, download x.x.2
  4. Check for existence of *fabric*, already exists in form fabric-loader-x.x.1-x.x.1, doesn't download x.x.2
  5. Failure due to incorrect fabric loader version for x.x.2

I am sure there is a more elegant solution that would cover all cases, I just wanted to get it documented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions