Class CustomFeature<C>

java.lang.Object
dev.wyck.wrapper.worldgen.feature.custom.CustomFeature<C>
Type Parameters:
C - the configuration type carried to place(PlacementContext)
All Implemented Interfaces:
Wrapper, AbstractCustomFeature, ConfiguredFeature, Cloneable, Keyed

@NullMarked @AsOf("2.3.0") public abstract class CustomFeature<C> extends Object implements AbstractCustomFeature, Cloneable
Base class for an authored world generation feature with its own placement algorithm.
Since:
2.3.0
  • Constructor Details

    • CustomFeature

      @AsOf("2.3.0") protected CustomFeature(Supplier<C> configSupplier)
      Creates a new CustomFeature with the given configuration supplier.
      Parameters:
      configSupplier - the configuration supplier
      Since:
      2.3.0
    • CustomFeature

      @AsOf("3.0.0") protected CustomFeature(Supplier<C> configSupplier, @Nullable ResourceKey key)
      Creates a new CustomFeature with the given configuration supplier and registry key.
      Parameters:
      configSupplier - the configuration supplier
      key - the key to register this feature under
      Since:
      3.0.0
  • Method Details

    • place

      @AsOf("2.3.0") @Contract(value="null -> fail", pure=false) public abstract boolean place(PlacementContext<C> context)
      Places this feature.

      This should return true if anything was placed.

      Parameters:
      context - the placement surface
      Returns:
      whether placement occurred
      Since:
      2.3.0
    • key

      public ResourceKey key()
      Specified by:
      key in interface AbstractCustomFeature
      Specified by:
      key in interface Keyed
    • resourceKey

      public final @Nullable ResourceKey resourceKey()
    • configSupplier

      @AsOf("2.3.0") @Internal public final Supplier<C> configSupplier()
      Internal method to get the configuration supplier.
      Returns:
      the configuration supplier
      Since:
      2.3.0
    • newConfig

      @AsOf("2.3.0") @Internal public final C newConfig()
      Internal method to create a new configuration instance.
      Returns:
      a new instance of the configuration type
      Since:
      2.3.0
    • register

      @AsOf("3.0.0") public final CustomFeature<C> register()
      Registers this feature into the FEATURE registry under the key of this feature.
      Returns:
      this feature
      Since:
      3.0.0
    • registerAs

      @AsOf("2.3.0") public final CustomFeature<C> registerAs(ResourceKey key)
      Registers this feature into the FEATURE registry under the given key. Must be called during the bootstrap window. After registration, compose it into a biome with ConfiguredFeature.custom(key, config).
      Parameters:
      key - the registry key to register under
      Since:
      2.3.0
    • register

      @AsOf("2.3.0") public static <C> CustomFeature<C> register(ResourceKey key, CustomFeature<C> feature)
      Convenience method for registering a feature.
      Type Parameters:
      C - the configuration type
      Parameters:
      key - the registry key to register under
      feature - the feature to register
      Returns:
      the registered feature
      Since:
      2.3.0
    • clone

      @AsOf("3.0.0") protected CustomFeature<C> clone()
      Clones this feature.
      Overrides:
      clone in class Object
      Returns:
      a clone of this feature
      Since:
      3.0.0