Class CustomCarver<C>

java.lang.Object
dev.wyck.worldgen.carver.custom.CustomCarver<C>
Type Parameters:
C - the custom carver configuration type
All Implemented Interfaces:
Registerable<CustomCarver<C>>, Cloneable

@NullMarked @AsOf("4.0.0") public abstract class CustomCarver<C> extends Object implements Cloneable, Registerable<CustomCarver<C>>
A custom implementation of Minecraft 26.3's direct, mask-only carver contract.
Since:
4.0.0
  • Constructor Details

    • CustomCarver

      @AsOf("4.0.0") protected CustomCarver(Supplier<C> configSupplier)
      Creates an unregistered custom carver.
      Parameters:
      configSupplier - a supplier of fresh configuration instances
      Since:
      4.0.0
    • CustomCarver

      @AsOf("4.0.0") protected CustomCarver(Supplier<C> configSupplier, @Nullable ResourceKey key)
      Creates a custom carver with an optional registry key.
      Parameters:
      configSupplier - a supplier of fresh configuration instances
      key - the registry key, or null for an unregistered carver
      Since:
      4.0.0
  • Method Details

    • carve

      @AsOf("4.0.0") public abstract boolean carve(CarvingContext<C> context)
      Marks positions in the active target chunk as carved.
      Parameters:
      context - the current carving context
      Returns:
      whether this carver marked at least one position
      Since:
      4.0.0
    • isStartChunk

      @AsOf("4.0.0") public boolean isStartChunk(C config, Random random)
      Determines whether this carver starts in a candidate chunk.
      Parameters:
      config - the custom carver configuration
      random - the random source for the candidate chunk
      Returns:
      whether the carver starts in the chunk
      Since:
      4.0.0
    • range

      @AsOf("4.0.0") public int range()
      The horizontal chunk range this carver may reach from its source chunk.
      Returns:
      the carver range in chunks
      Since:
      4.0.0
    • probability

      @AsOf("4.0.0") public float probability()
      The default probability used by isStartChunk(Object, Random).
      Returns:
      the carver start probability
      Since:
      4.0.0
    • key

      @AsOf("4.0.0") public ResourceKey key()
      The registry key assigned to this carver.
      Returns:
      the carver registry key
      Throws:
      NullPointerException - if this carver has no registry key
      Since:
      4.0.0
    • resourceKey

      @AsOf("4.0.0") @Internal public final @Nullable ResourceKey resourceKey()
      Returns the nullable registry key used by the runtime bridge.
      Returns:
      the registry key, or null when unregistered
      Since:
      4.0.0
    • configSupplier

      @AsOf("4.0.0") @Internal public final Supplier<C> configSupplier()
      Returns the configuration supplier used by the runtime bridge.
      Returns:
      the configuration supplier
      Since:
      4.0.0
    • newConfig

      @AsOf("4.0.0") @Internal public final C newConfig()
      Creates a fresh configuration instance for the runtime bridge.
      Returns:
      a fresh configuration instance
      Since:
      4.0.0
    • register

      @AsOf("4.0.0") public final CustomCarver<C> register()
      Registers this carver using its assigned registry key.
      Specified by:
      register in interface Registerable<C>
      Returns:
      this registered carver
      Throws:
      NullPointerException - if this carver has no registry key
      Since:
      4.0.0
    • registerAs

      @AsOf("4.0.0") public final <T> T registerAs(ResourceKey key)
      Clones and registers this carver using the supplied registry key.
      Type Parameters:
      T - the inferred registered carver type
      Parameters:
      key - the registry key
      Returns:
      the registered carver clone
      Since:
      4.0.0
    • register

      @AsOf("4.0.0") public static <C> CustomCarver<C> register(ResourceKey key, CustomCarver<C> carver)
      Registers a custom carver using the supplied registry key.
      Type Parameters:
      C - the custom carver configuration type
      Parameters:
      key - the registry key
      carver - the custom carver to register
      Returns:
      the registered carver clone
      Since:
      4.0.0
    • clone

      protected CustomCarver<C> clone()
      Overrides:
      clone in class Object