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 configuration, BlockState state) abstract booleancarve(CarvingContext context, C configuration, ChunkAccess chunk, Function<BlockPos, Holder<Biome>> biomeGetter, RandomSource random, Aquifer aquifer, ChunkPos sourceChunkPos, CarvingMask mask) Carves the given chunk with caves that originate from the givenchunkPos.protected booleancarveBlock(CarvingContext context, C configuration, ChunkAccess chunk, Function<BlockPos, Holder<Biome>> biomeGetter, CarvingMask mask, BlockPos.MutableBlockPos blockPos, BlockPos.MutableBlockPos helperPos, Aquifer aquifer, org.apache.commons.lang3.mutable.MutableBoolean hasGrass) Carves a single block, replacing it with the appropriate state if possible, and handles replacing exposed dirt with grass.protected booleancarveEllipsoid(CarvingContext context, C configuration, ChunkAccess chunk, Function<BlockPos, Holder<Biome>> biomeGetter, Aquifer aquifer, double x, double y, double z, double horizontalRadius, double verticalRadius, CarvingMask mask, 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 configuration) com.mojang.serialization.MapCodec<ConfiguredWorldCarver<C>> private @Nullable BlockStategetCarveState(CarvingContext context, C configuration, BlockPos blockPos, Aquifer aquifer) private static BlockStategetDebugState(CarverConfiguration configuration, BlockState state) intgetRange()private static booleanisDebugEnabled(CarverConfiguration configuration) abstract booleanisStartChunk(C configuration, 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 name, F carver) -
configured
-
configuredCodec
-
getRange
public int getRange() -
carveEllipsoid
protected boolean carveEllipsoid(CarvingContext context, C configuration, ChunkAccess chunk, Function<BlockPos, Holder<Biome>> biomeGetter, Aquifer aquifer, double x, double y, double z, double horizontalRadius, double verticalRadius, CarvingMask mask, 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 configuration, ChunkAccess chunk, Function<BlockPos, Holder<Biome>> biomeGetter, CarvingMask mask, BlockPos.MutableBlockPos blockPos, BlockPos.MutableBlockPos helperPos, Aquifer aquifer, org.apache.commons.lang3.mutable.MutableBoolean hasGrass) Carves a single block, replacing it with the appropriate state if possible, and handles replacing exposed dirt with grass.- Parameters:
blockPos- The position to carve at. The method does not mutate this position.helperPos- An additional mutable block position object to be used and modified by the methodhasGrass- Set to true if the block carved was the surface, which is checked as being either grass or mycelium
-
getCarveState
private @Nullable BlockState getCarveState(CarvingContext context, C configuration, BlockPos blockPos, Aquifer aquifer) -
getDebugState
-
carve
public abstract boolean carve(CarvingContext context, C configuration, ChunkAccess chunk, Function<BlockPos, Holder<Biome>> biomeGetter, RandomSource random, Aquifer aquifer, ChunkPos sourceChunkPos, CarvingMask mask) 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 carvedsourceChunkPos- 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 currentStep, int totalSteps, float thickness) -
isDebugEnabled
-