Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Add FeatureFlag API

Open Machine-Maker opened this issue 2 years ago • 7 comments

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.

Machine-Maker avatar Mar 09 '23 19:03 Machine-Maker

How about using @Deprecated and @APIStatus.ScheduledForRemoval() for feature flags enabling updates?

maestro-denery avatar Mar 10 '23 06:03 maestro-denery

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.

Machine-Maker avatar Mar 10 '23 19:03 Machine-Maker

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"?

qixils avatar Jun 10 '23 00:06 qixils

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.

Machine-Maker avatar Jun 10 '23 00:06 Machine-Maker

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 ❤️

qixils avatar Jun 10 '23 00:06 qixils

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.

RedstoneFuture avatar Dec 24 '23 02:12 RedstoneFuture

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.

Machine-Maker avatar May 30 '24 02:05 Machine-Maker