#How do I identify just the air block?

1 messages · Page 1 of 1 (latest)

eternal thunder
#
  const lookBlock = player.getBlockFromViewDirection({ excludeTypes: ["minecraft:air"], maxDistance: 2 })?.block
dreamy bane
eternal thunder
#

But it does not work

dreamy bane
eternal thunder
#

Const lookBlock is next, friend

dreamy bane
# eternal thunder Const lookBlock is next, friend

No I mean at runtime what is the value of the variable? It is expected that the value of the variable should be of type Block and be the closest air block in the player's view direction. What I am asking you, is how does the lookBlock variable not fulfill that expectation?

eternal thunder
#

It's in a runInterval

dreamy bane
#

I'm not asking for when it happens, I'm asking for what happens when it is run

#

Use the following code directly after the const lookBlock variable declaration:

console.warn(`${lookBlock.typeId}: ${lookBlock.location.x} ${lookBlock.location.y} ${lookBlock.location.z}`);
```Let me know what you see when you run the script