Skip to content

feat: Add BlockDropResourcesEvent#14009

Open
EggAllocationService wants to merge 3 commits into
PaperMC:mainfrom
EggAllocationService:block-drop-resources-event
Open

feat: Add BlockDropResourcesEvent#14009
EggAllocationService wants to merge 3 commits into
PaperMC:mainfrom
EggAllocationService:block-drop-resources-event

Conversation

@EggAllocationService

@EggAllocationService EggAllocationService commented Jun 29, 2026

Copy link
Copy Markdown

A drawback of BlockDropItemEvent is that the list of drops provided covers all items produced during the entire neighbor update phase. As a result, if you break a block with a torch on top you get one BlockDropItemEvent with both the block's drop and the torch.

If you want to replace the dropped item, this usually wouldn't be an issue since most blocks only drop one item. If you wanted to replace what torches drop via a plugin you'd just replace all instances of Material.TORCH in all BlockDropItemsEvent.

A problem arises if vanilla loot tables have been modified via a datapack: It may not be possible to look at the list of drops from the entire update chain and determine what blocks dropped items and which drops belong to which block. For example, a block may drop multiple items picked from a random list.

BlockDropResourcesEvent is called from within Block.dropResources and so will capture the exact list of drops generated for each individual block being broken, whether it was broken directly by a player or indirectly. Without this event, the best a plugin could do would be replacing all of the drops in an update chain with the replacement(s) for just the initial block that was broken.

@EggAllocationService EggAllocationService requested a review from a team as a code owner June 29, 2026 16:10
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Jun 29, 2026
@EggAllocationService EggAllocationService changed the title add BlockDropResourcesEvent feat: Add BlockDropResourcesEvent Jun 29, 2026
@JustAHuman-xD

JustAHuman-xD commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Can confirm an event like this would fill a huge gap in the existing API, I actually brought up making this exact kind of event, though slightly differently, in the paper discord (and made the changes locally) but I never opened the PR because I wasn't sure it would be accepted. (I didn't much of a response from the paper team in the discord server.)
See: Original Conversation & Paper Team Question for context on other reasons you might need an event like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Awaiting review

Development

Successfully merging this pull request may close these issues.

2 participants