Skip to content

Add PlayerBrushBlockEvent #9774

@DapperManatee64

Description

@DapperManatee64

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) and this.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.
image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: acceptedDisputed bug is accepted as valid or Feature accepted as desired to be added.type: featureRequest for a new Feature.
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions