Skip to content

Add EntityHarvestBlockEvent#11951

Open
Doc94 wants to merge 9 commits into
PaperMC:mainfrom
Doc94:feature/entity-harvest-event
Open

Add EntityHarvestBlockEvent#11951
Doc94 wants to merge 9 commits into
PaperMC:mainfrom
Doc94:feature/entity-harvest-event

Conversation

@Doc94
Copy link
Copy Markdown
Member

@Doc94 Doc94 commented Jan 12, 2025

This starts in discord where the Composter when drop a bone meal not has any event... the first thing was use the Drop or Dispenser event but that not handle correctly in this behaviour... then Machine Maker suggest a new event.

Then this PR add a new event for the case when a Entity harvest a block currently for Vines and Composter. this new event cannot be a base of the player side by the original design... then add in the docs the mention for this cases...

@Doc94 Doc94 requested a review from a team as a code owner January 12, 2025 04:10
Comment thread paper-api/src/main/java/org/bukkit/event/player/PlayerHarvestBlockEvent.java Outdated
Comment thread paper-api/src/main/java/org/bukkit/event/entity/EntityHarvestBlockEvent.java Outdated
Comment thread paper-api/src/main/java/org/bukkit/event/entity/EntityHarvestBlockEvent.java Outdated
@Warriorrrr Warriorrrr added type: feature Request for a new Feature. scope: api labels Jan 12, 2025
Copy link
Copy Markdown
Member

@Warriorrrr Warriorrrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The case of foxes harvesting a sweet berry bush is currently missing, can be added in the FoxEatBerriesGoal#pickSweetBerries method

@Doc94
Copy link
Copy Markdown
Member Author

Doc94 commented Feb 11, 2025

The case of foxes harvesting a sweet berry bush is currently missing, can be added in the FoxEatBerriesGoal#pickSweetBerries method

ready i try to handle the whole logic where the "first" (with first i mean the first of the stack) item its used for the "hand" of the fox and the rest for drop/pop.

Comment thread paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java Outdated
@Doc94 Doc94 requested a review from Warriorrrr February 14, 2025 23:55
Copy link
Copy Markdown
Contributor

@notTamion notTamion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Owen1212055
Copy link
Copy Markdown
Member

I'm a little torn, because of the fact that we arent sharing any inheritance I really think we should make the EntityHarvestBlockEvent "more proper".

  • clone itemstacks, add getters/setters
  • make the list immutable, add a setter/getter

Issue is then people wanting to use the other event may get a bit confused.

@Doc94
Copy link
Copy Markdown
Member Author

Doc94 commented Feb 20, 2025

I'm a little torn, because of the fact that we arent sharing any inheritance I really think we should make the EntityHarvestBlockEvent "more proper".

  • clone itemstacks, add getters/setters
  • make the list immutable, add a setter/getter

Issue is then people wanting to use the other event may get a bit confused.

yeah i prefer keep the two events like the same.. if not then modify the two with this new "behaviours" but set itemstack? i mean all are in the list or i bad read something?

Copy link
Copy Markdown
Member

@Warriorrrr Warriorrrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking back at this now it would indeed seem better to make the new event more proper with defensive copying for the list and items and adding setters.

@github-project-automation github-project-automation Bot moved this from Awaiting final testing to Changes required in Paper PR Queue Oct 15, 2025
@Doc94
Copy link
Copy Markdown
Member Author

Doc94 commented Oct 15, 2025

Looking back at this now it would indeed seem better to make the new event more proper with defensive copying for the list and items and adding setters.

like Owen mention not?
clone items and make list can be replaced but not allow modify the items not?

PS: Another PR in the conflict list :(

Doc94 and others added 8 commits November 22, 2025 09:55
Co-authored-by: Warrior <50800980+Warriorrrr@users.noreply.github.com>
# Conflicts:
#	paper-server/patches/sources/net/minecraft/world/level/block/CaveVines.java.patch
#	paper-server/patches/sources/net/minecraft/world/level/block/ComposterBlock.java.patch
#	paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@Doc94 Doc94 force-pushed the feature/entity-harvest-event branch from c4774c2 to 058ff8f Compare November 22, 2025 13:10
@Doc94
Copy link
Copy Markdown
Member Author

Doc94 commented Nov 22, 2025

Ok now the entity event handle clone of items an the immutable list.... not sure if need make this to the player event too (what is a breaking change) or this is ready....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: api type: feature Request for a new Feature.

Projects

Status: Changes required

Development

Successfully merging this pull request may close these issues.

4 participants