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 Summary
ConstructorsModifierConstructorDescriptionprotectedCustomCarver(Supplier<C> configSupplier) Creates an unregistered custom carver.protectedCustomCarver(Supplier<C> configSupplier, @Nullable ResourceKey key) Creates a custom carver with an optional registry key. -
Method Summary
Modifier and TypeMethodDescriptionabstract booleancarve(CarvingContext<C> context) Marks positions in the active target chunk as carved.protected CustomCarver<C> clone()Returns the configuration supplier used by the runtime bridge.booleanisStartChunk(C config, Random random) Determines whether this carver starts in a candidate chunk.key()The registry key assigned to this carver.final CCreates a fresh configuration instance for the runtime bridge.floatThe default probability used byisStartChunk(Object, Random).intrange()The horizontal chunk range this carver may reach from its source chunk.final CustomCarver<C> register()Registers this carver using its assigned registry key.static <C> CustomCarver<C> register(ResourceKey key, CustomCarver<C> carver) Registers a custom carver using the supplied registry key.final <T> TregisterAs(ResourceKey key) Clones and registers this carver using the supplied registry key.final @Nullable ResourceKeyReturns the nullable registry key used by the runtime bridge.
-
Constructor Details
-
CustomCarver
-
CustomCarver
Creates a custom carver with an optional registry key.- Parameters:
configSupplier- a supplier of fresh configuration instanceskey- the registry key, or null for an unregistered carver- Since:
- 4.0.0
-
-
Method Details
-
carve
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
-
range
The horizontal chunk range this carver may reach from its source chunk.- Returns:
- the carver range in chunks
- Since:
- 4.0.0
-
probability
The default probability used byisStartChunk(Object, Random).- Returns:
- the carver start probability
- Since:
- 4.0.0
-
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
Returns the nullable registry key used by the runtime bridge.- Returns:
- the registry key, or null when unregistered
- Since:
- 4.0.0
-
configSupplier
-
newConfig
-
register
Registers this carver using its assigned registry key.- Specified by:
registerin interfaceRegisterable<C>- Returns:
- this registered carver
- Throws:
NullPointerException- if this carver has no registry key- Since:
- 4.0.0
-
registerAs
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
Registers a custom carver using the supplied registry key.- Type Parameters:
C- the custom carver configuration type- Parameters:
key- the registry keycarver- the custom carver to register- Returns:
- the registered carver clone
- Since:
- 4.0.0
-
clone
-