#(the_lordnoob) Event: player brushes with<item> <block>

54 messages · Page 1 of 1 (latest)

fickle shadow
#

Heyo Guys.

I want to track when a player brushes a block.
My Aim is to track the overall time used a brush.

But i found out there is no fitting Event for this usecase, because raises|lowers|toggles item doesn't hit there

Any Suggestions?
Thanks for your time

rose frigateBOT
#

(the_lordnoob) Event: player brushes with<item> <block>

rose frigateBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.

random terraceBOT
# vapid herald !event clicks block
Group

Player

**WARNING**

this event may in some cases double-fire, requiring usage of the 'ratelimit' command (like 'ratelimit <player> 1t') to prevent doubling actions.

Event Lines

player (right|left) clicks <block>

Switches

with:<item> to only process the event if a specified item was held.
using:hand/off_hand/either_hand to only process the event if the specified hand was used to click.
type:<material> to only run if the block clicked matches the material input.

Triggers

when a player clicks on a block or in the air.

Has Player

Always. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.

Context

<context.item> returns the ItemTag the player is clicking with.
<context.location> returns the LocationTag the player is clicking on.
<context.relative> returns a LocationTag of the air block in front of the clicked block.
<context.click_type> returns an ElementTag of the Spigot API click type <@link url https://hub.spi...
<context.hand> returns an ElementTag of the used hand.

Has Known Location

True - this adds switches in:<area> + location_flagged:<flag name>.

Cancellable

True - this adds <context.cancelled> and determines cancelled + cancelled:false.

fickle shadow
#

yeah, but it triggers with air too

#

sadly that doesn't solves the issue of

My Aim is to track the overall time used a brush.

#

it would be awesome if there is a toggles brush option, so that it triggers on start and end of brushing

limber silo
fickle shadow
limber silo
#

~~You can also flag the player when they right click the block with the suspicious sand location (expire it after 6 seconds. It takes about 4.8seconds to brush something), then ~~use the block drops item from breaking event to check whether suspicious sand has dropped an item and use the location you flagged onto the player to check whether that suspicious sand dropped an item. If so, add 4.8 seconds to the total duration of brushing.

#

Theres no specific event for 'brushing'

#

spigot doesnt have one

misty patio
limber silo
#

If you keep it, and the player doesnt actually brush it imeddiately. They go away for 30 mins then come back to brush it, it will count as 30 minutes and 6 seconds

#

unless

#

oh wait no that was with my previous logic that I left out

#

Well ig it's not necessary seeing as the 4.8 seconds would be hardcoded, and it's not the duration between right clicking and getting the item

misty patio
#

is brushing time hardcoded for every suspicious block?

#

(& is it the same)

limber silo
#

I took that

misty patio
#

if they want just the time spent until the item is dropped can just use the blocks drops item event as the duration is hardcoded tbh

#

if they want brushing any block for any duration uh

#

id go for flagging w a really small expiration and slowly incrementing it

#

player clicks block fires 4 times a second (or every 5 ticks)

#

can have expiration be something >5t

misty patio
#

or have a check inside the event if you want a specific list of mats *

fickle shadow
#

Nah the problem is. I want to collect as a stat, the time used to brush in total.
The material should be !air ofc.

The problem is. I can track the start, but not the end of the brushing process. There for would be a toggle good

mint viper
#

!t EntityTag.is_hand_raised

random terraceBOT
mint viper
#

this might be true while brushing

#

if that's the case, then you can loop a few times after the click event to check if the player is still brushing

limber silo
#

Alrady tried with the event (player raises/lowers item). Doesnt work for brushing. At least it didnt for me in 1.20.4

misty patio
#

you can use a while & that tag to slowly increment a flag by x every y

#

then do whatever you want with that value & make sure to remove the flag

#

eg

after player right clicks !*air with:brush:
- while <player.is_hand_raised>:
  - wait 5t
  - flag <player> brushing:+:5
#the below will fire only when the loop is over (ie when the player stops brushing)
- narrate "You brushed for <player.flag[brushing]> ticks!"
- flag <player> brushing:!```
#

note that you need to use after here instead of on in the event line

#

because you need the code to run after the player starts brushing, so the tag returns true

tender forge
#

It still wouldn't give you exactly "how long did a player brush a block for", but if it triggered when the player finished brushing a block you'd know it was 4.8 seconds at that point I guess.

random terraceBOT
# misty patio !e block drops item
Group

Player

Event Lines

block drops item from breaking <block> drops <item> from breaking

Triggers

when a items drop from a block due to a player breaking the block in survival mode.

Has Player

Always. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.

Context

<context.location> returns the LocationTag the block was broken at.
<context.material> returns the MaterialTag of the block that was broken.
<context.drop_entities> returns a ListTag of EntityTags of type DROPPED_ITEM. To get the list of I...

Has Known Location

True - this adds switches in:<area> + location_flagged:<flag name>.

Cancellable

True - this adds <context.cancelled> and determines cancelled + cancelled:false.

misty patio
#

this fires when a suspicious block drops an item

tender forge
misty patio
#

yeah initally i thought the same

#

i only know that because i played around with them when they were added

tender forge
#

Ahhh gotcha. If that's the case there's the start and end of the "brushing" event at least already.

misty patio
#

imo the end of the while there acts as a switch for when they stop brushing so we'll see if that's what they needed c:

fickle shadow