Paper
Paper copied to clipboard
Add FeatureFlag API
Closes https://github.com/PaperMC/Paper/issues/8950
My initial thoughts on API for checking if a Material or EntityType is enabled with a FeatureDependant interface.
Adds tests to check on updates when this changes.
How about using @Deprecated and @APIStatus.ScheduledForRemoval() for feature flags enabling updates?
How about using @Deprecated and @APIStatus.ScheduledForRemoval() for feature flags enabling updates?
Deprecated seems inappropriate for this, and scheduledforremoval might work for UPDATE_1_20, but not bundle as we have no clue when that's gonna be removed. I think Experimental is the most accurate marker annotation.
Sorry, what exactly is blocking this? I don't see a "enum PR" from a glance, unless you mean the property API tagged "for: future" which I quite hope not... This is preventing me from being able to determine what items/entities are spawnable which is quite unfortunate for my use cases. I worked around it in the meantime with NMS but obviously this is not an ideal solution for cross-version compatibility among other issues. I'm hoping this could just be merged now (ideally to 1.19.4 while it's still supported ❤️) and improved later since it "generally looks good"?
The enum PR was the PR previous thought to be slated by upstream for 1.20. It replaces a ton of the enums and deprecates Material.
Ah, upstream, I can see the hesitation then. Unfortunate but I can live with NMS for the moment if this isn't viable yet to merge. Thanks for the reasoning ❤️
Would it be an option to extend the API with a method that outputs a permitted EntityType[] and Material[] for the corresponding feature-flag?
This could be helpful e.g. for tab-completions in which only the enabled blocks are to be displayed. Otherwise, you have to check all game objects individually each time.
Ok, revamped this and took over as much as possible from upstream's feature flag API. Added tests to ensure nothing is missed as well.