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 interface
Used to define certain positions to skip or ignore when carving. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final BlockState
static final WorldCarver
<CanyonCarverConfiguration> static final WorldCarver
<CaveCarverConfiguration> protected static final BlockState
private final com.mojang.serialization.MapCodec
<ConfiguredWorldCarver<C>> protected static final FluidState
static final WorldCarver
<CaveCarverConfiguration> protected static final FluidState
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static boolean
canReach
(ChunkPos pChunkPos, double pX, double pZ, int pBranchIndex, int pBranchCount, float pWidth) protected boolean
canReplaceBlock
(C pConfig, BlockState pState) abstract boolean
carve
(CarvingContext pContext, C pConfig, ChunkAccess pChunk, Function<BlockPos, Holder<Biome>> pBiomeAccessor, RandomSource pRandom, Aquifer pAquifer, ChunkPos pChunkPos, CarvingMask pCarvingMask) Carves the given chunk with caves that originate from the givenchunkPos
.protected boolean
carveBlock
(CarvingContext pContext, C pConfig, ChunkAccess pChunk, Function<BlockPos, Holder<Biome>> pBiomeGetter, CarvingMask pCarvingMask, BlockPos.MutableBlockPos pPos, BlockPos.MutableBlockPos pCheckPos, Aquifer pAquifer, org.apache.commons.lang3.mutable.MutableBoolean pReachedSurface) Carves a single block, replacing it with the appropriate state if possible, and handles replacing exposed dirt with grass.protected boolean
carveEllipsoid
(CarvingContext pContext, C pConfig, ChunkAccess pChunk, Function<BlockPos, Holder<Biome>> pBiomeAccessor, Aquifer pAquifer, double pX, double pY, double pZ, double pHorizontalRadius, double pVerticalRadius, CarvingMask pCarvingMask, WorldCarver.CarveSkipChecker pSkipChecker) 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 p_65064_) com.mojang.serialization.MapCodec
<ConfiguredWorldCarver<C>> private BlockState
getCarveState
(CarvingContext pContext, C pConfig, BlockPos pPos, Aquifer pAquifer) private static BlockState
getDebugState
(CarverConfiguration pConfig, BlockState pState) int
getRange()
private static boolean
isDebugEnabled
(CarverConfiguration pConfig) abstract boolean
isStartChunk
(C pConfig, RandomSource pRandom) 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 pKey, F pCarver) -
configured
-
configuredCodec
-
getRange
public int getRange() -
carveEllipsoid
protected boolean carveEllipsoid(CarvingContext pContext, C pConfig, ChunkAccess pChunk, Function<BlockPos, Holder<Biome>> pBiomeAccessor, Aquifer pAquifer, double pX, double pY, double pZ, double pHorizontalRadius, double pVerticalRadius, CarvingMask pCarvingMask, WorldCarver.CarveSkipChecker pSkipChecker) 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:
pSkipChecker
- Used to skip certain blocks within the carved region.
-
carveBlock
protected boolean carveBlock(CarvingContext pContext, C pConfig, ChunkAccess pChunk, Function<BlockPos, Holder<Biome>> pBiomeGetter, CarvingMask pCarvingMask, BlockPos.MutableBlockPos pPos, BlockPos.MutableBlockPos pCheckPos, Aquifer pAquifer, org.apache.commons.lang3.mutable.MutableBoolean pReachedSurface) Carves a single block, replacing it with the appropriate state if possible, and handles replacing exposed dirt with grass.- Parameters:
pPos
- The position to carve at. The method does not mutate this position.pCheckPos
- An additional mutable block position object to be used and modified by the methodpReachedSurface
- 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 pContext, C pConfig, BlockPos pPos, Aquifer pAquifer) -
getDebugState
-
carve
public abstract boolean carve(CarvingContext pContext, C pConfig, ChunkAccess pChunk, Function<BlockPos, Holder<Biome>> pBiomeAccessor, RandomSource pRandom, Aquifer pAquifer, ChunkPos pChunkPos, CarvingMask pCarvingMask) 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:
pChunk
- The chunk to be carvedpChunkPos
- The chunk position this carver is being called from- See Also:
-
isStartChunk
-
canReplaceBlock
-
canReach
protected static boolean canReach(ChunkPos pChunkPos, double pX, double pZ, int pBranchIndex, int pBranchCount, float pWidth) -
isDebugEnabled
-