Skip to content

Add PlayerSpawnEntityEvent #6898

@aerulion

Description

@aerulion

Is your feature request related to a problem?

I'm trying to modify the entities which can be spawned by players, according to certain player bound criteria, for example some nbt data of the item that was used to spawn the entity, or the level of the player.

Describe the solution you'd like.

A generic event which covers all the entities that can be spawned by a player using an item. More specifically:

  • All SpawnEggs
  • Both ItemFrame variants
  • All fish buckets
  • Axolotl Bucket
  • Armorstand
  • Painting

I would also find the following methods very useful:

  • getItemStack() → The ItemStack used to spawn the entity
  • getEntity() → The Entity being spawned
  • getPlayer() → The Player who spawned the entity
  • getSpawnReason() → The SpawnReason, to more easily differentiate without necessarily checking the itemstack

Describe alternatives you've considered.

Listening to the player interact event, and either cancelling it, and spawning the entity myself, or trying to match it to the next entity spawn event. Both ways aren't ideal in my opinion.

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: acceptedDisputed bug is accepted as valid or Feature accepted as desired to be added.type: featureRequest for a new Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions