Class WorldCarver<C extends CarverConfiguration>
java.lang.Object
net.minecraft.world.level.levelgen.carver.WorldCarver<C>
- Direct Known Subclasses:
CanyonWorldCarver,CaveWorldCarver
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceUsed to define certain positions to skip or ignore when carving. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final BlockStatestatic final WorldCarver<CanyonCarverConfiguration> static final WorldCarver<CaveCarverConfiguration> protected static final BlockStateprivate final com.mojang.serialization.MapCodec<ConfiguredWorldCarver<C>> protected static final FluidStatestatic final WorldCarver<CaveCarverConfiguration> protected static final FluidState -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static booleanprotected booleancanReplaceBlock(C config, BlockState state) abstract booleancarve(CarvingContext context, C config, ChunkAccess chunk, Function<BlockPos, Holder<Biome>> biomeAccessor, RandomSource random, Aquifer aquifer, ChunkPos chunkPos, CarvingMask carvingMask) Carves the given chunk with caves that originate from the givenchunkPos.protected booleancarveBlock(CarvingContext context, C config, ChunkAccess chunk, Function<BlockPos, Holder<Biome>> biomeGetter, CarvingMask carvingMask, BlockPos.MutableBlockPos pos, BlockPos.MutableBlockPos checkPos, Aquifer aquifer, org.apache.commons.lang3.mutable.MutableBoolean reachedSurface) Carves a single block, replacing it with the appropriate state if possible, and handles replacing exposed dirt with grass.protected booleancarveEllipsoid(CarvingContext context, C config, ChunkAccess chunk, Function<BlockPos, Holder<Biome>> biomeAccessor, Aquifer aquifer, double x, double y, double z, double horizontalRadius, double verticalRadius, CarvingMask carvingMask, WorldCarver.CarveSkipChecker skipChecker) Carves blocks in an ellipsoid (more accurately a spheroid), defined by a center (x, y, z) position, with a horizontal and vertical radius (the semi-axes)configured(C config) com.mojang.serialization.MapCodec<ConfiguredWorldCarver<C>> private BlockStategetCarveState(CarvingContext context, C config, BlockPos pos, Aquifer aquifer) private static BlockStategetDebugState(CarverConfiguration config, BlockState state) intgetRange()private static booleanisDebugEnabled(CarverConfiguration config) abstract booleanisStartChunk(C config, RandomSource random) private static <C extends CarverConfiguration,F extends WorldCarver<C>>
F
-
Field Details
-
CAVE
-
NETHER_CAVE
-
CANYON
-
AIR
-
CAVE_AIR
-
WATER
-
LAVA
-
liquids
-
configuredCodec
private final com.mojang.serialization.MapCodec<ConfiguredWorldCarver<C extends CarverConfiguration>> configuredCodec
-
-
Constructor Details
-
WorldCarver
-
-
Method Details
-
register
private static <C extends CarverConfiguration,F extends WorldCarver<C>> F register(String key, F carver) -
configured
-
configuredCodec
-
getRange
public int getRange() -
carveEllipsoid
protected boolean carveEllipsoid(CarvingContext context, C config, ChunkAccess chunk, Function<BlockPos, Holder<Biome>> biomeAccessor, Aquifer aquifer, double x, double y, double z, double horizontalRadius, double verticalRadius, CarvingMask carvingMask, WorldCarver.CarveSkipChecker skipChecker) Carves blocks in an ellipsoid (more accurately a spheroid), defined by a center (x, y, z) position, with a horizontal and vertical radius (the semi-axes)- Parameters:
skipChecker- Used to skip certain blocks within the carved region.
-
carveBlock
protected boolean carveBlock(CarvingContext context, C config, ChunkAccess chunk, Function<BlockPos, Holder<Biome>> biomeGetter, CarvingMask carvingMask, BlockPos.MutableBlockPos pos, BlockPos.MutableBlockPos checkPos, Aquifer aquifer, org.apache.commons.lang3.mutable.MutableBoolean reachedSurface) Carves a single block, replacing it with the appropriate state if possible, and handles replacing exposed dirt with grass.- Parameters:
pos- The position to carve at. The method does not mutate this position.checkPos- An additional mutable block position object to be used and modified by the methodreachedSurface- Set to true if the block carved was the surface, which is checked as being either grass or mycelium
-
getCarveState
@Nullable private BlockState getCarveState(CarvingContext context, C config, BlockPos pos, Aquifer aquifer) -
getDebugState
-
carve
public abstract boolean carve(CarvingContext context, C config, ChunkAccess chunk, Function<BlockPos, Holder<Biome>> biomeAccessor, RandomSource random, Aquifer aquifer, ChunkPos chunkPos, CarvingMask carvingMask) Carves the given chunk with caves that originate from the givenchunkPos. This method is invoked 289 times in order to generate each chunk (once for every position in an 8 chunk radius, or 17x17 chunk area, centered around the target chunk).- Parameters:
chunk- The chunk to be carvedchunkPos- The chunk position this carver is being called from- See Also:
-
isStartChunk
-
canReplaceBlock
-
canReach
protected static boolean canReach(ChunkPos chunkPos, double x, double z, int branchIndex, int branchCount, float width) -
isDebugEnabled
-