Skip to content

[Feature request] Add isSource() and getChangedBlockData() to BlockPhysicsEvent #1867

@sotr2333

Description

@sotr2333

Is your feature request related to a problem? Please describe.

  • Now, commonly BlockPhysicsEvent will be called for 7 times when one block change(the "root" block). Paper's getSourceBlock() allows checking whether the block being updated is the root block itself, but it's veiled for most developers, we can simply add a method named like isSource() and simply return sourceBlock == block.

  • There is a BlockData field called changed in BPE, however, we can only use getChangedType() instead of getting the block data directly, we can simply add a method like getChangedBlockData() and simply return it.

Describe the solution you'd like
Described above.

Describe alternatives you've considered
Aside from this, we can even add a new event called BlockChangedEvent for every source event, which is perfect for block change recording and monitor. (at World#notifyAndUpdatePhysics, blockdata1 is the old block)

Additional context
I have done some tests and works smoothly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedCommunity assistance requested, PRs welcome.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