mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 01:26:50 -04:00
Fix rare wrong behaviour where block is picked with bedrock height <= 0
If bedrock height is <= 0 and you're inside the map and picking a block on horizontal border inside, you pick block above the border instead of the block of the border
This commit is contained in:
parent
94d154aa57
commit
24b4ede5fb
@ -106,18 +106,18 @@ void RayTracer_Step(struct RayTracer* t) {
|
||||
typedef cc_bool (*IntersectTest)(struct RayTracer* t);
|
||||
|
||||
static BlockID Picking_GetInside(int x, int y, int z) {
|
||||
cc_bool sides;
|
||||
int height;
|
||||
int floorY;
|
||||
|
||||
if (World_ContainsXZ(x, z)) {
|
||||
if (y >= World.Height) return BLOCK_AIR;
|
||||
if (y >= 0) return World_GetBlock(x, y, z);
|
||||
floorY = 0;
|
||||
} else {
|
||||
floorY = Env_SidesHeight;
|
||||
}
|
||||
|
||||
/* bedrock on bottom or outside map */
|
||||
sides = Env.SidesBlock != BLOCK_AIR;
|
||||
height = Env_SidesHeight; if (height < 1) height = 1;
|
||||
return sides && y < height ? PICKING_BORDER : BLOCK_AIR;
|
||||
return Env.SidesBlock != BLOCK_AIR && y < floorY ? PICKING_BORDER : BLOCK_AIR;
|
||||
}
|
||||
|
||||
static BlockID Picking_GetOutside(int x, int y, int z, IVec3 origin) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user