Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.21.3] Add condition to validate feature flags enabled state #1706

Closed

Conversation

ApexModder
Copy link
Contributor

@ApexModder ApexModder commented Nov 26, 2024

Modders who maintain multi-jar mods, that being mods whose feature set is split across multiple jars, may want a single flag in their common jar which toggles features across all of their mod jars. Due to the nature of how feature packs work and are enabled, this is not possible.

While you can have multiple packs which all enable the same flag, they will all display as individual selections in the "experiments" screen, when the intention is to have 1 toggle for all these packs.

To work around that, modders can make use of the newly added condition in this PR, which takes in a set of feature flags and whether to validate for them being enabled or disabled to conditionally load their desired elements without needing to be in the same feature pack.

@ApexModder ApexModder added the 1.21.3 Targeted at Minecraft 1.21.3 label Nov 26, 2024
@neoforged-pr-publishing
Copy link

neoforged-pr-publishing bot commented Nov 26, 2024

  • Publish PR to GitHub Packages

Last commit published: a532e439eae683949a5897d25eb69ff436d55a54.

PR Publishing

The artifacts published by this PR:

Repository Declaration

In order to use the artifacts published by the PR, add the following repository to your buildscript:

repositories {
    maven {
        name 'Maven for PR #1706' // https://github.com/neoforged/NeoForge/pull/1706
        url 'https://prmaven.neoforged.net/NeoForge/pr1706'
        content {
            includeModule('net.neoforged', 'testframework')
            includeModule('net.neoforged', 'neoforge')
        }
    }
}

MDK installation

In order to setup a MDK using the latest PR version, run the following commands in a terminal.
The script works on both *nix and Windows as long as you have the JDK bin folder on the path.
The script will clone the MDK in a folder named NeoForge-pr1706.
On Powershell you will need to remove the -L flag from the curl invocation.

mkdir NeoForge-pr1706
cd NeoForge-pr1706
curl -L https://prmaven.neoforged.net/NeoForge/pr1706/net/neoforged/neoforge/21.3.44-beta-pr-1706-pr-feature-flag-condition/mdk-pr1706.zip -o mdk.zip
jar xf mdk.zip
rm mdk.zip || del mdk.zip

To test a production environment, you can download the installer from here.

@ApexModder
Copy link
Contributor Author

Closing as this does not seem possible, thought I had it implemented and working but turns out initial world/server load reports the incorrect status for feature flag states causing the test recipe to not be enabled. Subsequent /reload after the world/server has loaded does fix this.

I have tried many different ways to pass the enabled feature set to the conditions context object, but nothing seems to work, and flags are always reporting back as disabled.

@ApexModder ApexModder closed this Nov 26, 2024
@ApexModder ApexModder deleted the pr/feature-flag-condition branch November 27, 2024 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.21.3 Targeted at Minecraft 1.21.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant