Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Add CompostItemEvent and EntityCompostItemEvent

Open NoahvdAa opened this issue 4 years ago • 12 comments

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.

NoahvdAa avatar Aug 07 '21 13:08 NoahvdAa

This really seems like too much diff in the server patch for something so simple. Hold off on merging for now

Machine-Maker avatar Aug 07 '21 19:08 Machine-Maker

Also, I feel like this event should not be player-specific, cause villagers also compost stuff, and hoppers can insert items as well.

Machine-Maker avatar Aug 07 '21 20:08 Machine-Maker

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.

NoahvdAa avatar Aug 08 '21 21:08 NoahvdAa

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?

NoahvdAa avatar Aug 09 '21 09:08 NoahvdAa

(see https://github.com/PaperMC/Paper/pull/6356#discussion_r685663260)

Machine-Maker avatar Aug 10 '21 03:08 Machine-Maker

(These things can be handled by the merger so not really "required changes now")

Machine-Maker avatar Aug 10 '21 18:08 Machine-Maker

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?

NoahvdAa avatar Aug 19 '21 15:08 NoahvdAa

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?

Yes

JRoy avatar Aug 19 '21 15:08 JRoy

Rebased, comments have also been addressed.

NoahvdAa avatar Oct 01 '21 15:10 NoahvdAa

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.

stale[bot] avatar Dec 08 '21 21:12 stale[bot]

Rebased for 1.18.2

NoahvdAa avatar Mar 26 '22 15:03 NoahvdAa

Rebased and re-tested, on this PRs birthday 🥳




~~let's hope it doesn't have a second~~

NoahvdAa avatar Aug 07 '22 15:08 NoahvdAa