Change how targetting liquids work

This commit is contained in:
2026-10-07 17:48:50 -03:00
parent ff53d30a7e
commit b128da0631
13 changed files with 42 additions and 18 deletions
+6 -1
View File
@@ -665,7 +665,8 @@ export class ClientLevel {
}
// the first block along the view of something at x/y/z looking at yaw/pitch, like minecraft's pick. it has to go
// into one of the block's boxes (see common/block_shapes.ts), so it looks past the empty half of a slab
// into one of the block's boxes (see common/block_shapes.ts), so it looks past the empty half of a slab. it looks
// through liquids unless liquids is set, see ItemRegistry.targets_liquids
pick(
x: number,
y: number,
@@ -673,6 +674,7 @@ export class ClientLevel {
yaw: number,
pitch: number,
max_distance = 6,
liquids = false,
step = 0.05,
): BlockHitResult | undefined {
const cos_pitch = Math.cos(pitch);
@@ -702,6 +704,9 @@ export class ClientLevel {
continue;
}
const info = this.#blocks[block];
if (!liquids && is_liquid_block(info)) {
continue;
}
const hit = clip_shape(
info ? shape_at(info, value) : FULL_SHAPE,
bx,