Interface PortalTeleporter

All Known Implementing Classes:
FlatPortalFrameTester, PortalFrameTester, VerticalPortalFrameTester

public interface PortalTeleporter
Interface for calculating teleportation destinations and offsets. Responsible for determining where entities should be teleported within portals.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.world.phys.Vec3
    getEntityOffsetInPortal(net.minecraft.util.BlockUtil.FoundRectangle portalRect, net.minecraft.world.entity.Entity entity)
    Calculate the entity's offset within the source portal.
    net.minecraft.world.level.portal.TeleportTransition
    getTeleportTargetInPortal(net.minecraft.server.level.ServerLevel serverLevel, net.minecraft.util.BlockUtil.FoundRectangle portalRect, net.minecraft.core.Direction.Axis portalAxis, net.minecraft.world.phys.Vec3 prevOffset, net.minecraft.world.entity.Entity entity, PortalLink link)
    Calculate the teleportation target within the destination portal.
  • Method Details

    • getEntityOffsetInPortal

      net.minecraft.world.phys.Vec3 getEntityOffsetInPortal(net.minecraft.util.BlockUtil.FoundRectangle portalRect, net.minecraft.world.entity.Entity entity)
      Calculate the entity's offset within the source portal. This is used to preserve relative position when teleporting.
      Parameters:
      portalRect - the rectangular bounds of the portal
      entity - the entity entering the portal
      Returns:
      the entity's offset within the portal
    • getTeleportTargetInPortal

      net.minecraft.world.level.portal.TeleportTransition getTeleportTargetInPortal(net.minecraft.server.level.ServerLevel serverLevel, net.minecraft.util.BlockUtil.FoundRectangle portalRect, net.minecraft.core.Direction.Axis portalAxis, net.minecraft.world.phys.Vec3 prevOffset, net.minecraft.world.entity.Entity entity, PortalLink link)
      Calculate the teleportation target within the destination portal.
      Parameters:
      serverLevel - the destination level
      portalRect - the rectangular bounds of the destination portal
      portalAxis - the axis of the portal
      prevOffset - the entity's offset from the source portal
      entity - the entity being teleported
      link - the portal configuration link
      Returns:
      the teleport transition describing the destination