#Detecting the location of a block through advancements

1 messages · Page 1 of 1 (latest)

eager sequoia
#

Is it possible to dynamically detect the location of a block when it has been used? for example, if i open a barrel, can i know its coordinates and run a command on that location?

stark carbonBOT
#
Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

🙇 After a while, hit the Summon Helpers button to ping the helper team. They'll be happy to help you

✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve

young jacinth
#

can't you just take the player who opened it and get the block he's looking at?

eager sequoia
#

no i want to be able to modify the block when the player opens it

uncut condor
#

no, there is currently no way to do that directly and 100% accurately, you always either need to raycast to check where the player is looking at or check every single block in the area if you know what block was placed/opened

eager sequoia
#

ah i see

#

i was wondering if i could change my already laggy raycast to advancements

#

guess i'll have to deal with it

#

and i don't suppose its possible to copy data from an entity to a player by using advancements?

#

wait can you use advancements to detect looking at an entity?

uncut condor
#

not really, no

#

there is a looking at predicate for players but that behaves unintuitively

#

and you still need to go through all entities in the area

#

so its not faster than a raycast most of the time

eager sequoia
#

oh

#

do you have suggestions on you best the distance for a raycast to travel

#

i have it set to .06 blocks every tick rn

uncut condor
#

I always use a step distance of 0.1 and then go a little over 6 blocks in range

eager sequoia
#

thanks :D

stark carbonBOT
# stark carbon
Question Closed

Your question, #1194638820361109584 (Detecting the location of a block through advancements), was resolved!

Original Message

Is it possible to dynamically detect the location of a block when it has been used? for example, if i open a barrel, can i know its coordinates and run a command on that location?

Duration open

11m

stark carbonBOT