#On mouse over a block event, block:hover

1 messages · Page 1 of 1 (latest)

golden seal
#

I need a way to highlight a block that the player has the mouse cursor (touch input) over. Something that you may know from CSS block:hover. I've seen that in some maps showcased on Twitter previously, but I haven't yet figured out, how that works. How is it done? Thank you for the answer in advance.

glad nova
#

It is default in minecraft

#

You meant like this right?

golden seal
#

Yes, I don't necessarily need to edit the vanilla effect, but I would like to add a more visible effect to it.

glad nova
#

Its abt resource pack

chrome folio
#

can you show pics of what you saw

elder crypt
#

that could be client side event

#

script is server sided

chrome folio
#

we can do it on detect hover tho

golden seal
golden seal
chrome folio
#

every tick get a block from view
perfom task and save block to a varible dont run variable

on next tick if new block is same as current one then dont perform task

#
lastblock = null

tick()
  block = fromPlayerView()
  if (lastblock  == block ) return
  lastblock = block

  //doStuff```
golden seal
#

Mhm, I see and how do I give it the highlighted effect, by replacing the block or something?

chrome folio
#

u can summon entity or particle

#

particle is easy and better

#

create a block like particle

chrome folio
#

ye

elder crypt
#

what about mobile players xd

#

we have no hover event

#

bc its client side

chrome folio
#

ye

elder crypt
golden seal
chrome folio
#

not possible

#

without editung

elder crypt
#

ya not possible without EDITUNG

glad nova
#

Oh no sry

golden seal
#

Okay, I understand that it is not possible without EDITUNG of the vanilla effect, correct? Not sure how to edit the vanilla one tho.

glad nova
#

BTW - do you want to run event on block hover?

golden seal
#

Yeah.

glad nova
#

Eh

glad nova
golden seal
glad nova
golden seal
#

Imagine a board game like chess, I need to highlight the block, where the player is looking at + on right click make the move.

elder crypt
#

what that does is it finds first block in the view of player

elder crypt
#

so when mobile hover other block like on the left then its different block

glad nova
#

But again not hover

golden seal
elder crypt
#

that in the view of the player

golden seal
glad nova
elder crypt
#

xd

golden seal
elder crypt
#

how

#

bruh

#

i have learned on it

glad nova
#

Its first controls

#

Like when u start

golden seal
#

without it you can click everywhere, so much control...

elder crypt
#

but then i must overlearn agaion

glad nova
golden seal
#

aha

#

Okay, then no split controls on mobile for me either. xd

golden seal
#

I mean I can replace the blocks to highlight the path, but that does not look that good.

#

I need something more interactive with animations.

elder crypt
#

u can use custom particles and spawn them on the top of the block

golden seal
#

mhm, that could work, I kind of imagined it to be solid without spaces in between each particle, but it could work anyway.

#

So, I use the code above to highlight the confirm move location?

#

Which lang is this btw, is it TS? No semicolons? ```lastblock = null

tick()
block = fromPlayerView()
if (lastblock == block ) return
lastblock = block

//doStuff```

golden seal
#

pseudocode is it then, okay

#

and fromPlayerView() is a real function in the API?

golden seal
#

How am I supposed to implement it then?

glad nova
elder crypt
#

and if change the just run ur code

golden seal
#

Great, thanks!

golden seal