-
-
Notifications
You must be signed in to change notification settings - Fork 179
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.1] Allow mods to add custom FeatureFlags #1538
base: 1.21.1
Are you sure you want to change the base?
Conversation
Last commit published: a3c8c129be590ac62c04915c30b74f49cac5c6da. PR PublishingThe artifacts published by this PR:
Repository DeclarationIn order to use the artifacts published by the PR, add the following repository to your buildscript: repositories {
maven {
name 'Maven for PR #1538' // https://github.com/neoforged/NeoForge/pull/1538
url 'https://prmaven.neoforged.net/NeoForge/pr1538'
content {
includeModule('net.neoforged', 'testframework')
includeModule('net.neoforged', 'neoforge')
}
}
} MDK installationIn order to setup a MDK using the latest PR version, run the following commands in a terminal. mkdir NeoForge-pr1538
cd NeoForge-pr1538
curl -L https://prmaven.neoforged.net/NeoForge/pr1538/net/neoforged/neoforge/21.1.76-pr-1538-modded_feature_flags/mdk-pr1538.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. |
src/main/java/net/neoforged/neoforge/network/configuration/CheckFeatureFlags.java
Outdated
Show resolved
Hide resolved
@XFactHD, this pull request has conflicts, please resolve them for this PR to move forward. |
Co-authored-by: Apex <[email protected]>
Could we possibly provide in some testmod elements locked behind a custom flag, to validate that custom flags are working and disabling elements correctly. Something simple like a item which prints a message to chat
or even a block & block item
|
Adding a test item protected by one of the test flags seems sensible to me, but it should be sufficient to test that |
Yeah that would also be reasonable, I just went to test in dev real quick and realized there was no item to give, so couldn't validate if test flags were being enabled/disabling elements correctly. |
tests/src/main/java/net/neoforged/neoforge/debug/data/CustomFeatureFlagsTests.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@XFactHD could this be rebased onto 21.2. Would like to get this merged while we are in BC phase.
This PR makes it possible for mods to add custom
FeatureFlag
s to the vanilla feature flag system. Since theFeatureFlagRegistry
holding the flags is set in stone long before mods start loading, the flags are specified in a JSON file instead of being collected by an event or similar system. To allow adding more than the 64 flags allowed by vanilla (a limitation that is not unlikely to be hit with 100s of mods in a pack), the flag masks are extended by along[]
in theFeatureFlagSet
and an offset field inFeatureFlag
for indexing into the array.This is an alternative solution to #1435.
TODO:
Find a way to make the experiments screen scrollable: