BlockPlacementTarget

data class BlockPlacementTarget(val interactedBlockPos: BlockPos, val placedBlock: BlockPos, val direction: Direction, val interactionPoint: Vec3, val minPlacementY: Double, val rotation: Rotation)

Constructors

Link copied to clipboard
constructor(interactedBlockPos: BlockPos, placedBlock: BlockPos, direction: Direction, interactionPoint: Vec3, minPlacementY: Double, rotation: Rotation)

Properties

Link copied to clipboard
val blockHitResult: BlockHitResult
Link copied to clipboard
val direction: Direction
Link copied to clipboard
val interactedBlockPos: BlockPos

BlockPos which is right-clicked

Link copied to clipboard

Exact point on interactedBlockPos selected by target finding.

Link copied to clipboard

Lower bound (world y) of the shape box interactionPoint was sampled from. One block face can consist of several boxes lying in the same plane (a stair's north face is a lower slab box plus an upper step box), which direction alone cannot tell apart.

Link copied to clipboard
val placedBlock: BlockPos

Block pos at which a new block is placed

Link copied to clipboard

The rotation aiming at interactionPoint. It is derived from the (possibly predicted) PlayerLocationOnPlacement.eyePos, so a click has to be verified from the eye the server will use.

Functions

Link copied to clipboard
fun doesCrosshairTargetMatchRequirements(crosshairTarget: BlockHitResult): Boolean
Link copied to clipboard
fun BlockPlacementTarget.verifyClick(rotation: Rotation = this.rotation, range: Double = max(player.blockInteractionRange(), player.entityInteractionRange()), trace: ClickTrace = ClickTrace.WORLD, onFailure: FailedClick = FailedClick.NOTHING): BlockHitResult?

Verifies that this target can be clicked right now, i.e. that the interaction would be accepted.