Class CustomCarver<C>
java.lang.Object
dev.wyck.worldgen.carver.custom.CustomCarver<C>
- Type Parameters:
C- the configuration type carried tocarve(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 Summary
ConstructorsModifierConstructorDescriptionprotectedCustomCarver(Supplier<C> configSupplier) Creates a new CustomCarver with the given configuration supplier.protectedCustomCarver(Supplier<C> configSupplier, @Nullable ResourceKey key) Creates a new CustomCarver with the given configuration supplier and registry key. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanReplaceBlock(C config, BlockData state) WhetherCarvingContext.carveEllipsoid(double, double, double, double, double, CarvingContext.CarveSkipChecker)may replace the given state.abstract booleancarve(CarvingContext<C> context) Carves the chunk described by the context.protected CustomCarver<C> clone()Clones this carver.Internal method to get the configuration supplier.booleanisStartChunk(C config, Random random) Whether the given chunk should originate a carve.key()The y-level below whichCarvingContext.carveEllipsoid(double, double, double, double, double, CarvingContext.CarveSkipChecker)places lava rather than consulting the aquifer.final CInternal method to create a new configuration instance.floatintrange()final CustomCarver<C> register()Registers this carver into the CARVER registry under the key of this carver.static <C> CustomCarver<C> register(ResourceKey key, CustomCarver<C> carver) Convenience method for registering a carver.final <T> TregisterAs(ResourceKey key) Registers this carver into the CARVER registry under the given key.final @Nullable ResourceKeyInternal method to get this carver's key without failing on absence.y()The nominal y-band of this carver.yScale()
-
Constructor Details
-
CustomCarver
-
CustomCarver
Creates a new CustomCarver with the given configuration supplier and registry key.- Parameters:
configSupplier- the configuration supplierkey- the key to register this carver under- Since:
- 3.0.0
-
-
Method Details
-
carve
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
Whether the given chunk should originate a carve. Called once per chunk in range beforecarve(CarvingContext).- Parameters:
config- a fresh configuration instancerandom- a random seeded for this chunk- Returns:
- whether to carve from this chunk
- Since:
- 3.0.0
-
canReplaceBlock
WhetherCarvingContext.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
- Returns:
- the chunk radius this carver may reach into
- Since:
- 3.0.0
-
probability
- Returns:
- the per-chunk chance this carver originates a carve
- Since:
- 3.0.0
-
lavaLevel
The y-level below whichCarvingContext.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
- Returns:
- the materials
CarvingContext.carveEllipsoid(double, double, double, double, double, CarvingContext.CarveSkipChecker)may replace - Since:
- 3.0.0
-
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 fromCarvingContext.random().- Returns:
- the height provider
- Since:
- 3.0.0
-
yScale
- Returns:
- the nominal vertical scale of this carver
- Since:
- 3.0.0
-
key
-
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
-
newConfig
-
register
Registers this carver into the CARVER registry under the key of this carver.- Specified by:
registerin interfaceRegisterable<C>- Returns:
- this carver
- Since:
- 3.0.0
-
registerAs
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
Convenience method for registering a carver.- Type Parameters:
C- the configuration type- Parameters:
key- the registry key to register undercarver- the carver to register- Returns:
- the registered carver
- Since:
- 3.0.0
-
clone
Clones this carver.
-