Interface CarvingContext<C>

Type Parameters:
C - the carver's configuration type
All Superinterfaces:
Wrapper

@NullMarked @AsOf("3.0.0") @Experimental public interface CarvingContext<C> extends Wrapper
The carving surface handed to a CustomCarver during world generation.

Positions are absolute world coordinates unless a method says otherwise. Only the chunk at chunkLocation() is writable and writes outside it are silently dropped you can check with canReach(double, double, int, int, float)

Since:
3.0.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Mirror of: net.minecraft.world.level.levelgen.carver.WorldCarver.CarveSkipChecker.
  • Method Summary

    Modifier and Type
    Method
    Description
    biome(int x, int y, int z)
     
    boolean
    canReach(double x, double z, int currentStep, int totalSteps, float thickness)
    Whether a carve of the given thickness could still reach the chunk being written.
    boolean
    Whether the carver's replaceable set admits the given state.
    default boolean
    carveEllipsoid(double x, double y, double z, double horizontalRadius, double verticalRadius)
    Carves an axis-aligned ellipsoid, skipping nothing beyond its own bounds.
    boolean
    carveEllipsoid(double x, double y, double z, double horizontalRadius, double verticalRadius, CarvingContext.CarveSkipChecker skipChecker)
    Carves an axis-aligned ellipsoid centered on the given position, delegating to Minecraft.
    carveState(int x, int y, int z)
    Resolves the state a carve would leave at the given position: lava below the carver's lava level, otherwise the aquifer's substance.
    The chunk currently being written.
    The carver's configuration.
    int
     
    getBlock(int x, int y, int z)
    Gets the block data at the given absolute world position.
    default BlockData
    Gets the block data at the given absolute world position.
    boolean
    isCarved(int x, int y, int z)
    Whether the given absolute world position has already been carved this chunk.
    default boolean
    isOutsideChunk(int relativeX, int y, int relativeZ)
     
    boolean
    Whether the chunk being written is upgrading from an older format.
    void
    markCarved(int x, int y, int z)
    Marks the given absolute world position as carved.
    void
    markPosForPostProcessing(int x, int y, int z)
    Queues the given absolute world position for post-processing.
    int
     
    A random source seeded for this carve.
    void
    setBlock(int x, int y, int z, BlockData data)
    Sets a block at the given absolute world position.
    default void
    setBlock(BlockVector position, BlockData data)
    Sets a block at the given absolute world position.
    boolean
     
    The chunk this carve originated from.
    topMaterial(int x, int y, int z, boolean underFluid)
    Deprecated.
    Deprecated in Minecraft.

    Methods inherited from interface Wrapper

    asHandle, toMinecraft, unwrap
  • Method Details

    • config

      @AsOf("3.0.0") C config()
      The carver's configuration.
      Returns:
      the config instance
      Since:
      3.0.0
    • random

      @AsOf("3.0.0") Random random()
      A random source seeded for this carve.
      Returns:
      a view of the world generation random
      Since:
      3.0.0
    • sourceChunk

      @AsOf("3.0.0") ChunkLocation sourceChunk()
      The chunk this carve originated from. Not necessarily the chunk being written.
      Returns:
      the source chunk location
      Since:
      3.0.0
    • chunkLocation

      @AsOf("3.0.0") ChunkLocation chunkLocation()
      The chunk currently being written.
      Returns:
      the target chunk location
      Since:
      3.0.0
    • minGenY

      @AsOf("3.0.0") int minGenY()
      Returns:
      the lowest y-level generation may produce
      Since:
      3.0.0
    • genDepth

      @AsOf("3.0.0") int genDepth()
      Returns:
      the total height of the generation region
      Since:
      3.0.0
    • carveEllipsoid

      @AsOf("3.0.0") boolean carveEllipsoid(double x, double y, double z, double horizontalRadius, double verticalRadius, CarvingContext.CarveSkipChecker skipChecker)
      Carves an axis-aligned ellipsoid centered on the given position, delegating to Minecraft. Blocks resolve to lava below the carver's lava level and to the aquifer's substance elsewhere; surface material is reapplied to exposed dirt. Positions the checker rejects are left alone.
      Returns:
      whether any block was carved
      Since:
      3.0.0
    • carveEllipsoid

      @AsOf("3.0.0") default boolean carveEllipsoid(double x, double y, double z, double horizontalRadius, double verticalRadius)
      Carves an axis-aligned ellipsoid, skipping nothing beyond its own bounds.
      Returns:
      whether any block was carved
      Since:
      3.0.0
    • canReach

      @AsOf("3.0.0") boolean canReach(double x, double z, int currentStep, int totalSteps, float thickness)
      Whether a carve of the given thickness could still reach the chunk being written. Walks that keep stepping past a false return waste work.
      Returns:
      whether the chunk is still reachable
      Since:
      3.0.0
    • carveState

      @AsOf("3.0.0") Optional<BlockData> carveState(int x, int y, int z)
      Resolves the state a carve would leave at the given position: lava below the carver's lava level, otherwise the aquifer's substance.
      Returns:
      the carve state, or empty if the aquifer declines to carve
      Since:
      3.0.0
    • shouldScheduleFluidUpdate

      @AsOf("3.0.0") boolean shouldScheduleFluidUpdate()
    • getBlock

      @AsOf("3.0.0") BlockData getBlock(int x, int y, int z)
      Gets the block data at the given absolute world position.
      Returns:
      the block data currently at that position
      Since:
      3.0.0
    • getBlock

      @AsOf("3.0.0") default BlockData getBlock(BlockVector position)
      Gets the block data at the given absolute world position.
      Returns:
      the block data currently at that position
      Since:
      3.0.0
    • setBlock

      @AsOf("3.0.0") void setBlock(int x, int y, int z, BlockData data)
      Sets a block at the given absolute world position.
      Since:
      3.0.0
    • biome

      @AsOf("3.0.0") Biome biome(int x, int y, int z)
    • setBlock

      @AsOf("3.0.0") default void setBlock(BlockVector position, BlockData data)
      Sets a block at the given absolute world position.
      Since:
      3.0.0
    • isCarved

      @AsOf("3.0.0") boolean isCarved(int x, int y, int z)
      Whether the given absolute world position has already been carved this chunk.
      Returns:
      whether the position is masked
      Since:
      3.0.0
    • markCarved

      @AsOf("3.0.0") void markCarved(int x, int y, int z)
      Marks the given absolute world position as carved. Positions outside the chunk being written are ignored.
      Since:
      3.0.0
    • canReplaceBlock

      @AsOf("3.0.0") boolean canReplaceBlock(BlockData state)
      Whether the carver's replaceable set admits the given state.
      Returns:
      whether the state may be replaced
      Since:
      3.0.0
    • isUpgrading

      @AsOf("3.0.0") boolean isUpgrading()
      Whether the chunk being written is upgrading from an older format.
      Returns:
      whether the chunk is upgrading
      Since:
      3.0.0
    • markPosForPostProcessing

      @AsOf("3.0.0") void markPosForPostProcessing(int x, int y, int z)
      Queues the given absolute world position for post-processing. Required after placing a fluid by hand.
      Since:
      3.0.0
    • topMaterial

      @Deprecated @AsOf("3.0.0") Optional<BlockData> topMaterial(int x, int y, int z, boolean underFluid)
      Deprecated.
      Deprecated in Minecraft.
      Resolves the surface material the biome's surface rule would place at the given absolute world position.
      Returns:
      the surface material, or empty if the surface rule declines
      Since:
      3.0.0
    • isOutsideChunk

      @Internal default boolean isOutsideChunk(int relativeX, int y, int relativeZ)