Summary
When using the Minecraft Bedrock Scripting API, the faceLocation
property returned by player.getBlockFromViewDirection()
is offset by approximately 2 pixels (≈0.125 block units) on side faces (north
, south
, east
, west
). On the up
face, values range from 0 to 1 on corner pixels as expected. This offset prevents accurate quadrant mapping and pixel-perfect placement for custom block logic.
Steps to Reproduce
Stand close to a block and aim at the edge or corner of a side face (
north
,south
,east
,west
).Use the test script (included) to log the
faceLocation
values.Compare the values for the
up
face and side faces.Note the offset on side faces, where corner pixel values do not reach 0 or 1.
Expected Behavior
faceLocation
should return values ranging from 0 to 1 across the entire block face, for all faces (up
,down
,north
,south
,east
,west
) in a linear progressionThe hit location should accurately reflect where the player is aiming, allowing for precise mapping and placement.
Actual Behavior
On the
up
face,faceLocation
values range from 0 to 1 as expected.On side faces (
north
,south
,east
,west
), the relevant axis (e.g.,y
for north/south, z for east/west) is offset upward by about 2 pixels (≈0.125 block units). Values range from ≈0.03 to ≈0.9, never reaching the true edge (0 or 1).This makes it impossible to map the full face for quadrant or pixel-perfect placement reliably.
Impact
Prevents accurate quadrant mapping for custom block placement logic.
Scripts that rely on precise face hit locations (e.g., segmenting a block face into quadrants) cannot function as intended.
Inconsistent behaviour between the
up
face and side faces.
Test Case
You can use the following script to reproduce and visualise the issue. This code logs the faceLocation
vector when a player uses an item on a block face. Try aiming at the edges and corners of different block faces and observe the logged values.
import { world, system } from "@minecraft/server"
world.afterEvents.itemUse.subscribe((event) => {
const { itemStack, source: player } = event
if (itemStack.typeId === "minecraft:arrow") {
const hit = player.getBlockFromViewDirection()
if (hit && hit.faceLocation) {
player.sendMessage(`§m[Test]§r Face: ${hit.face}\nFace Location: ${JSON.stringify(hit.faceLocation)}`)
console.log(`[Test] Face: ${hit.face}\nFace Location: ${JSON.stringify(hit.faceLocation)}`)
}
}
})
Sample Observations:
Up face:
NW corner pixel:
{ x: 0, z: 0 }
(see attached imageupFaceNWCorner
)SE corner pixel:
{ x: 1, z: 1 }
(see attached imageupFaceSECorner
)
North face:
Top edge/NE corner:
{ x: ~1.0, y: ~0.9, z: 0 }
(see attached imagenorthFaceNECornerTop
)Bottom edge/NW corner:
{ x: ~0.0, y: ~0.03, z: 0 }
(see attached imagenorthFaceNWCornerBottom
)
East/West faces:
A similar offset was observed on the relevant axes.
Additional Notes
The offset is consistent across all side faces.
This behaviour is not documented and appears unintended.
Accurate face hit location is essential for advanced scripting and custom block logic.
Note in the image
northFacePixelOffset
you can see the{ "x":0.001617431640625, "y":0.022190093994140625, "z": 0 }
` is offset ~2 pixels higher than the lower NW corner, where the expected location would be as per the [API Docs](https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/blockraycasthit?view=minecraft-bedrock-stable )
Thank you for reviewing this report! Please let me know if you need further test cases or details.
Hi!
Thank you for your report!
However, this issue has been temporarily closed as Awaiting Response.
Could you upload a data pack containing mentioned script?
This ticket will automatically reopen when you reply. Thanks!
Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki