#How do I identify that I'm looking at a block?

1 messages · Page 1 of 1 (latest)

low mirage
#

Is there a way to do this without using Vector?

meager birch
#

player.getBlockFromViewDirection()?.block

low mirage
meager birch
#

no

low mirage
#

Ok

#

Thank you very much, Remember

meager birch
#

np

#

it's long range detection so u might wana add filters or not

low mirage
#

Would it be using getBlock?

meager birch
#
player.getBlockFromViewDirection({ maxDistance: 10 })?.block
low mirage
#

I didn't know you could put these filters in getView

gritty jolt
low mirage
#

There are no examples

#

There are only things that can be used, but the formatting is up to interpretation

gritty jolt
#

but I understand needing examples thats how I started out

low mirage
#

Minecraft Javascript is different

gritty jolt
#

minecraft api

#

and no it is not

low mirage
#

Minecraft programming, requires you to know Minecraft things

#

I can understand Javascript, I just don't know what can be used in Minecraft

#
player.getBlockFromViewDirection({ includeTypes: ["minecraft:air"], maxDistance: 10 })?.block
low mirage
gritty jolt
#

BlockRaycastOptions interface

#

which are the filters/options you should be looking for on the site

low mirage
#

Identifies only the air block?

low mirage
gritty jolt
#

click the link.

#

it shows what properties you can use

meager birch
#

perhaps includeTypes:[]

gritty jolt
#

if you want to filter the type, use an if statement

low mirage
#

But VoidCell said it doesn't work

gritty jolt
#

if

meager birch
#

excludeTypes all blocks 💀

gritty jolt
#

statement

gritty jolt
#

you are thinking of EntityQueryOptions

gritty jolt
low mirage
meager birch
gritty jolt
#

nvm

#

lmao

#

alr, ignore me then

meager birch
#

its fine

gritty jolt
#

no if statement needed

low mirage
# low mirage

Will using "includeTypes" only identify the blocks I define?

meager birch
#

test it out

low mirage
low mirage
low mirage
meager birch
#

Hmmm

meager birch
#

Should return undefined when no block's detected