-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix some issues with the retract event & sticky pistons #9258
base: master
Are you sure you want to change the base?
Fix some issues with the retract event & sticky pistons #9258
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See minor comments below but this patch can creates a weird piston when i try to pull two slime blocks on the ground
patches/server/0768-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch
Outdated
Show resolved
Hide resolved
patches/server/0768-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch
Outdated
Show resolved
Hide resolved
patches/server/0768-Fix-sticky-pistons-and-BlockPistonRetractEvent.patch
Outdated
Show resolved
Hide resolved
41ec5a5
to
610db1b
Compare
ae9c2c4
to
0c1bf94
Compare
0c1bf94
to
46e4922
Compare
Rebased for 1.20.4. Tested by @Lulu13022002 |
Found a bug: When the piston does not move a block during retraction, the event PistonRetractEvent will show an opposite facing compared to when it does move a block. |
These two should use to However I'm not sure if it is not actually the correct behavior. Probably it is:
If it's actually correct, then it requires some changes as well - this one (above the line referenced in the diff - it's in |
2024-03-18.03-52-42.mp4 |
fc67bf1
to
9cd1f43
Compare
Ok, I think the correct solution is for getDirection to return the same value regardless of if its an extend or retract, just returning the direction the piston head is relative to the block itself. |
9cd1f43
to
cbd3c3d
Compare
2024-03-26.11-39-22.mp4Works properly, I tested cancelling too and it works as well. |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
However it will break plugins behavior on Spigot. Especially plugins tracking sticky pistons blocks movement as on Spigot the method (for sticky pistons) returns piston head direction for extend and the opposite for retract. It's not ideal though as well because currently on Spigot normal piston event getDirection method returns piston head direction for both extend and retract. There is one more inconsistency on Spigot too - the sticky piston doesn't fire retract event if there is no blocks attached to it. |
Reported by @Lulu13022002 and SPIGOT-2677.
When cancelling the retract event for sticky pistons, the piston head did not stay extended but the "stickyied" blocks were left behind. This doesn't match the normal piston behavior of keeping the head extended.
Root of the issue is that sticky events are called later due to need to collect the blocks being moved.
I didn't find any issues, and observers function correctly, not updating when the retract event is cancelled, but this could break some obscure redstone mechanic I'm not aware of.