From 60603ab74c93376ef2a5e9fb2e088256739ecd3f Mon Sep 17 00:00:00 2001 From: SysAdmin Date: Fri, 24 Apr 2026 16:32:26 +0100 Subject: [PATCH] fix(camping): scan-down now uses air/liquid check + hammock camera pull The tent's scan-down-for-ground loop still used b.isSolid (undefined in BDS), so it always fell through the break conditions and decremented feetY by 3 blocks before checking ground. That's why clicking grass reported "dirt" and stone reported "dirt/stone from underneath the surface". Replaced both solid checks with !isAir && !isLiquid like the main ground check. Also added a cinematic third-person camera when climbing into the hammock (ease 0.8s out_sine), cleared on exit. Gives the player a "lying back, can see myself" view while resting. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../camping_supplies_BP/scripts/main.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/camping-supplies-addon/camping_supplies_BP/scripts/main.js b/camping-supplies-addon/camping_supplies_BP/scripts/main.js index 650bbab..ce7d8f3 100644 --- a/camping-supplies-addon/camping_supplies_BP/scripts/main.js +++ b/camping-supplies-addon/camping_supplies_BP/scripts/main.js @@ -104,13 +104,14 @@ function tryPlaceTent(player) { const feetX = Math.floor(player.location.x); const feetZ = Math.floor(player.location.z); let feetY = Math.floor(player.location.y); - // If the block at feet level is air (player's mid-jump or location rounded up), - // scan downward up to 3 blocks to find the ground. + // If the block at feet level is solid (player inside a block, e.g. standing in + // tall grass that rounded up), step up one. + const feetBlock = dim.getBlock({ x: feetX, y: feetY, z: feetZ }); + if (feetBlock && !feetBlock.isAir && !feetBlock.isLiquid) feetY += 1; + // If the block below is air (mid-jump / airborne), project down to ground. for (let probe = 0; probe < 4; probe++) { - const here = dim.getBlock({ x: feetX, y: feetY - 1, z: feetZ }); - if (here && here.isSolid) break; - const onSolid = dim.getBlock({ x: feetX, y: feetY, z: feetZ }); - if (onSolid && onSolid.isSolid) { feetY += 1; break; } + const below = dim.getBlock({ x: feetX, y: feetY - 1, z: feetZ }); + if (below && !below.isAir && !below.isLiquid) break; feetY -= 1; } const ox = feetX + fx; @@ -347,6 +348,11 @@ function toggleHammock(player, loc) { player.addEffect("saturation", 40, { amplifier: 0, showParticles: false }); player.addEffect("regeneration", 200, { amplifier: 1, showParticles: false }); } catch (_) {} + // Pull the camera back into a cinematic third-person view so the player can see + // themselves lying in the hammock. Ease in smoothly. + try { + player.runCommand("camera @s set minecraft:third_person ease 0.8 out_sine"); + } catch (_) {} player.sendMessage("§a[Camping] §7You settle into the hammock. Wild creatures don't notice you. §8(Sneak to climb out.)"); } @@ -374,6 +380,7 @@ function exitHammock(player) { } } catch (_) {} try { player.setDynamicProperty(HAMMOCK_ANCHOR_PROP, undefined); } catch (_) {} + try { player.runCommand("camera @s clear"); } catch (_) {} player.sendMessage("§7[Camping] You climb out of the hammock."); }