-
-
Notifications
You must be signed in to change notification settings - Fork 177
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.next] Modded feature flag #1322
Conversation
Last commit published: 4489345c5b2af213e7763a5ce28427b43a34284b. 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 #1322' // https://github.com/neoforged/NeoForge/pull/1322
url 'https://prmaven.neoforged.net/NeoForge/pr1322'
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-pr1322
cd NeoForge-pr1322
curl -L https://prmaven.neoforged.net/NeoForge/pr1322/net/neoforged/neoforge/21.0.188-pr-1322-pr-modded-flags/mdk-pr1322.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, this PR introduces breaking changes. Compatibility checks
|
7191a1b
to
c84406a
Compare
@ApexModder, this pull request has conflicts, please resolve them for this PR to move forward. |
d914061
to
4489345
Compare
4489345
to
1c8797e
Compare
@ApexModder, this pull request has conflicts, please resolve them for this PR to move forward. |
Add coloring to flag list command Remove ability to mark flags as enabled by default
GameTest validates the following - flag can be enabled and disabled - all flagged elements match the expected enabled state register flagged block & entity type
Migrate SavedData over to LevelAttachment
76eef06
to
98a935c
Compare
This PR introduces a custom flag system for marking elements as locked behind a set of required flags.
Although vanilla provides a
FeatureFlag
system, modders should not use it in its current state. This PR offers a similar system specifically for modders.To use this system, a registry element must implement
FlagElement
and provide a set of required flags via therequiredFlags
method. All vanilla feature elements have been patched to support this new flag system directly. For example, Items and Blocks can be assigned a set of flags during registration through their Properties objects.To check if a given flag is enabled, you need an instance of
FlagManager
, which can be obtained via aMinecraftServer
instance. TheisEnabled
method of feature elements has been patched to check if their respective flags are enabled.All currently enabled flags are appended to crash reports, making it easy for modders to know which crashes are potentially caused by flagged elements and which are not
All flags are disabled by default. To enable a flag, a server admin must use the command
/neoforge flag enable <flag>
.A new
ICondition
has been implemented (RequiredFlagsCondition
), which allows marking data files as requiring a set of flags.Due to when flags are loaded and how they are currently toggled, after setting a flags state a
/reload
will be required to reload the data files with the correct flag states.Example mod - This mod registers a new Block and Item to the game, which are both locked behind a new modded flag
flag_example_mod:experimental
.TODO