PaperMC / PaperMC/Paper

BlockDropItemEvent does not execute for indirectly broken blocks

Open
#10,422 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: input wanted type: bug version: 1.20.4
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

Expected behavior

BlockDropItemEvent should execute for indirectly broken blocks (like if a torch was on top of a stone block and the stone was broken- the torch also gets indirectly broken). Because BlockDropItemEvent has a Player attached to it, it should only occur if the block was broken by a player.

Observed/Actual behavior

When a block is broken indirectly by a player (like if a torch was on top of a stone block and the stone was broken- the torch also gets indirectly broken), BlockDropItemEvent does not execute like the documentation says it does:

This event will also be called if the player breaks a multi block structure, for example a torch on top of a stone.

Steps/models to reproduce
@EventHandler
    public void onBlockDropItem(BlockDropItemEvent event) {
        Bukkit.broadcast(Component.text(event.getBlockState().getType() + ""));
    }

Place blocks that get indirectly broken on top of your "main" block. Then break the main block and observe the chat.

Plugin and Datapack List

Custom plugin

Paper version

This server is running Paper version git-Paper-484 (MC: 1.20.4) (Implementing API version 1.20.4-R0.1-SNAPSHOT) (Git: 4445d23)
You are running the latest version
Previous version: git-Paper-478 (MC: 1.20.4)

Other

I have tried multiple variations of blocks that get indirectly broken (vines, scaffolding, flowers, signs, etc). This is not just an issue for only torches.
image
image1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior with the BlockDropItemEvent handler shown in the issue: place indirectly broken blocks such as torches, vines, scaffolding, flowers, or signs and break the supporting block. Done means the event executes for indirectly broken blocks caused by a player, while non-player breaks do not produce a player-attached event.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.