Skip to content

Add BlockDropResourcesEvent and EntityBreakBlockEvent#6771

Closed
qixils wants to merge 2 commits into
PaperMC:masterfrom
qixils:block-drop-resources-event
Closed

Add BlockDropResourcesEvent and EntityBreakBlockEvent#6771
qixils wants to merge 2 commits into
PaperMC:masterfrom
qixils:block-drop-resources-event

Conversation

@qixils
Copy link
Copy Markdown
Contributor

@qixils qixils commented Oct 14, 2021

Expands upon #4989 (cc @Machine-Maker) by:

  • Creating a general-purpose BlockDropResourcesEvent for all resources (items) dropped by a block (which, unlike BlockDropItemEvent, works for more than just players)
  • Making the previous BlockBreakBlockEvent extend this new event
  • Creating a new EntityBreakBlockEvent for item drops caused by an entity

Use cases:

  • adding new item drops to blocks (making all leaves drop apples, for instance)
  • modifying the drops of crops from farming villagers
  • a lot more, probably

note: blocks broken by players seem to not exist at time of event calling (i blame all the weirdly player-specific block-related events in bukkit), will investigate soon
i identified the logic that leads to this behavior but it unfortunately doesn't seem workaround-able so i opted to just include a snapshot of the blockstate inside the event instead which is Good Enough

@qixils qixils requested review from a team as code owners October 14, 2021 05:47
@stale
Copy link
Copy Markdown

stale Bot commented Dec 13, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@Machine-Maker Machine-Maker added status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. status: rebase required labels Dec 15, 2021
@stale stale Bot removed the resolution: stale label Dec 15, 2021
@qixils qixils force-pushed the block-drop-resources-event branch from a080269 to 0ddbfb6 Compare March 5, 2022 05:39
@qixils
Copy link
Copy Markdown
Contributor Author

qixils commented Mar 5, 2022

Rebased (and fixed up) for 1.18.2

Adds events that are called when a block drops resources (items) into the world
as a result of being broken.
@qixils qixils force-pushed the block-drop-resources-event branch from 0ddbfb6 to f24a646 Compare March 14, 2022 19:09
Comment thread patches/api/0323-Add-BlockDropResourcesEvent-and-subclasses.patch Outdated
@qixils qixils closed this Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added.

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

2 participants