Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-5416

BlockBreakEvent.getBlock().getDrops() doesn't always give correct items

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • Java8 / Unix, tested on several version (Spigot / Paper) without any plugins too.

    • CraftBukkit version git-Spigot-56f8471-43183ea (MC: 1.14.4) (Implementing API version 1.14.4-R0.1-SNAPSHOT)
    • Yes

      When breaking a block using an empty hand, or a stick, or a stone, or a cobble, ...
      (in fact all non-specific tools), the result of BlockBreakEvent.getBlock().getDrops() is not always correct.

      For example:

      • If you break a DIAMOND_ORE, it will return DIAMOND (should be nothing)
      • If you break a STONE, it will return COBBLESTONE (should be nothing)

      [ FYI, BlockDropItemEvent.getItems() (deprecated event) return value is correct. ]

      Read this topic for more details:
      https://www.spigotmc.org/threads/blockbreakevent-getdrops-and-empty-hand.406866
      (it also contains the main part of the source code of the attached testable plugin + results I got with)

      How to use the attached "plugin": (to quickly test this bug)

      1. Put the jar in plugins folder
      2. Start the server
      3. Connect to it as a player
      4. Break a block
      5. Read the console output

      You'll see a difference between what the console say ("Result drops" = return of method BlockBreakEvent.getBlock().getDrops()) and what is effectively dropped to the ground.

      • All blocks (like dirt) which could be break without a specific tools will be same.
      • All blocks (like DIAMOND_ORE) which require a specific tools will differ.

      You can see examples of what I've tested by extending the "spoiler" tag in the topic mentioned above.

            Unassigned Unassigned
            arboriginal arboriginal
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: