what i tried was InteractBlockEvent.Primary.MainHand , which is getting fired on every tick (i guess) when mining the block , so its not possible to get when the player started digging without listening for the packet .
adding this will be nice
@jd1378 What is your usecase?
Some use cases I can think of off the top of my head that may or may not want to be considered.
Where should be the event? In ChangeBlockEvent.Break? like ChangeBlockEvent.Break.Start/Stop/Abort ?
@ryantheleach 1 and 4 are my usecase,
@RedNesto I don't know exactly where the event should be in the API, but IMO it is not necessarily changing the block , while its related to changing the block ,but anyway, what you suggest seems fine to me
It won't be ChangeBlockEvent as the block isn't being changed until it finally breaks.
Since there is Key for Sneaking and Sprinting , why not add the key for these ?
Or there can be a new PlayerActionEvent with both entity action and player digging ? PlayerActionEvent.Start.Sneaking/Sprinting/Mining....?
The Player part of the event name can be too restrictive, so I'll ask here what I asked you in PM: Can Humans/Humanoids dig?
The another issue with the event you are giving us is that the last sub-events (Sneaking, Sprinting) are already accessible via the Keys so what about just a DiggingBlockEvent with sub-event like Start/Stop/Abort?
I'd keep it named as Action Target Event as the API follows, like ChangeBlockEvent or DestroyLivingEvent, etc. Since the action is always constant, the target can change, and we don't use the source in the naming convention since it is included already in the cause.
I'm in favor of DiggingBlockEvent with Start / Stop / Abort and possibly Complete if it's possible in implementation to determine whether it's completed etc.
@RedNesto in answer to your question , i think it depends on the implementation of the humanoid , while it can start digging , there's actually little to no benefit in doing so imo , since the swing and interaction should be handled separately ?
@RedNesto Many entities in modded Minecraft can dig, not just humans.
I only used humans as an example for vanilla. I also was in a hurry and haven't had the time to add reference to mods :3
Most helpful comment
I'd keep it named as
ActionTargetEventas the API follows, likeChangeBlockEventorDestroyLivingEvent, etc. Since the action is always constant, the target can change, and we don't use the source in the naming convention since it is included already in the cause.I'm in favor of
DiggingBlockEventwithStart/Stop/Abortand possiblyCompleteif it's possible in implementation to determine whether it's completed etc.