From 421d3a745636389a625e29a28f0d6fc3a32ccd33 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sun, 7 Mar 2021 22:15:58 +1100 Subject: [PATCH] Fix if you were standing above map, and borders height was > map height, you would pick air blocks in the *inside* of the map borders instead of the outside (Thanks Goodly) --- src/Picking.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Picking.c b/src/Picking.c index e0f0bf680..d0085197f 100644 --- a/src/Picking.c +++ b/src/Picking.c @@ -167,7 +167,11 @@ static cc_bool RayTrace(struct RayTracer* t, const Vec3* origin, const Vec3* dir if (origin->X != origin->X || origin->Y != origin->Y || origin->Z != origin->Z) return false; IVec3_Floor(&pOrigin, origin); - insideMap = World_Contains(pOrigin.X, pOrigin.Y, pOrigin.Z); + /* This used to be World_Contains(pOrigin.X, pOrigin.Y, pOrigin.Z), however */ + /* this caused a bug when you were above the map (but still inside the map */ + /* horizontally) - if borders height was > map height, you would wrongly */ + /* pick blocks on the INSIDE of the map borders instead of OUTSIDE them */ + insideMap = World_ContainsXZ(pOrigin.X, pOrigin.Z) && pOrigin.Y >= 0; reachSq = reach * reach; for (i = 0; i < 25000; i++) {