Class EntityPortalEvent

All Implemented Interfaces:
Cancellable

public class EntityPortalEvent extends EntityTeleportEvent
Called when a non-player entity is about to teleport because it is in contact with a portal.

For players see PlayerPortalEvent

  • Constructor Details

  • Method Details

    • getPortalType

      @NotNull public PortalType getPortalType()
      Get the portal type relating to this event.
      Returns:
      the portal type
    • getTo

      @Nullable public @Nullable Location getTo()
      For PortalType.NETHER, this is initially just the starting point for the search for a portal to teleport to. It will initially just be the EntityTeleportEvent.getFrom() scaled for dimension scaling and clamped to be inside the world border.

      For PortalType.ENDER, this will initially be the exact destination either, the world spawn for end->any world or end spawn for any world->end.

      Overrides:
      getTo in class EntityTeleportEvent
      Returns:
      starting point for search or exact destination
    • setTo

      public void setTo(@Nullable @Nullable Location to)
      See the description of getTo().
      Overrides:
      setTo in class EntityTeleportEvent
      Parameters:
      to - starting point for search or exact destination or null to cancel
    • setSearchRadius

      public void setSearchRadius(int searchRadius)
      Set the Block radius to search in for available portals.
      Parameters:
      searchRadius - the radius in which to search for a portal from the location
    • getSearchRadius

      public int getSearchRadius()
      Gets the search radius value for finding an available portal.
      Returns:
      the currently set search radius
    • getCanCreatePortal

      public boolean getCanCreatePortal()
      Returns whether the server will attempt to create a destination portal or not.
      Returns:
      whether there should create be a destination portal created
    • setCanCreatePortal

      public void setCanCreatePortal(boolean canCreatePortal)
      Sets whether the server should attempt to create a destination portal or not.
      Parameters:
      canCreatePortal - Sets whether there should be a destination portal created
    • setCreationRadius

      public void setCreationRadius(int creationRadius)
      Sets the maximum radius the world is searched for a free space from the given location. If enough free space is found then the portal will be created there, if not it will force create with air-space at the target location. Does not apply to end portal target platforms which will always appear at the target location.
      Parameters:
      creationRadius - the radius in which to create a portal from the location
    • getCreationRadius

      public int getCreationRadius()
      Gets the maximum radius the world is searched for a free space from the given location. If enough free space is found then the portal will be created there, if not it will force create with air-space at the target location. Does not apply to end portal target platforms which will always appear at the target location.
      Returns:
      the currently set creation radius
    • getHandlers

      @NotNull public @NotNull HandlerList getHandlers()
      Overrides:
      getHandlers in class EntityTeleportEvent
    • getHandlerList

      @NotNull public static @NotNull HandlerList getHandlerList()