-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Make GameRule a FeatureDependant #12429
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
Conversation
We already have a system for that around FeatureDependant and FeatureFlagSetHolder. |
That doesn't seem to be the case. |
Yea it doesn't rn xD SOrry I wasnt clear, the PR should do that instead of adding a new system. |
Okay, I'll do that then 👍 |
d67e869
to
dffa034
Compare
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.
Generally LGTM!
I do wonder however if it would be smart to patch the GameRules internals to also maintain a Map<String, GameRule.Type<?>> for faster access.
The fact that this method is going to be pretty spam-heavy for checks would mean such optimisations would have a hopefully measurable effect.
paper-server/patches/sources/net/minecraft/world/level/GameRules.java.patch
Outdated
Show resolved
Hide resolved
paper-server/patches/sources/net/minecraft/world/level/GameRules.java.patch
Show resolved
Hide resolved
paper-server/patches/sources/net/minecraft/world/level/GameRules.java.patch
Outdated
Show resolved
Hide resolved
584a7c1
to
ab35a42
Compare
So I was playing around with game rules a bit and after running into an issue that
GameRule#values()
does contain even game rules that are disabled because the experimental data pack isn't enabled, I was wondering if there was a way to check if a game rule is enabled or not.What I've found is that
World#getGameRules()
should contain only enabled game rules, however that wasn't applicable for my usecase since I didn't have a world available.This PR adds an
isEnabled()
method to theGameRule
class to make it possible to check if the game rule is enabled without needing access to a world.