Paper
                                
                                 Paper copied to clipboard
                                
                                    Paper copied to clipboard
                            
                            
                            
                        Add CompostItemEvent and EntityCompostItemEvent
Adds #6349 . The event exposes the player who composted, the composter block, the item stack used, whether or not the level will be raised (settable), the level the composter currently has and it is of course cancellable.
This really seems like too much diff in the server patch for something so simple. Hold off on merging for now
Also, I feel like this event should not be player-specific, cause villagers also compost stuff, and hoppers can insert items as well.
I've just pushed a commit that renames the event to CompostItemEvent (based on MachineMaker's implementation), which can now be triggered by entities (villagers/players) and hoppers.
I've now added a parent event, CompostItemEvent. Right now it only fires when an item is composted by a hopper, and the EntityCompostItemEvent, as the name implies, only fires when an entity composts an item. Should the parent event be fired aswell whenever the EntityCompostItemEvent is fired, or is the current implementation fine?
(see https://github.com/PaperMC/Paper/pull/6356#discussion_r685663260)
(These things can be handled by the merger so not really "required changes now")
Now that I think of it, these events should probably be in the io.papermc.paper.event package instead of com.destroystokyo.paper.event, right?
Now that I think of it, these events should probably be in the
io.papermc.paper.eventpackage instead ofcom.destroystokyo.paper.event, right?
Yes
Rebased, comments have also been addressed.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Rebased for 1.18.2
Rebased and re-tested, on this PRs birthday 🥳
~~let's hope it doesn't have a second~~