PaperMC / Paper

The most widely used, high performance Minecraft server that aims to fix gameplay and mechanics inconsistencies
https://papermc.io/
Other
9.37k stars 2.19k forks source link

BlockDestroyEvent doesn't fire for a lot of redstone blocks #10869

Open JHarris12345 opened 3 weeks ago

JHarris12345 commented 3 weeks ago

Expected behavior

The BlockDestoryEvent fires when a block is broken and causes another block to break due to it (like breaking the block a redstone torch is sitting on). However, it doesn't fire for a lot of redstoen components like repeaters, redstone, comparators etc. It DOES fire for redstone torches though

Observed/Actual behavior

It should fire for all redstone components and blocks that break due to it

Steps/models to reproduce

Place a block, place redstone on top, break the block and the redstone will drop but won't fire the BlockDestroyEvent

Plugin and Datapack List

13:05:17 INFO: - AdvancedAchievements, AdvancedArmorStands, AdvancedEnchantments, BlockLocker, Brewery, BuycraftX, ChestShop, ChestShop-LegacyIds, Chunky, Citizens 13:05:17 INFO: ClearLag, Commander, CoreProtect, DeluxeMenus, DespawnSpy, DetrimUtils, EnchantGui, Essentials, EssentialsAntiBuild, EssentialsGeoIP 13:05:17 INFO: EssentialsProtect, EssentialsSpawn, ExploitFixer, FarmLimiter, FeatherBoard, floodgate, GPFlags, GriefPrevention, GSit, HamsterAPI 13:05:17 INFO: HolographicDisplays, ICClass, IllegalStack, InsanityChat, InsanityCore, InsanityCrates, InsanityDuels, InsanityMinions, InsanityModeration, InsanityShops 13:05:17 INFO: InsanityStacker, InsanityWarps, KixsAutoAnnouncerPremium, LibsDisguises, LuckPerms, MineableSpawners, Multiverse-Core, MyCommand, OpenInv, PartyChat 13:05:17 INFO: PlaceholderAPI, PlayerParticles, PlayerVaults, PlugManX, ProtocolLib, PyroFishingPro, PyroFishingPro, PyroLib, PyroLib, RedstoneClockDetector 13:05:17 INFO: RestrictedCreative, Sentry, SeparateInventories, spark, StableMaster, StellarTags, TAB, TradeSystem, Vault, ViaBackwards 13:05:17 INFO: ViaRewind, ViaVersion, VoidGen, Votifier, VotingPlugin, Vulcan, WildTools, WorldEdit, WorldGuard, WorldGuardExtraFlags

Paper version

[13:08:29 INFO]: This server is running Paper version git-Paper-318 (MC: 1.20.2) (Implementing API version 1.20.2-R0.1-SNAPSHOT) (Git: 9271ee7) You are running the latest version

Other

No response

rymiel commented 3 weeks ago

Able to reproduce on Paper version 1.20.6-138-master@906df69 (2024-06-10T06:32:15Z) (Implementing API version 1.20.6-R0.1-SNAPSHOT)

All rail blocks also fail to fire the destroy event.

ploppyperson commented 2 weeks ago

The reason this is happening is that the event is called in Level#destroyBlock. However, when redstone wire/repeaters/rails are broken, Level#removeBlock is called instead (so event is not fired.)

Would it be better to change the removeBlock calls to destroyBlock or to add the event calls to these locations?

EDIT: Reading the javadocs for the event, it states:

This event is associated with the game playing a sound effect at the block in question, when something can be described as "intend to destroy what is there"

There is no sound played for these blocks when broken. So is this expected behavior?

JHarris12345 commented 2 weeks ago

I think at least having an event to listen for these would be helpful. In my opinion, putting it as a blockdestroyevent makes most sense