Skip to content

Handle end portal creation with PortalCreateEvent #13832

@Biquaternions

Description

@Biquaternions

Is your feature request related to a problem?

Currently the PortalCreateEvent does not handle the end portal creation, and therefore does not allow to prevents its creation by cancelling the event, or execute custom behavior depending on the entity or blocks involved.

Describe the solution you'd like.

PortalCreateEvent should handle the end portal creation on the overworld.
Probably it should also handle other portal-like creations like:

  1. Creation of an end gateway
  2. Creation of the portal on the end fountain

Describe alternatives you've considered.

I have currently created this branch with a possible implementation:
main...Biquaternions:Paper:feat/end-portal-creation-event

Patch on pastes.dev in case I update the branch and the diff mutates:
https://pastes.dev/gc3AVzYTde

This implementation has the following behavior:

  1. The player consumes the eye of ender when placing it on a frame
  2. The frame updates to hold the eye
  3. The PortalCreateEvent event gets fired

Observations:

  1. If the PortalCreateEvent is cancelled, the player will have consumed the eye of ender, and the portal frame will be unusable in the future, given the frames are unbreakable and the eyes cannot be removed to cause a future update.
  2. The server still triggers the end portal creation event and sends the corresponding packet (ClientboundLevelEventPacket).
  3. It does not account for the portal creation during world generation.

Other

No response

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions