Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Trampling farmland calls BlockFadeEvent

Open NonSwag opened this issue 1 year ago • 3 comments

Expected behavior

Trampling should not call the BlockFadeEvent

Observed/Actual behavior

It does call the BlockFadeEvent

Steps/models to reproduce

  1. listen for and cancel the block fade event
  2. trample a farmland block by jumping on it
  3. doesnt work

Plugin and Datapack List

irrelevant

Paper version

[15:42:27 INFO]: Checking version, please wait... [15:42:27 INFO]: This server is running Paper version 1.21.1-130-ver/1.21.1@4d2672e (2024-10-30T18:33:50Z) (Implementing API version 1.21.1-R0.1-SNAPSHOT) You are 1 version(s) behind Download the new version at: https://papermc.io/downloads/paper Previous version: 1.21.1-128-d348cb8 (MC: 1.21.1)

Other

The problem with this is that if you want to prevent natural block fading for farmland but allow trampling, you would have to implement a hacky solution which involves listening for the PlayerInteractEvent to track when a player tramples it temporarily store that information for that specific block and let the BlockFadeEvent pass if the conditions are met

NonSwag avatar Nov 02 '24 14:11 NonSwag

Do you know if this is a new issue, or has trampling farmland always called BlockFadeEvent?

Machine-Maker avatar Nov 02 '24 19:11 Machine-Maker

I know for a fact that I encountered this issue back in 1.19, but didn't know it I looked at the code I ran back then, and it is basically the same as now

NonSwag avatar Nov 02 '24 21:11 NonSwag

First time contributor here. I'd love to take a swing at this one.

valogan avatar Nov 18 '24 23:11 valogan

It seems like this behaviour was changed in 2018 by spigot when they made the block fade event also be called for path blocks turning to dirt. Instead of adding an event call to the path block class, they instead moved the call to the turnToDirt method, (unintentionally?) making the event also be called for trampling

Warriorrrr avatar Dec 27 '24 14:12 Warriorrrr

This definitely seems like it was unintentional

NonSwag avatar Dec 27 '24 15:12 NonSwag