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

Event or flag for blocks being broken by other blocks

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • None
    • This server is running Paper version git-Paper-386 (MC: 1.19.3) (Implementing API version 1.19.3-R0.1-SNAPSHOT) (Git: 4da844f)
    • Yes

      I find it difficult to explain exactly what I am lloking for here, so I'll describe the way Spigot is limiting me currently:

      If I break a block that has a torch on it, only the BlockBreakEvent for the initial block is fired, with no BlockBreakEvent for the torch since the player didnt break it. There isn't really a way to tell that the initial block triggered another block to break.

      There also isn't really a way to listen to the torch being broken by itself. There are kind of hacky workarounds where you can check if the blocks adjacent to the initial block are of a certain type, or you can use the BlockDropItem event to listen for the torch being dropped. I thought the BlockDropItemEvent would work, but you cant get the torch's original BlockState from the BlockDropItemEvent.

      Basically I need a way to tell that a block attached to another block is breaking. This used to be possible with org.Bukkit.Attachable and MaterialData, but MaterialData is now deprecated. Any modern alternative would be great.

            Unassigned Unassigned
            Apion Mason Bell
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: