#How do I identify that I'm looking at a block?
1 messages · Page 1 of 1 (latest)
player.getBlockFromViewDirection()?.block
Is this an event?
no
How do I make a filter?
Would it be using getBlock?
player.getBlockFromViewDirection({ maxDistance: 10 })?.block
Ooooo
I didn't know you could put these filters in getView
you can find all this information on the microsoft site.
I do not understand anything
There are no examples
There are only things that can be used, but the formatting is up to interpretation
if you learn javascript basics im sure the script api can be easy to pick up
but I understand needing examples thats how I started out
But
Minecraft Javascript is different
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
Does using this make me identify a specific block?
BlockRaycastOptions interface
which are the filters/options you should be looking for on the site
This here
Identifies only the air block?
What do I do then?
perhaps includeTypes:[]
will not work
if you want to filter the type, use an if statement
Can you help me identify just one block? I saw this on jayleDev
But VoidCell said it doesn't work
if
excludeTypes all blocks 💀
statement
click on the link and youll see that it doesnt have those properties.
you are thinking of EntityQueryOptions
simply just an if statement to check the block typeId or the permutation of the block
its fine
no if statement needed
Will using "includeTypes" only identify the blocks I define?
test it out
well yeah
You were sending me a link so I could read the code, but I was already reading it 🤣
I'll try
I tested it but it doesn't seem to be identifying just the air block
Hmmm
if (!player.getBlockFromViewDirection({ maxDistance: 10})) {
//all air block in viewdirection
}
Should return undefined when no block's detected