Skip to content
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

Add ItemSpawnEntityEvent and BlockPlaceEntityEvent and expand EntityPlaceEvent #7377

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Machine-Maker
Copy link
Member

@Machine-Maker Machine-Maker commented Jan 20, 2022

WIP so far, still adding spots these events should be called, but should be a catch-all now for non-hanging entities spawned as a result of item "placement".

Resolves #4795
Resolves #6898
Supersedes #4184

Changes

Adds ItemSpawnEntityEvent
Adds PlaceEntityEvent (extends ItemSpawnEntityEvent)
Adds BlockPlaceEntityEvent (extends PlaceEntityEvent)
Makes EntityPlaceEvent extend PlaceEntityEvent

Added an ItemStack field on ItemSpawnEntityEvent since that applies to all uses of that event and EntityPlaceEvent.

New Event Calls

ItemSpawnEntityEvent
  • Spawn eggs from dispensers and players
EntityPlaceEvent (player only)
  • mob eggs from players
BlockPlaceEntityEvent (dispenser only)
  • boats
  • armor stand
  • mob buckets
  • tnt

Entity Placements

Preview Give feedback

@molor
Copy link

molor commented Jan 25, 2022

This is not the same as #4184?

@Machine-Maker
Copy link
Member Author

@molor a couple differences with that

  1. Its type inhertiance doesn't integerate with EntityPlaceEvent
  2. this provides access to the blockface
  3. no "entity setter", that really doesn't make sense with how the API deals with entities IMO
  4. This PR expands EntityPlaceEvent in addition to adding a new event

@aerulion
Copy link
Contributor

This would probably also close #6898, at least in regards to what I initially wanted to achieve.

@Machine-Maker Machine-Maker force-pushed the feature/ItemSpawnEntityEvent branch from ed8ab11 to 69d8686 Compare February 24, 2022 05:57
@Machine-Maker
Copy link
Member Author

Something I'm not sure about, are fire charges from dispeners? those technically do spawn an entity from an itemstack. but its different because a player can't do the same thing.

@aerulion
Copy link
Contributor

aerulion commented Mar 4, 2022

I would say the event should be called in this case, as it otherwise would be inconsistent to call the events for something like fireworks and spawn eggs, but not for fire charges. And to me it would be more likely for someone wanting to modify the dispensed fire charge, then someone wondering why there's always a null player on an entity which cannot be "summoned" by a player.

@Machine-Maker
Copy link
Member Author

Ok, that makes sense, but should it be EntityPlaceEvent or ItemSpawnEntityEvent? I’m leaning to EntityPlaceEvent even tho it’s more of a launch. (Like fireworks I guess)

@stale
Copy link

stale bot commented May 30, 2022

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.

@Machine-Maker Machine-Maker force-pushed the feature/ItemSpawnEntityEvent branch 2 times, most recently from 63e20ae to 44f3765 Compare June 24, 2022 02:19
@Machine-Maker
Copy link
Member Author

I've decided against adding Fire Charges and fireworks. I don't want to add any projectiles. They already have api that tracks their spawning stack and shooter. I did add PrimedTNT to the list, since a dispenser is placing that and its creating an entity.

@Machine-Maker Machine-Maker marked this pull request as ready for review June 24, 2022 02:22
@Machine-Maker Machine-Maker force-pushed the feature/ItemSpawnEntityEvent branch from 44f3765 to 80ab89b Compare July 22, 2022 18:32
@Machine-Maker Machine-Maker requested a review from a team as a code owner July 22, 2022 18:32
@Machine-Maker
Copy link
Member Author

Rebased for 1.19

@Machine-Maker Machine-Maker force-pushed the feature/ItemSpawnEntityEvent branch from 80ab89b to a64caa7 Compare December 13, 2022 06:58
@Machine-Maker Machine-Maker changed the title Add ItemSpawnEntityEvent and expand EntityPlaceEvent Add ItemSpawnEntityEvent and BlockPlaceEntityEvent and expand EntityPlaceEvent Dec 13, 2022
@Machine-Maker
Copy link
Member Author

Rebased and updated for 1.19.3. Reworked things a big to keep EntityPlaceEvent a player-only event.

@Doc94
Copy link
Contributor

Doc94 commented Aug 27, 2023

This can consider the staled #6487 ? its like the #6898 created later.. mostly for the Wither/Golems created using blocks detect how and who build (for avoid things like try listen place blocks and spawn for try make that)

@Machine-Maker Machine-Maker force-pushed the feature/ItemSpawnEntityEvent branch 2 times, most recently from b1092b2 to dfb0e36 Compare December 30, 2023 06:47
@Machine-Maker
Copy link
Member Author

Rebased for 1.20.4

@electronicboy
Copy link
Member

gave this a look over as much as I can with my level of sleep and sight, overall looks fine of what I've seen

@Machine-Maker Machine-Maker force-pushed the feature/ItemSpawnEntityEvent branch from dfb0e36 to 5ef0ea1 Compare May 13, 2024 04:42
@Machine-Maker
Copy link
Member Author

Rebased for 1.20.6

@Noogear
Copy link

Noogear commented Nov 25, 2024

Half a year has passed. Has this PR been forgotten? Up to now, there is still a lack of an event for tracking the generation of fish by using buckets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Awaiting review
Development

Successfully merging this pull request may close these issues.

Add PlayerSpawnEntityEvent EntitySpawnEvent with optional source ItemStack
8 participants