Interface Feature

All Superinterfaces:
Keyed, Wrapper
All Known Subinterfaces:
ComposedFeature, CustomComposedFeature<C>, ReferencedFeature

@NullMarked @AsOf("4.0.0") public interface Feature extends Wrapper, Keyed
A direct Minecraft feature or a reference to one already registered. Features are added to biomes through placed features.
Since:
4.0.0
  • Method Details

    • resourceKey

      @AsOf("4.0.0") Optional<ResourceKey> resourceKey()
      The resource key of the feature, if present.
      Returns:
      the resource key of the feature, if present
      Since:
      4.0.0
    • of

      @AsOf("4.0.0") @Obsolete static ComposedFeature of(FeatureType featureType, FeatureConfiguration config)
      Authors a feature from a vanilla feature type and its direct feature settings.
      Parameters:
      featureType - the vanilla feature type
      config - the configuration
      Returns:
      an authored feature
      Since:
      4.0.0
    • custom

      @AsOf("4.0.0") static <C> CustomComposedFeature<C> custom(CustomFeature<C> feature, C config)
      Composes a custom feature with a config instance.
      Type Parameters:
      C - the config type
      Parameters:
      feature - the custom feature to compose
      config - the config instance to place with
      Returns:
      an authored feature
      Since:
      4.0.0
    • of

      @AsOf("4.0.0") @Obsolete static <C> CustomComposedFeature<C> of(CustomFeature<C> feature, C config)
      Composes a registered custom feature with a config instance.
      Type Parameters:
      C - the config type
      Parameters:
      feature - the custom feature to compose
      config - the config instance to place with
      Returns:
      an authored feature
      Since:
      4.0.0
    • reference

      @AsOf("4.0.0") static ReferencedFeature reference(ResourceKey key)
      References a feature already registered under the given key.
      Parameters:
      key - the registry key of the feature
      Returns:
      a reference to the registered feature
      Since:
      4.0.0
    • wrap

      @AsOf("4.0.0") default Feature wrap()
      Resolves this object's key in Minecraft's direct feature registry and decodes the registered value.
      Returns:
      the decoded feature
      Throws:
      IllegalStateException - if this object has no resource key
      Since:
      4.0.0
    • composed

      @AsOf("4.0.0") static ComposedFeature.Builder composed()
      Authors a feature from a vanilla feature type and its direct feature settings.
      Returns:
      an authored feature
      Since:
      4.0.0
    • custom

      @AsOf("4.0.0") static <C> CustomComposedFeature.Builder<C> custom()
      Composes a registered custom feature with a config instance. The feature
      Type Parameters:
      C - the config type
      Returns:
      an authored configured feature
      Since:
      4.0.0
    • decode

      @AsOf("4.0.0") static Feature decode(Object minecraftFeature)
      Reads a keyed Minecraft feature holder into a wrapper.
      Parameters:
      minecraftFeature - the feature holder to read
      Returns:
      the wrapper for the feature
      Since:
      4.0.0