Interface PortalTrackProvider

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface PortalTrackProvider
A provider for portal track connections. Takes a track inbound through a portal and finds the exit location for the outbound track.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final SimpleRegistry<net.minecraft.world.level.block.Block,PortalTrackProvider>
     
  • Method Summary

    Modifier and Type
    Method
    Description
    findExit(net.minecraft.server.level.ServerLevel level, net.createmod.catnip.math.BlockFace face)
    Find the exit location for a track going through a portal.
    fromPortal(net.minecraft.server.level.ServerLevel level, net.createmod.catnip.math.BlockFace face, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> firstDimension, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> secondDimension, net.minecraft.world.level.block.Portal portal)
    Find an exit location by using an Portal instance.
    static @Nullable PortalTrackProvider.Exit
    getOtherSide(net.minecraft.server.level.ServerLevel level, net.createmod.catnip.math.BlockFace inboundTrack)
    Retrieves the corresponding outbound track on the other side of a portal.
    static boolean
    isSupportedPortal(net.minecraft.world.level.block.state.BlockState state)
    Checks if a given BlockState represents a supported portal block.
  • Field Details

  • Method Details

    • findExit

      PortalTrackProvider.Exit findExit(net.minecraft.server.level.ServerLevel level, net.createmod.catnip.math.BlockFace face)
      Find the exit location for a track going through a portal.
      Parameters:
      level - the level of the inbound track
      face - the face of the inbound track
    • isSupportedPortal

      static boolean isSupportedPortal(net.minecraft.world.level.block.state.BlockState state)
      Checks if a given BlockState represents a supported portal block.
      Parameters:
      state - The block state to check.
      Returns:
      true if the block state represents a supported portal; false otherwise.
    • getOtherSide

      @Nullable static @Nullable PortalTrackProvider.Exit getOtherSide(net.minecraft.server.level.ServerLevel level, net.createmod.catnip.math.BlockFace inboundTrack)
      Retrieves the corresponding outbound track on the other side of a portal.
      Parameters:
      level - The current ServerLevel.
      inboundTrack - The inbound track BlockFace.
      Returns:
      the found outbound track, or null if one wasn't found.
    • fromPortal

      static PortalTrackProvider.Exit fromPortal(net.minecraft.server.level.ServerLevel level, net.createmod.catnip.math.BlockFace face, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> firstDimension, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> secondDimension, net.minecraft.world.level.block.Portal portal)
      Find an exit location by using an Portal instance.
      Parameters:
      level - The level of the inbound track
      face - The face of the inbound track
      firstDimension - The first dimension (typically the Overworld)
      secondDimension - The second dimension (e.g., Nether, Aether)
      portal - The portal
      Returns:
      A found exit, or null if one wasn't found