Add PlayerBrushBlockEvent #10591
Closed
DapperManatee64
started this conversation in
Ideas
Replies: 2 comments
-
The This doesn't solve your issue about cancelling the blockstate changing tho. That can be fixed by adding an EntityChangeBlockEvent right before that happens which you can cancel. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hey @DapperManatee64, if you need any assistance with the API or what Machine-Maker has mentioned above, please join us on Discord! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is your feature request related to a problem?
As it currently exists, the BlockDropItemEvent is fired after the player has completed brushing a BrushableBlock. This event only controls the dropped items but occurs after the block has already changed from a 'suspicious ' to a normal block. A new event which controlled this change and controlled whether the BlockDropItemEvent would provide more customization to the brushing feature introduced in 1.20.
Describe the solution you'd like.
Introduce a new event - PlayerBrushBlockEvent.
This new event can extend the BlockEvent class and have a variable for the Player.
In the BrushableBlockEntity class, move the
this.dropContent(player)
andthis.level.setBlock(this.worldPosition, block1defaultBlockState(), 3);
into an if-statement to check if the brushable block event is cancelled.See the attached picture for the possible solution. I attempted to contribute to Paper directly but got a little lost following the Contributing ReadMe documentation for Git and GitHub and gave up.
Describe alternatives you've considered.
As of right now, the only solution is to listen to the BlockItemDropEvent and check if the block was a suspicious type, using a BukkitRunnable set to a few ticks to "reset" the block if we want the mechanic to be cancelled. A new event to represent this situation is a more clean solution and provides more flexibility for developers.
Other
No response
Beta Was this translation helpful? Give feedback.
All reactions