Class CustomCarver<C>

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

@NullMarked @AsOf("3.0.0") @Experimental public abstract class CustomCarver<C> extends Object implements Cloneable, Registerable<CustomCarver<C>>
Base class for an authored world carver with its own carving algorithm.
Since:
3.0.0
  • Constructor Details

    • CustomCarver

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

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

    • carve

      @AsOf("3.0.0") public abstract boolean carve(CarvingContext<C> context)
      Carves the chunk described by the context.

      This should return true if anything was carved.

      Parameters:
      context - the carving surface
      Returns:
      whether carving occurred
      Since:
      3.0.0
    • isStartChunk

      @AsOf("3.0.0") public boolean isStartChunk(C config, Random random)
      Whether the given chunk should originate a carve. Called once per chunk in range before carve(CarvingContext).
      Parameters:
      config - a fresh configuration instance
      random - a random seeded for this chunk
      Returns:
      whether to carve from this chunk
      Since:
      3.0.0
    • canReplaceBlock

      @AsOf("3.0.0") public boolean canReplaceBlock(C config, BlockData state)
      Whether CarvingContext.carveEllipsoid(double, double, double, double, double, CarvingContext.CarveSkipChecker) may replace the given state. Ignored by carves that write blocks directly.
      Returns:
      whether the state is replaceable
      Since:
      3.0.0
    • range

      @AsOf("3.0.0") public int range()
      Returns:
      the chunk radius this carver may reach into
      Since:
      3.0.0
    • probability

      @AsOf("3.0.0") public float probability()
      Returns:
      the per-chunk chance this carver originates a carve
      Since:
      3.0.0
    • lavaLevel

      @AsOf("3.0.0") public VerticalAnchor lavaLevel()
      The y-level below which CarvingContext.carveEllipsoid(double, double, double, double, double, CarvingContext.CarveSkipChecker) places lava rather than consulting the aquifer.
      Returns:
      the lava level anchor
      Since:
      3.0.0
    • replaceable

      @AsOf("3.0.0") public Set<Material> replaceable()
      Returns:
      the materials CarvingContext.carveEllipsoid(double, double, double, double, double, CarvingContext.CarveSkipChecker) may replace
      Since:
      3.0.0
    • y

      @AsOf("3.0.0") public HeightProvider y()
      The nominal y-band of this carver. Purely descriptive: it populates the underlying configuration so vanilla tooling reports something sane, and is never sampled by Wyck. Sample your own y from CarvingContext.random().
      Returns:
      the height provider
      Since:
      3.0.0
    • yScale

      @AsOf("3.0.0") public FloatProvider yScale()
      Returns:
      the nominal vertical scale of this carver
      Since:
      3.0.0
    • key

      @AsOf("3.0.0") public ResourceKey key()
    • resourceKey

      @AsOf("3.0.0") @Internal public final @Nullable ResourceKey resourceKey()
      Internal method to get this carver's key without failing on absence.
      Returns:
      the key, or null if unregistered
      Since:
      3.0.0
    • configSupplier

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

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

      @AsOf("3.0.0") public final CustomCarver<C> register()
      Registers this carver into the CARVER registry under the key of this carver.
      Specified by:
      register in interface Registerable<C>
      Returns:
      this carver
      Since:
      3.0.0
    • registerAs

      @AsOf("3.0.0") public final <T> T registerAs(ResourceKey key)
      Registers this carver into the CARVER registry under the given key. Must be called during the bootstrap window. After registration, compose it into a biome with ConfiguredWorldCarver.custom(key, config).
      Parameters:
      key - the registry key to register under
      Returns:
      the registered carver
      Since:
      3.0.0
    • register

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

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